public sealed class SilkGlesApiThe GL entry points, over Silk.NET.OpenGLES.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The second binding, and the reason there are two. libGL and libGLESv2 are different libraries with different entry-point tables, and Silk.NET.OpenGL and Silk.NET.OpenGLES are the two generated bindings that say so — the type named GL in each is a distinct class over a distinct symbol set. A single binding covering both would have to declare entry points that do not exist on one of them, which is exactly the mistake this file exists to avoid making silently.
Everything above IGlApi is unchanged, which is the claim the seam was built to make good on: GlDevice, GlStateCache, GlBindingPlan and GlslTranslator already differ by GlProfile, and none of them names a binding type. Adding GLES is this file and the context that loads it, and nothing else.
Three profiles use it, not two. Es30 and Es32 reach it through EglContext; WebGl2 reaches it through a browser context, which is the same binding over Emscripten's GL layer (docs/plan/05 § Web). Where the three differ is inside the methods, and every difference is named in the remarks on the method rather than branched on here.
Three methods here are stand-ins rather than transcription, and each is a place GLES has no entry point but does have an answer:
GetBufferSubData — GLES has no glGetBufferSubData at any version. It maps the range, copies and unmaps, which is what the IGlApi contract asks for: "give me these bytes", by whatever mechanism the profile has. MultiDrawElementsIndirect — GLES 3.1 has glDrawElementsIndirect for one draw and no multi-draw at all, so this loops. That is why GraphicsDeviceFeatures.HasMultiDrawIndirect is false on every GLES profile: the calls happen, and they happen one at a time. StorageBlockBinding — GLES has no glShaderStorageBlockBinding. A storage block's binding has to come from layout(binding = …) in the source, which is what GlslTranslator emits on every profile that has storage buffers at all — HasStorageBuffers and HasExplicitBindings are true together and start at the same profile. So there is nothing left to assign after the link, and this is a no-op rather than a refusal.
Four more throw, and none of them is reachable from a device that asked its profile first: ClipControl, PolygonMode and the two base-instance draws. GlDevice gates them on HasClipControl, HasWireframe and HasBaseInstance respectively, all of which are desktop-only — so reaching one of these means a gate was removed, and a throw naming the entry point is a better report of that than a silent no-op that draws the wrong thing.
Not exercised by the test suite, deliberately and visibly — the same position SilkGlApi takes, for the same reason. What it needs is a driver, which CI provides on the Mesa leg (docs/plan/05 § Cross-backend equivalence) and an Android device provides for the rest.
Fields and properties (1)
public GlProfile ProfileWhich dialect this context speaks.
Methods (100)
public SilkGlesApi(GL gl, GlProfile profile)Wraps entry points somebody else loaded.
public SilkGlesApi(IGLContext context, GlProfile profile)Loads the entry points from a context.
public uint GenBuffer()glGenBuffers, for one.
public void DeleteBuffer(uint buffer)glDeleteBuffers, for one.
public void BindBuffer(uint target, uint buffer)glBindBuffer.
public void BindBufferRange(uint target, uint index, uint buffer, nint offset, nuint size)glBindBufferRange.
public void BufferData(uint target, nuint size, uint usage)glBufferData with no initial contents.
public void BufferSubData(uint target, nint offset, ReadOnlySpan<byte> data)glBufferSubData.
public void CopyBufferSubData(uint readTarget, uint writeTarget, nint readOffset, nint writeOffset, nuint size)glCopyBufferSubData.
public void GetBufferSubData(uint target, nint offset, Span<byte> destination)public uint GenTexture()glGenTextures, for one.
public void DeleteTexture(uint texture)glDeleteTextures, for one.
public void BindTexture(uint target, uint texture)glBindTexture.
public void ActiveTexture(uint unit)glActiveTexture, taking a unit index rather than GL_TEXTURE0 + n.
public void TexStorage2D(uint target, int levels, uint internalFormat, int width, int height)glTexStorage2D.
public void TexStorage3D(uint target, int levels, uint internalFormat, int width, int height, int depth)glTexStorage3D.
public void TexStorage2DMultisample(uint target, int samples, uint internalFormat, int width, int height)public void TexSubImage2D(uint target, int level, int x, int y, int width, int height, uint format, uint type, nint bufferOffset)glTexSubImage2D, reading from whatever is bound to GL_PIXEL_UNPACK_BUFFER.
public void TexSubImage3D(uint target, int level, int x, int y, int z, int width, int height, int depth, uint format, uint type, nint bufferOffset)glTexSubImage3D, reading from whatever is bound to GL_PIXEL_UNPACK_BUFFER.
public void TexParameter(uint target, uint parameter, int value)glTexParameteri.
public void GenerateMipmap(uint target)glGenerateMipmap.
public void CopyImageSubData(uint sourceName, uint sourceTarget, int sourceLevel, int sourceX, int sourceY, int sourceZ, uint destinationName, uint destinationTarget, int destinationLevel, int destinationX, int destinationY, int destinationZ, int width, int height, int depth)glCopyImageSubData.
public uint GenSampler()glGenSamplers, for one.
public void DeleteSampler(uint sampler)glDeleteSamplers, for one.
public void BindSampler(uint unit, uint sampler)glBindSampler.
public void SamplerParameter(uint sampler, uint parameter, int value)glSamplerParameteri.
public void SamplerParameter(uint sampler, uint parameter, float value)glSamplerParameterf.
public void SamplerParameter(uint sampler, uint parameter, ReadOnlySpan<float> values)public uint GenFramebuffer()glGenFramebuffers, for one.
public void DeleteFramebuffer(uint framebuffer)glDeleteFramebuffers, for one.
public void BindFramebuffer(uint target, uint framebuffer)glBindFramebuffer.
public void FramebufferTexture2D(uint target, uint attachment, uint textureTarget, uint texture, int level)glFramebufferTexture2D.
public void FramebufferTextureLayer(uint target, uint attachment, uint texture, int level, int layer)glFramebufferTextureLayer.
public uint CheckFramebufferStatus(uint target)glCheckFramebufferStatus.
public void DrawBuffers(ReadOnlySpan<uint> attachments)glDrawBuffers.
public void ReadBuffer(uint attachment)glReadBuffer.
public void InvalidateFramebuffer(uint target, ReadOnlySpan<uint> attachments)glInvalidateFramebuffer, which is how DontCare is said.
public void BlitFramebuffer(int sourceX0, int sourceY0, int sourceX1, int sourceY1, int destinationX0, int destinationY0, int destinationX1, int destinationY1, uint mask, uint filter)glBlitFramebuffer.
public void ReadPixels(int x, int y, int width, int height, uint format, uint type, nint bufferOffset)glReadPixels into whatever is bound to GL_PIXEL_PACK_BUFFER.
public void ClearBuffer(uint buffer, int drawBuffer, ReadOnlySpan<float> value)glClearBufferfv.
public void ClearBuffer(uint buffer, int drawBuffer, ReadOnlySpan<int> value)glClearBufferiv.
public void ClearBufferDepthStencil(int drawBuffer, float depth, int stencil)glClearBufferfi, the only way to clear packed depth-stencil.
public uint GenVertexArray()glGenVertexArrays, for one.
public void DeleteVertexArray(uint array)glDeleteVertexArrays, for one.
public void BindVertexArray(uint array)glBindVertexArray.
public void EnableVertexAttribArray(uint index)glEnableVertexAttribArray.
public void DisableVertexAttribArray(uint index)glDisableVertexAttribArray.
public void VertexAttribPointer(uint index, int size, uint type, bool normalised, int stride, nint offset)glVertexAttribPointer.
public void VertexAttribIPointer(uint index, int size, uint type, int stride, nint offset)glVertexAttribIPointer.
public void VertexAttribDivisor(uint index, uint divisor)glVertexAttribDivisor.
public uint CreateShader(uint type)glCreateShader.
public string? CompileShader(uint shader, string source)glShaderSource plus glCompileShader, reporting the log on failure.
public void DeleteShader(uint shader)glDeleteShader.
public uint CreateProgram()glCreateProgram.
public void AttachShader(uint program, uint shader)glAttachShader.
public string? LinkProgram(uint program)glLinkProgram, reporting the log on failure.
public void DeleteProgram(uint program)glDeleteProgram.
public void UseProgram(uint program)glUseProgram.
public uint GetUniformBlockIndex(uint program, string name)glGetUniformBlockIndex.
public void UniformBlockBinding(uint program, uint blockIndex, uint binding)glUniformBlockBinding.
public uint GetStorageBlockIndex(uint program, string name)glGetProgramResourceIndex for a shader storage block.
public void StorageBlockBinding(uint program, uint blockIndex, uint binding)public int GetUniformLocation(uint program, string name)glGetUniformLocation.
public void Uniform(int location, int value)glUniform1i.
public void Uniform4(int location, ReadOnlySpan<float> values)glUniform4fv over an array of vec4.
public void Enable(uint capability)glEnable.
public void Disable(uint capability)glDisable.
public void DepthFunc(uint comparison)glDepthFunc.
public void DepthMask(bool write)glDepthMask.
public void ColourMask(bool red, bool green, bool blue, bool alpha)glColorMask.
public void CullFace(uint face)glCullFace.
public void FrontFace(uint winding)glFrontFace.
public void PolygonMode(uint face, uint mode)public void PolygonOffset(float factor, float units)glPolygonOffset.
public void BlendEquationSeparate(uint colour, uint alpha)glBlendEquationSeparate.
public void BlendFuncSeparate(uint sourceColour, uint destinationColour, uint sourceAlpha, uint destinationAlpha)glBlendFuncSeparate.
public void BlendColour(float red, float green, float blue, float alpha)glBlendColor.
public void StencilFuncSeparate(uint face, uint comparison, int reference, uint mask)glStencilFuncSeparate.
public void StencilOpSeparate(uint face, uint fail, uint depthFail, uint pass)glStencilOpSeparate.
public void StencilMaskSeparate(uint face, uint mask)glStencilMaskSeparate.
public void Viewport(int x, int y, int width, int height)glViewport.
public void DepthRange(float near, float far)public void Scissor(int x, int y, int width, int height)glScissor.
public void ClipControl(uint origin, uint depth)public void DrawArraysInstanced(uint topology, int first, int count, int instanceCount)glDrawArraysInstanced.
public void DrawArraysInstancedBaseInstance(uint topology, int first, int count, int instanceCount, uint baseInstance)public void DrawElementsInstancedBaseVertex(uint topology, int count, uint indexType, nint offset, int instanceCount, int baseVertex)public void DrawElementsInstancedBaseVertexBaseInstance(uint topology, int count, uint indexType, nint offset, int instanceCount, int baseVertex, uint baseInstance)public void MultiDrawElementsIndirect(uint topology, uint indexType, nint offset, int drawCount, int stride)public void DispatchCompute(uint x, uint y, uint z)glDispatchCompute.
public void DispatchComputeIndirect(nint offset)glDispatchComputeIndirect.
public void MemoryBarrier(uint bits)glMemoryBarrier.
public void Finish()glFinish.
public void Flush()glFlush.
public void PushDebugGroup(string name)glPushDebugGroup.
public void PopDebugGroup()glPopDebugGroup.
public void DebugMarker(string name)glDebugMessageInsert with a marker severity.
public void ObjectLabel(uint identifier, uint name, string label)glObjectLabel.
public uint GetError()glGetError, drained.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.