public sealed class SilkGlApiThe GL entry points, over Silk.NET.OpenGL.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The only file in this assembly that names a binding type. Everything above it talks to IGlApi, which is what lets the translation layer — the part ADR-001 wants validated, and the part that is actually difficult — be exercised on a CI runner with no GL context. What is here is delegation: each method is one call, with the enumerant cast from the value GlConstants holds to the enum Silk wants.
GLEnum rather than Silk's per-parameter enums throughout. Silk generates a distinct enum for nearly every parameter — BufferTargetARB, TextureTarget, FramebufferAttachment — and threading those through IGlApi would put the binding in the interface, which is the one thing this seam exists to prevent. The values are identical; GLEnum is the union of all of them.
Not exercised by the test suite, deliberately and visibly. There is nothing here to get wrong except a transcription, and a transcription is what a compiler checks. The logic that could be wrong is in the other twelve files, and all of it is under test. What this file needs instead is a driver, which CI provides on the Mesa leg (docs/plan/05 § Cross-backend equivalence).
Fields and properties (1)
public GlProfile ProfileWhich dialect this context speaks.
Methods (101)
public SilkGlApi(GL gl, GlProfile profile)Wraps entry points somebody else loaded.
public SilkGlApi(IGLContext context, GlProfile profile)Loads the entry points from a context.
public static SilkGlApi FromProcAddress(Func<string, nint> getProcAddress, GlProfile profile)Loads the entry points from a function that resolves them by name.
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)glGetBufferSubData, or the profile's stand-in for it.
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)glSamplerParameterfv, for the four-component border colour.
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)glShaderStorageBlockBinding.
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)glPolygonMode. Desktop only.
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)glDepthRangef.
public void Scissor(int x, int y, int width, int height)glScissor.
public void ClipControl(uint origin, uint depth)glClipControl. GL 4.5 only.
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)glDrawArraysInstancedBaseInstance. GL 4.2 only.
public void DrawElementsInstancedBaseVertex(uint topology, int count, uint indexType, nint offset, int instanceCount, int baseVertex)glDrawElementsInstancedBaseVertex.
public void DrawElementsInstancedBaseVertexBaseInstance(uint topology, int count, uint indexType, nint offset, int instanceCount, int baseVertex, uint baseInstance)glDrawElementsInstancedBaseVertexBaseInstance. GL 4.2 only.
public void MultiDrawElementsIndirect(uint topology, uint indexType, nint offset, int drawCount, int stride)glMultiDrawElementsIndirect, reading from the bound indirect buffer.
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.
Used by (1)
- GraphicsHostVixen.App