public interface IGlApiEvery GL entry point this backend calls.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The seam that makes the hard part testable. ADR-001 gives this backend the job of proving the RHI is API-neutral, and that proof lives in the translation — pipeline objects becoming program-plus-state, descriptor sets becoming binding indices, barriers becoming nothing at all. None of it needs a GL context to be wrong, and none of it would be checked on a CI runner if checking it required one. So the calls go through an interface, the binding lives behind SilkGlApi, and the tests drive a recorder.
Deliberately non-DSA. GL 4.5 has glCreateBuffers and friends and they are nicer; GLES and WebGL2 do not, and this backend is one code path across three profiles rather than two paths and a flag. Bind-then-modify is what all three have.
Everything is single-threaded by contract. GL state is per-context and a context is current on one thread — which is why GlCommandList records into managed memory on whatever thread it likes and nothing here is called until submit.
Fields and properties (1)
GlProfile ProfileWhich dialect this context speaks.
Methods (97)
uint GenBuffer()glGenBuffers, for one.
void DeleteBuffer(uint buffer)glDeleteBuffers, for one.
void BindBuffer(uint target, uint buffer)glBindBuffer.
void BindBufferRange(uint target, uint index, uint buffer, nint offset, nuint size)glBindBufferRange.
void BufferData(uint target, nuint size, uint usage)glBufferData with no initial contents.
void BufferSubData(uint target, nint offset, ReadOnlySpan<byte> data)glBufferSubData.
void CopyBufferSubData(uint readTarget, uint writeTarget, nint readOffset, nint writeOffset, nuint size)glCopyBufferSubData.
void GetBufferSubData(uint target, nint offset, Span<byte> destination)glGetBufferSubData, or the profile's stand-in for it.
uint GenTexture()glGenTextures, for one.
void DeleteTexture(uint texture)glDeleteTextures, for one.
void BindTexture(uint target, uint texture)glBindTexture.
void ActiveTexture(uint unit)glActiveTexture, taking a unit index rather than GL_TEXTURE0 + n.
void TexStorage2D(uint target, int levels, uint internalFormat, int width, int height)glTexStorage2D.
void TexStorage3D(uint target, int levels, uint internalFormat, int width, int height, int depth)glTexStorage3D.
void TexStorage2DMultisample(uint target, int samples, uint internalFormat, int width, int height)glTexStorage2DMultisample.
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.
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.
void TexParameter(uint target, uint parameter, int value)glTexParameteri.
void GenerateMipmap(uint target)glGenerateMipmap.
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.
uint GenSampler()glGenSamplers, for one.
void DeleteSampler(uint sampler)glDeleteSamplers, for one.
void BindSampler(uint unit, uint sampler)glBindSampler.
void SamplerParameter(uint sampler, uint parameter, int value)glSamplerParameteri.
void SamplerParameter(uint sampler, uint parameter, float value)glSamplerParameterf.
void SamplerParameter(uint sampler, uint parameter, ReadOnlySpan<float> values)glSamplerParameterfv, for the four-component border colour.
uint GenFramebuffer()glGenFramebuffers, for one.
void DeleteFramebuffer(uint framebuffer)glDeleteFramebuffers, for one.
void BindFramebuffer(uint target, uint framebuffer)glBindFramebuffer.
void FramebufferTexture2D(uint target, uint attachment, uint textureTarget, uint texture, int level)glFramebufferTexture2D.
void FramebufferTextureLayer(uint target, uint attachment, uint texture, int level, int layer)glFramebufferTextureLayer.
uint CheckFramebufferStatus(uint target)glCheckFramebufferStatus.
void DrawBuffers(ReadOnlySpan<uint> attachments)glDrawBuffers.
void ReadBuffer(uint attachment)glReadBuffer.
void InvalidateFramebuffer(uint target, ReadOnlySpan<uint> attachments)glInvalidateFramebuffer, which is how DontCare is said.
void BlitFramebuffer(int sourceX0, int sourceY0, int sourceX1, int sourceY1, int destinationX0, int destinationY0, int destinationX1, int destinationY1, uint mask, uint filter)glBlitFramebuffer.
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.
void ClearBuffer(uint buffer, int drawBuffer, ReadOnlySpan<float> value)glClearBufferfv.
void ClearBuffer(uint buffer, int drawBuffer, ReadOnlySpan<int> value)glClearBufferiv.
void ClearBufferDepthStencil(int drawBuffer, float depth, int stencil)glClearBufferfi, the only way to clear packed depth-stencil.
uint GenVertexArray()glGenVertexArrays, for one.
void DeleteVertexArray(uint array)glDeleteVertexArrays, for one.
void BindVertexArray(uint array)glBindVertexArray.
void EnableVertexAttribArray(uint index)glEnableVertexAttribArray.
void DisableVertexAttribArray(uint index)glDisableVertexAttribArray.
void VertexAttribPointer(uint index, int size, uint type, bool normalised, int stride, nint offset)glVertexAttribPointer.
void VertexAttribIPointer(uint index, int size, uint type, int stride, nint offset)glVertexAttribIPointer.
void VertexAttribDivisor(uint index, uint divisor)glVertexAttribDivisor.
uint CreateShader(uint type)glCreateShader.
string? CompileShader(uint shader, string source)glShaderSource plus glCompileShader, reporting the log on failure.
void DeleteShader(uint shader)glDeleteShader.
uint CreateProgram()glCreateProgram.
void AttachShader(uint program, uint shader)glAttachShader.
string? LinkProgram(uint program)glLinkProgram, reporting the log on failure.
void DeleteProgram(uint program)glDeleteProgram.
void UseProgram(uint program)glUseProgram.
uint GetUniformBlockIndex(uint program, string name)glGetUniformBlockIndex.
void UniformBlockBinding(uint program, uint blockIndex, uint binding)glUniformBlockBinding.
uint GetStorageBlockIndex(uint program, string name)glGetProgramResourceIndex for a shader storage block.
void StorageBlockBinding(uint program, uint blockIndex, uint binding)glShaderStorageBlockBinding.
int GetUniformLocation(uint program, string name)glGetUniformLocation.
void Uniform(int location, int value)glUniform1i.
void Uniform4(int location, ReadOnlySpan<float> values)glUniform4fv over an array of vec4.
void Enable(uint capability)glEnable.
void Disable(uint capability)glDisable.
void DepthFunc(uint comparison)glDepthFunc.
void DepthMask(bool write)glDepthMask.
void ColourMask(bool red, bool green, bool blue, bool alpha)glColorMask.
void CullFace(uint face)glCullFace.
void FrontFace(uint winding)glFrontFace.
void PolygonMode(uint face, uint mode)glPolygonMode. Desktop only.
void PolygonOffset(float factor, float units)glPolygonOffset.
void BlendEquationSeparate(uint colour, uint alpha)glBlendEquationSeparate.
void BlendFuncSeparate(uint sourceColour, uint destinationColour, uint sourceAlpha, uint destinationAlpha)glBlendFuncSeparate.
void BlendColour(float red, float green, float blue, float alpha)glBlendColor.
void StencilFuncSeparate(uint face, uint comparison, int reference, uint mask)glStencilFuncSeparate.
void StencilOpSeparate(uint face, uint fail, uint depthFail, uint pass)glStencilOpSeparate.
void StencilMaskSeparate(uint face, uint mask)glStencilMaskSeparate.
void Viewport(int x, int y, int width, int height)glViewport.
void DepthRange(float near, float far)glDepthRangef.
void Scissor(int x, int y, int width, int height)glScissor.
void ClipControl(uint origin, uint depth)glClipControl. GL 4.5 only.
void DrawArraysInstanced(uint topology, int first, int count, int instanceCount)glDrawArraysInstanced.
void DrawArraysInstancedBaseInstance(uint topology, int first, int count, int instanceCount, uint baseInstance)glDrawArraysInstancedBaseInstance. GL 4.2 only.
void DrawElementsInstancedBaseVertex(uint topology, int count, uint indexType, nint offset, int instanceCount, int baseVertex)glDrawElementsInstancedBaseVertex.
void DrawElementsInstancedBaseVertexBaseInstance(uint topology, int count, uint indexType, nint offset, int instanceCount, int baseVertex, uint baseInstance)glDrawElementsInstancedBaseVertexBaseInstance. GL 4.2 only.
void MultiDrawElementsIndirect(uint topology, uint indexType, nint offset, int drawCount, int stride)glMultiDrawElementsIndirect, reading from the bound indirect buffer.
void DispatchCompute(uint x, uint y, uint z)glDispatchCompute.
void DispatchComputeIndirect(nint offset)glDispatchComputeIndirect.
void MemoryBarrier(uint bits)glMemoryBarrier.
void Finish()glFinish.
void Flush()glFlush.
void PushDebugGroup(string name)glPushDebugGroup.
void PopDebugGroup()glPopDebugGroup.
void DebugMarker(string name)glDebugMessageInsert with a marker severity.
void ObjectLabel(uint identifier, uint name, string label)glObjectLabel.
uint GetError()glGetError, drained.
Used by (9)
- GlDeviceVixen.Graphics.OpenGL
- GlDeviceOptionsVixen.Graphics.OpenGL
- GlFramebufferCacheVixen.Graphics.OpenGL
- GlProgramCacheVixen.Graphics.OpenGL
- GlStateCacheVixen.Graphics.OpenGL
- GlSubmitterVixen.Graphics.OpenGL
- RecordingGlApiVixen.Graphics.OpenGL.Tests
- SilkGlApiVixen.Graphics.OpenGL
- SilkGlesApiVixen.Graphics.OpenGL