opengl source gen tool works

This commit is contained in:
Youmu Liu
2026-08-27 15:05:43 +08:00
parent 5db9f39a46
commit 648cac9d9b
42 changed files with 10247 additions and 10189 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,238 +0,0 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL on 2026-08-25 09:22:55Z
// Version: 4.0
// </auto-generated>
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using StgSharp.Graphics.OpenGL;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BeginQueryIndexed(uint target, uint index, uint id)
{
Context.glBeginQueryIndexed(target, index, id);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindTransformFeedback(uint target, uint id)
{
Context.glBindTransformFeedback(target, id);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendEquationSeparate(uint buf, uint modeRGB, uint modeAlpha)
{
Context.glBlendEquationSeparatei(buf, modeRGB, modeAlpha);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendEquation(uint buf, uint mode)
{
Context.glBlendEquationi(buf, mode);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendFuncSeparate(uint buf, uint srcRGB, uint dstRGB, uint srcAlpha, uint dstAlpha)
{
Context.glBlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendFunc(uint buf, uint src, uint dst)
{
Context.glBlendFunci(buf, src, dst);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DeleteTransformFeedbacks(ReadOnlySpan<uint> ids)
{
fixed (uint* idsPtr = ids)
{
Context.glDeleteTransformFeedbacks(checked((int)ids.Length), idsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawArraysIndirect(uint mode, void* indirect)
{
Context.glDrawArraysIndirect(mode, indirect);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawElementsIndirect(uint mode, uint type, void* indirect)
{
Context.glDrawElementsIndirect(mode, type, indirect);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedback(uint mode, uint id)
{
Context.glDrawTransformFeedback(mode, id);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedbackStream(uint mode, uint id, uint stream)
{
Context.glDrawTransformFeedbackStream(mode, id, stream);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void EndQueryIndexed(uint target, uint index)
{
Context.glEndQueryIndexed(target, index);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GenTransformFeedbacks(Span<uint> ids)
{
fixed (uint* idsPtr = ids)
{
Context.glGenTransformFeedbacks(checked((int)ids.Length), idsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveSubroutineName(GlHandle program, uint shadertype, uint index, out int length, Span<byte> name)
{
length = default;
fixed (int* lengthPtr = &length)
{
fixed (byte* namePtr = name)
{
Context.glGetActiveSubroutineName(program.Value, shadertype, index, checked((int)name.Length), lengthPtr, namePtr);
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveSubroutineUniformName(GlHandle program, uint shadertype, uint index, out int length, Span<byte> name)
{
length = default;
fixed (int* lengthPtr = &length)
{
fixed (byte* namePtr = name)
{
Context.glGetActiveSubroutineUniformName(program.Value, shadertype, index, checked((int)name.Length), lengthPtr, namePtr);
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveSubroutineUniformiv(GlHandle program, uint shadertype, uint index, uint pname, Span<int> values)
{
fixed (int* valuesPtr = values)
{
Context.glGetActiveSubroutineUniformiv(program.Value, shadertype, index, pname, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramStageiv(GlHandle program, uint shadertype, uint pname, out int values)
{
values = default;
fixed (int* valuesPtr = &values)
{
Context.glGetProgramStageiv(program.Value, shadertype, pname, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryIndexediv(uint target, uint index, uint pname, Span<int> @params)
{
fixed (int* @paramsPtr = @params)
{
Context.glGetQueryIndexediv(target, index, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetSubroutineIndex(GlHandle program, uint shadertype, ReadOnlySpan<byte> name)
{
fixed (byte* namePtr = name)
{
return Context.glGetSubroutineIndex(program.Value, shadertype, namePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetSubroutineUniformLocation(GlHandle program, uint shadertype, ReadOnlySpan<byte> name)
{
fixed (byte* namePtr = name)
{
return Context.glGetSubroutineUniformLocation(program.Value, shadertype, namePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetUniformSubroutineuiv(uint shadertype, int location, out uint @params)
{
@params = default;
fixed (uint* @paramsPtr = &@params)
{
Context.glGetUniformSubroutineuiv(shadertype, location, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetUniform(GlHandle program, int location, Span<double> @params)
{
fixed (double* @paramsPtr = @params)
{
Context.glGetUniformdv(program.Value, location, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public byte IsTransformFeedback(uint id)
{
return Context.glIsTransformFeedback(id);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MinSampleShading(float value)
{
Context.glMinSampleShading(value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PatchParameter(uint pname, ReadOnlySpan<float> values)
{
fixed (float* valuesPtr = values)
{
Context.glPatchParameterfv(pname, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PatchParameter(uint pname, int value)
{
Context.glPatchParameteri(pname, value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PauseTransformFeedback()
{
Context.glPauseTransformFeedback();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ResumeTransformFeedback()
{
Context.glResumeTransformFeedback();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UniformSubroutinesuiv(uint shadertype, ReadOnlySpan<uint> indices)
{
fixed (uint* indicesPtr = indices)
{
Context.glUniformSubroutinesuiv(shadertype, checked((int)indices.Length), indicesPtr);
}
}
}
}
@@ -1,286 +0,0 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL on 2026-08-25 09:22:55Z
// Version: 4.1
// </auto-generated>
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using StgSharp.Graphics.OpenGL;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ActiveShaderProgram(uint pipeline, GlHandle program)
{
Context.glActiveShaderProgram(pipeline, program.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindProgramPipeline(uint pipeline)
{
Context.glBindProgramPipeline(pipeline);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearDepth(float d)
{
Context.glClearDepthf(d);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public GlHandle CreateShaderProgramv(uint type, int count, byte** strings)
{
return GlHandle.Create(Context.glCreateShaderProgramv(type, count, strings));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DeleteProgramPipelines(ReadOnlySpan<uint> pipelines)
{
fixed (uint* pipelinesPtr = pipelines)
{
Context.glDeleteProgramPipelines(checked((int)pipelines.Length), pipelinesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DepthRangeArrayv(uint first, int count, ReadOnlySpan<double> v)
{
fixed (double* vPtr = v)
{
Context.glDepthRangeArrayv(first, count, vPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DepthRangeIndexed(uint index, double n, double f)
{
Context.glDepthRangeIndexed(index, n, f);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DepthRange(float n, float f)
{
Context.glDepthRangef(n, f);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GenProgramPipelines(Span<uint> pipelines)
{
fixed (uint* pipelinesPtr = pipelines)
{
Context.glGenProgramPipelines(checked((int)pipelines.Length), pipelinesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetDoublei_v(uint target, uint index, Span<double> data)
{
fixed (double* dataPtr = data)
{
Context.glGetDoublei_v(target, index, dataPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetFloati_v(uint target, uint index, Span<float> data)
{
fixed (float* dataPtr = data)
{
Context.glGetFloati_v(target, index, dataPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramBinary(GlHandle program, int bufSize, out int length, out uint binaryFormat, void* binary)
{
length = default;
binaryFormat = default;
fixed (int* lengthPtr = &length)
{
fixed (uint* binaryFormatPtr = &binaryFormat)
{
Context.glGetProgramBinary(program.Value, bufSize, lengthPtr, binaryFormatPtr, binary);
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramPipelineInfoLog(uint pipeline, out int length, Span<byte> infoLog)
{
length = default;
fixed (int* lengthPtr = &length)
{
fixed (byte* infoLogPtr = infoLog)
{
Context.glGetProgramPipelineInfoLog(pipeline, checked((int)infoLog.Length), lengthPtr, infoLogPtr);
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramPipelineiv(uint pipeline, uint pname, Span<int> @params)
{
fixed (int* @paramsPtr = @params)
{
Context.glGetProgramPipelineiv(pipeline, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetShaderPrecisionFormat(uint shadertype, uint precisiontype, Span<int> range, out int precision)
{
precision = default;
if (range.Length < 2) {
throw new ArgumentException("Span is shorter than the OpenGL length expression '2'.", nameof(range));
}
fixed (int* rangePtr = range)
{
fixed (int* precisionPtr = &precision)
{
Context.glGetShaderPrecisionFormat(shadertype, precisiontype, rangePtr, precisionPtr);
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetVertexAttribLdv(uint index, uint pname, Span<double> @params)
{
fixed (double* @paramsPtr = @params)
{
Context.glGetVertexAttribLdv(index, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public byte IsProgramPipeline(uint pipeline)
{
return Context.glIsProgramPipeline(pipeline);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramBinary(GlHandle program, uint binaryFormat, void* binary, int length)
{
Context.glProgramBinary(program.Value, binaryFormat, binary, length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramParameter(GlHandle program, uint pname, int value)
{
Context.glProgramParameteri(program.Value, pname, value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReleaseShaderCompiler()
{
Context.glReleaseShaderCompiler();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ScissorArrayv(uint first, int count, ReadOnlySpan<int> v)
{
fixed (int* vPtr = v)
{
Context.glScissorArrayv(first, count, vPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ScissorIndexed(uint index, int left, int bottom, int width, int height)
{
Context.glScissorIndexed(index, left, bottom, width, height);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ScissorIndexed(uint index, ReadOnlySpan<int> v)
{
if (v.Length < 4) {
throw new ArgumentException("Span is shorter than the OpenGL length expression '4'.", nameof(v));
}
fixed (int* vPtr = v)
{
Context.glScissorIndexedv(index, vPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ShaderBinary(ReadOnlySpan<uint> shaders, uint binaryFormat, void* binary, int length)
{
fixed (uint* shadersPtr = shaders)
{
Context.glShaderBinary(checked((int)shaders.Length), shadersPtr, binaryFormat, binary, length);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UseProgramStages(uint pipeline, uint stages, GlHandle program)
{
Context.glUseProgramStages(pipeline, stages, program.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ValidateProgramPipeline(uint pipeline)
{
Context.glValidateProgramPipeline(pipeline);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttribL(uint index, double x)
{
Context.glVertexAttribL1d(index, x);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttribL(uint index, double x, double y)
{
Context.glVertexAttribL2d(index, x, y);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttribL(uint index, double x, double y, double z)
{
Context.glVertexAttribL3d(index, x, y, z);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttribL(uint index, double x, double y, double z, double w)
{
Context.glVertexAttribL4d(index, x, y, z, w);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttribLPointer(uint index, int size, uint type, int stride, void* pointer)
{
Context.glVertexAttribLPointer(index, size, type, stride, pointer);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ViewportArrayv(uint first, int count, ReadOnlySpan<float> v)
{
fixed (float* vPtr = v)
{
Context.glViewportArrayv(first, count, vPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ViewportIndexed(uint index, float x, float y, float w, float h)
{
Context.glViewportIndexedf(index, x, y, w, h);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ViewportIndexed(uint index, ReadOnlySpan<float> v)
{
if (v.Length < 4) {
throw new ArgumentException("Span is shorter than the OpenGL length expression '4'.", nameof(v));
}
fixed (float* vPtr = v)
{
Context.glViewportIndexedfv(index, vPtr);
}
}
}
}
@@ -1,93 +0,0 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL on 2026-08-25 09:22:55Z
// Version: 4.2
// </auto-generated>
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using StgSharp.Graphics.OpenGL;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindImageTexture(uint unit, GlHandle texture, int level, byte layered, int layer, uint access, uint format)
{
Context.glBindImageTexture(unit, texture.Value, level, layered, layer, access, format);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawArraysInstancedBaseInstance(uint mode, int first, int count, int instancecount, uint baseinstance)
{
Context.glDrawArraysInstancedBaseInstance(mode, first, count, instancecount, baseinstance);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawElementsInstancedBaseInstance(uint mode, int count, uint type, void* indices, int instancecount, uint baseinstance)
{
Context.glDrawElementsInstancedBaseInstance(mode, count, type, indices, instancecount, baseinstance);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawElementsInstancedBaseVertexBaseInstance(uint mode, int count, uint type, void* indices, int instancecount, int basevertex, uint baseinstance)
{
Context.glDrawElementsInstancedBaseVertexBaseInstance(mode, count, type, indices, instancecount, basevertex, baseinstance);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedbackInstanced(uint mode, uint id, int instancecount)
{
Context.glDrawTransformFeedbackInstanced(mode, id, instancecount);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedbackStreamInstanced(uint mode, uint id, uint stream, int instancecount)
{
Context.glDrawTransformFeedbackStreamInstanced(mode, id, stream, instancecount);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveAtomicCounterBufferiv(GlHandle program, GlHandle bufferIndex, uint pname, Span<int> @params)
{
fixed (int* @paramsPtr = @params)
{
Context.glGetActiveAtomicCounterBufferiv(program.Value, bufferIndex.Value, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetInternalformativ(uint target, uint internalformat, uint pname, Span<int> @params)
{
fixed (int* @paramsPtr = @params)
{
Context.glGetInternalformativ(target, internalformat, pname, checked((int)@params.Length), @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MemoryBarrier(uint barriers)
{
Context.glMemoryBarrier(barriers);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage1D(uint target, int levels, uint internalformat, int width)
{
Context.glTexStorage1D(target, levels, internalformat, width);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage2D(uint target, int levels, uint internalformat, int width, int height)
{
Context.glTexStorage2D(target, levels, internalformat, width, height);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage3D(uint target, int levels, uint internalformat, int width, int height, int depth)
{
Context.glTexStorage3D(target, levels, internalformat, width, height, depth);
}
}
}
@@ -1,379 +0,0 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL on 2026-08-25 09:22:55Z
// Version: 4.3
// </auto-generated>
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using StgSharp.Graphics.OpenGL;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindVertexBuffer(uint bindingindex, GlHandle buffer, nint offset, int stride)
{
Context.glBindVertexBuffer(bindingindex, buffer.Value, offset, stride);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearBufferData(uint target, uint internalformat, uint format, uint type, void* data)
{
Context.glClearBufferData(target, internalformat, format, type, data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearBufferSubData(uint target, uint internalformat, nint offset, nint size, uint format, uint type, void* data)
{
Context.glClearBufferSubData(target, internalformat, offset, size, format, type, data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CopyImageSubData(uint srcName, uint srcTarget, int srcLevel, int srcX, int srcY, int srcZ, uint dstName, uint dstTarget, int dstLevel, int dstX, int dstY, int dstZ, int srcWidth, int srcHeight, int srcDepth)
{
Context.glCopyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DebugMessageCallback(IntPtr callback, void* userParam)
{
Context.glDebugMessageCallback(callback, userParam);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DebugMessageControl(uint source, uint type, uint severity, ReadOnlySpan<uint> ids, byte enabled)
{
fixed (uint* idsPtr = ids)
{
Context.glDebugMessageControl(source, type, severity, checked((int)ids.Length), idsPtr, enabled);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DebugMessageInsert(uint source, uint type, uint id, uint severity, int length, ReadOnlySpan<byte> buf)
{
fixed (byte* bufPtr = buf)
{
Context.glDebugMessageInsert(source, type, id, severity, length, bufPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DispatchCompute(uint num_groups_x, uint num_groups_y, uint num_groups_z)
{
Context.glDispatchCompute(num_groups_x, num_groups_y, num_groups_z);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DispatchComputeIndirect(nint indirect)
{
Context.glDispatchComputeIndirect(indirect);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FramebufferParameter(uint target, uint pname, int param)
{
Context.glFramebufferParameteri(target, pname, param);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetDebugMessageLog(Span<uint> sources, Span<uint> types, Span<uint> ids, Span<uint> severities, Span<int> lengths, Span<byte> messageLog)
{
if (types.Length != sources.Length) {
throw new ArgumentException("Span lengths controlled by count must match.", nameof(types));
}
if (ids.Length != sources.Length) {
throw new ArgumentException("Span lengths controlled by count must match.", nameof(ids));
}
if (severities.Length != sources.Length) {
throw new ArgumentException("Span lengths controlled by count must match.", nameof(severities));
}
if (lengths.Length != sources.Length) {
throw new ArgumentException("Span lengths controlled by count must match.", nameof(lengths));
}
fixed (uint* sourcesPtr = sources)
{
fixed (uint* typesPtr = types)
{
fixed (uint* idsPtr = ids)
{
fixed (uint* severitiesPtr = severities)
{
fixed (int* lengthsPtr = lengths)
{
fixed (byte* messageLogPtr = messageLog)
{
return Context.glGetDebugMessageLog(checked((uint)sources.Length), checked((int)messageLog.Length), sourcesPtr, typesPtr, idsPtr, severitiesPtr, lengthsPtr, messageLogPtr);
}
}
}
}
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetFramebufferParameteriv(uint target, uint pname, Span<int> @params)
{
fixed (int* @paramsPtr = @params)
{
Context.glGetFramebufferParameteriv(target, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetInternalformati64v(uint target, uint internalformat, uint pname, Span<long> @params)
{
fixed (long* @paramsPtr = @params)
{
Context.glGetInternalformati64v(target, internalformat, pname, checked((int)@params.Length), @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetObjectLabel(uint identifier, uint name, out int length, Span<byte> label)
{
length = default;
fixed (int* lengthPtr = &length)
{
fixed (byte* labelPtr = label)
{
Context.glGetObjectLabel(identifier, name, checked((int)label.Length), lengthPtr, labelPtr);
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetObjectPtrLabel(void* ptr, out int length, Span<byte> label)
{
length = default;
fixed (int* lengthPtr = &length)
{
fixed (byte* labelPtr = label)
{
Context.glGetObjectPtrLabel(ptr, checked((int)label.Length), lengthPtr, labelPtr);
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetPointerv(uint pname, void** @params)
{
Context.glGetPointerv(pname, @params);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramInterfaceiv(GlHandle program, uint programInterface, uint pname, Span<int> @params)
{
fixed (int* @paramsPtr = @params)
{
Context.glGetProgramInterfaceiv(program.Value, programInterface, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetProgramResourceIndex(GlHandle program, uint programInterface, ReadOnlySpan<byte> name)
{
fixed (byte* namePtr = name)
{
return Context.glGetProgramResourceIndex(program.Value, programInterface, namePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetProgramResourceLocation(GlHandle program, uint programInterface, ReadOnlySpan<byte> name)
{
fixed (byte* namePtr = name)
{
return Context.glGetProgramResourceLocation(program.Value, programInterface, namePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetProgramResourceLocationIndex(GlHandle program, uint programInterface, ReadOnlySpan<byte> name)
{
fixed (byte* namePtr = name)
{
return Context.glGetProgramResourceLocationIndex(program.Value, programInterface, namePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramResourceName(GlHandle program, uint programInterface, uint index, out int length, Span<byte> name)
{
length = default;
fixed (int* lengthPtr = &length)
{
fixed (byte* namePtr = name)
{
Context.glGetProgramResourceName(program.Value, programInterface, index, checked((int)name.Length), lengthPtr, namePtr);
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramResourceiv(GlHandle program, uint programInterface, uint index, ReadOnlySpan<uint> props, out int length, Span<int> @params)
{
length = default;
fixed (uint* propsPtr = props)
{
fixed (int* lengthPtr = &length)
{
fixed (int* @paramsPtr = @params)
{
Context.glGetProgramResourceiv(program.Value, programInterface, index, checked((int)props.Length), propsPtr, checked((int)@params.Length), lengthPtr, @paramsPtr);
}
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateBufferData(GlHandle buffer)
{
Context.glInvalidateBufferData(buffer.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateBufferSubData(GlHandle buffer, nint offset, nint length)
{
Context.glInvalidateBufferSubData(buffer.Value, offset, length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateFramebuffer(uint target, ReadOnlySpan<uint> attachments)
{
fixed (uint* attachmentsPtr = attachments)
{
Context.glInvalidateFramebuffer(target, checked((int)attachments.Length), attachmentsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateSubFramebuffer(uint target, ReadOnlySpan<uint> attachments, int x, int y, int width, int height)
{
fixed (uint* attachmentsPtr = attachments)
{
Context.glInvalidateSubFramebuffer(target, checked((int)attachments.Length), attachmentsPtr, x, y, width, height);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateTexImage(GlHandle texture, int level)
{
Context.glInvalidateTexImage(texture.Value, level);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateTexSubImage(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth)
{
Context.glInvalidateTexSubImage(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawArraysIndirect(uint mode, void* indirect, int drawcount, int stride)
{
Context.glMultiDrawArraysIndirect(mode, indirect, drawcount, stride);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawElementsIndirect(uint mode, uint type, void* indirect, int drawcount, int stride)
{
Context.glMultiDrawElementsIndirect(mode, type, indirect, drawcount, stride);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ObjectLabel(uint identifier, uint name, int length, ReadOnlySpan<byte> label)
{
fixed (byte* labelPtr = label)
{
Context.glObjectLabel(identifier, name, length, labelPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ObjectPtrLabel(void* ptr, int length, ReadOnlySpan<byte> label)
{
fixed (byte* labelPtr = label)
{
Context.glObjectPtrLabel(ptr, length, labelPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PopDebugGroup()
{
Context.glPopDebugGroup();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PushDebugGroup(uint source, uint id, int length, ReadOnlySpan<byte> message)
{
fixed (byte* messagePtr = message)
{
Context.glPushDebugGroup(source, id, length, messagePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ShaderStorageBlockBinding(GlHandle program, uint storageBlockIndex, uint storageBlockBinding)
{
Context.glShaderStorageBlockBinding(program.Value, storageBlockIndex, storageBlockBinding);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexBufferRange(uint target, uint internalformat, GlHandle buffer, nint offset, nint size)
{
Context.glTexBufferRange(target, internalformat, buffer.Value, offset, size);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage2DMultisample(uint target, int samples, uint internalformat, int width, int height, byte fixedsamplelocations)
{
Context.glTexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage3DMultisample(uint target, int samples, uint internalformat, int width, int height, int depth, byte fixedsamplelocations)
{
Context.glTexStorage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureView(GlHandle texture, uint target, GlHandle origtexture, uint internalformat, uint minlevel, uint numlevels, uint minlayer, uint numlayers)
{
Context.glTextureView(texture.Value, target, origtexture.Value, internalformat, minlevel, numlevels, minlayer, numlayers);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttribBinding(uint attribindex, uint bindingindex)
{
Context.glVertexAttribBinding(attribindex, bindingindex);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttribFormat(uint attribindex, int size, uint type, byte normalized, uint relativeoffset)
{
Context.glVertexAttribFormat(attribindex, size, type, normalized, relativeoffset);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttribIFormat(uint attribindex, int size, uint type, uint relativeoffset)
{
Context.glVertexAttribIFormat(attribindex, size, type, relativeoffset);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttribLFormat(uint attribindex, int size, uint type, uint relativeoffset)
{
Context.glVertexAttribLFormat(attribindex, size, type, relativeoffset);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexBindingDivisor(uint bindingindex, uint divisor)
{
Context.glVertexBindingDivisor(bindingindex, divisor);
}
}
}
@@ -1,111 +0,0 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL on 2026-08-25 09:22:55Z
// Version: 4.4
// </auto-generated>
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using StgSharp.Graphics.OpenGL;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindBuffersBase(uint target, uint first, ReadOnlySpan<uint> buffers)
{
fixed (uint* buffersPtr = buffers)
{
Context.glBindBuffersBase(target, first, checked((int)buffers.Length), buffersPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindBuffersRange(uint target, uint first, ReadOnlySpan<uint> buffers, ReadOnlySpan<nint> offsets, ReadOnlySpan<nint> sizes)
{
if (offsets.Length != buffers.Length) {
throw new ArgumentException("Span lengths controlled by count must match.", nameof(offsets));
}
if (sizes.Length != buffers.Length) {
throw new ArgumentException("Span lengths controlled by count must match.", nameof(sizes));
}
fixed (uint* buffersPtr = buffers)
{
fixed (nint* offsetsPtr = offsets)
{
fixed (nint* sizesPtr = sizes)
{
Context.glBindBuffersRange(target, first, checked((int)buffers.Length), buffersPtr, offsetsPtr, sizesPtr);
}
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindImageTextures(uint first, ReadOnlySpan<uint> textures)
{
fixed (uint* texturesPtr = textures)
{
Context.glBindImageTextures(first, checked((int)textures.Length), texturesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindSamplers(uint first, ReadOnlySpan<uint> samplers)
{
fixed (uint* samplersPtr = samplers)
{
Context.glBindSamplers(first, checked((int)samplers.Length), samplersPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindTextures(uint first, ReadOnlySpan<uint> textures)
{
fixed (uint* texturesPtr = textures)
{
Context.glBindTextures(first, checked((int)textures.Length), texturesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindVertexBuffers(uint first, ReadOnlySpan<uint> buffers, ReadOnlySpan<nint> offsets, ReadOnlySpan<int> strides)
{
if (offsets.Length != buffers.Length) {
throw new ArgumentException("Span lengths controlled by count must match.", nameof(offsets));
}
if (strides.Length != buffers.Length) {
throw new ArgumentException("Span lengths controlled by count must match.", nameof(strides));
}
fixed (uint* buffersPtr = buffers)
{
fixed (nint* offsetsPtr = offsets)
{
fixed (int* stridesPtr = strides)
{
Context.glBindVertexBuffers(first, checked((int)buffers.Length), buffersPtr, offsetsPtr, stridesPtr);
}
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BufferStorage(uint target, nint size, void* data, uint flags)
{
Context.glBufferStorage(target, size, data, flags);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearTexImage(GlHandle texture, int level, uint format, uint type, void* data)
{
Context.glClearTexImage(texture.Value, level, format, type, data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearTexSubImage(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, uint type, void* data)
{
Context.glClearTexSubImage(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data);
}
}
}
@@ -1,822 +0,0 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL on 2026-08-25 09:22:55Z
// Version: 4.5
// </auto-generated>
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using StgSharp.Graphics.OpenGL;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindTextureUnit(uint unit, GlHandle texture)
{
Context.glBindTextureUnit(unit, texture.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlitNamedFramebuffer(GlHandle readFramebuffer, GlHandle drawFramebuffer, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, uint mask, uint filter)
{
Context.glBlitNamedFramebuffer(readFramebuffer.Value, drawFramebuffer.Value, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint CheckNamedFramebufferStatus(GlHandle framebuffer, uint target)
{
return Context.glCheckNamedFramebufferStatus(framebuffer.Value, target);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedBufferData(GlHandle buffer, uint internalformat, uint format, uint type, void* data)
{
Context.glClearNamedBufferData(buffer.Value, internalformat, format, type, data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedBufferSubData(GlHandle buffer, uint internalformat, nint offset, nint size, uint format, uint type, void* data)
{
Context.glClearNamedBufferSubData(buffer.Value, internalformat, offset, size, format, type, data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedFramebuffer(GlHandle framebuffer, uint buffer, int drawbuffer, float depth, int stencil)
{
Context.glClearNamedFramebufferfi(framebuffer.Value, buffer, drawbuffer, depth, stencil);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedFramebuffer(GlHandle framebuffer, uint buffer, int drawbuffer, ReadOnlySpan<float> value)
{
fixed (float* valuePtr = value)
{
Context.glClearNamedFramebufferfv(framebuffer.Value, buffer, drawbuffer, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedFramebuffer(GlHandle framebuffer, uint buffer, int drawbuffer, ReadOnlySpan<int> value)
{
fixed (int* valuePtr = value)
{
Context.glClearNamedFramebufferiv(framebuffer.Value, buffer, drawbuffer, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedFramebuffer(GlHandle framebuffer, uint buffer, int drawbuffer, ReadOnlySpan<uint> value)
{
fixed (uint* valuePtr = value)
{
Context.glClearNamedFramebufferuiv(framebuffer.Value, buffer, drawbuffer, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClipControl(uint origin, uint depth)
{
Context.glClipControl(origin, depth);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CompressedTextureSubImage1D(GlHandle texture, int level, int xoffset, int width, uint format, int imageSize, void* data)
{
Context.glCompressedTextureSubImage1D(texture.Value, level, xoffset, width, format, imageSize, data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CompressedTextureSubImage2D(GlHandle texture, int level, int xoffset, int yoffset, int width, int height, uint format, int imageSize, void* data)
{
Context.glCompressedTextureSubImage2D(texture.Value, level, xoffset, yoffset, width, height, format, imageSize, data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CompressedTextureSubImage3D(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, int imageSize, void* data)
{
Context.glCompressedTextureSubImage3D(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CopyNamedBufferSubData(GlHandle readBuffer, GlHandle writeBuffer, nint readOffset, nint writeOffset, nint size)
{
Context.glCopyNamedBufferSubData(readBuffer.Value, writeBuffer.Value, readOffset, writeOffset, size);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CopyTextureSubImage1D(GlHandle texture, int level, int xoffset, int x, int y, int width)
{
Context.glCopyTextureSubImage1D(texture.Value, level, xoffset, x, y, width);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CopyTextureSubImage2D(GlHandle texture, int level, int xoffset, int yoffset, int x, int y, int width, int height)
{
Context.glCopyTextureSubImage2D(texture.Value, level, xoffset, yoffset, x, y, width, height);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CopyTextureSubImage3D(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height)
{
Context.glCopyTextureSubImage3D(texture.Value, level, xoffset, yoffset, zoffset, x, y, width, height);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateBuffers(Span<uint> buffers)
{
fixed (uint* buffersPtr = buffers)
{
Context.glCreateBuffers(checked((int)buffers.Length), buffersPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateFramebuffers(Span<uint> framebuffers)
{
fixed (uint* framebuffersPtr = framebuffers)
{
Context.glCreateFramebuffers(checked((int)framebuffers.Length), framebuffersPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateProgramPipelines(Span<uint> pipelines)
{
fixed (uint* pipelinesPtr = pipelines)
{
Context.glCreateProgramPipelines(checked((int)pipelines.Length), pipelinesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateQueries(uint target, Span<uint> ids)
{
fixed (uint* idsPtr = ids)
{
Context.glCreateQueries(target, checked((int)ids.Length), idsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateRenderbuffers(Span<uint> renderbuffers)
{
fixed (uint* renderbuffersPtr = renderbuffers)
{
Context.glCreateRenderbuffers(checked((int)renderbuffers.Length), renderbuffersPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateSamplers(Span<uint> samplers)
{
fixed (uint* samplersPtr = samplers)
{
Context.glCreateSamplers(checked((int)samplers.Length), samplersPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateTextures(uint target, Span<uint> textures)
{
fixed (uint* texturesPtr = textures)
{
Context.glCreateTextures(target, checked((int)textures.Length), texturesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateTransformFeedbacks(Span<uint> ids)
{
fixed (uint* idsPtr = ids)
{
Context.glCreateTransformFeedbacks(checked((int)ids.Length), idsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateVertexArrays(Span<uint> arrays)
{
fixed (uint* arraysPtr = arrays)
{
Context.glCreateVertexArrays(checked((int)arrays.Length), arraysPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DisableVertexArrayAttrib(uint vaobj, uint index)
{
Context.glDisableVertexArrayAttrib(vaobj, index);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void EnableVertexArrayAttrib(uint vaobj, uint index)
{
Context.glEnableVertexArrayAttrib(vaobj, index);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FlushMappedNamedBufferRange(GlHandle buffer, nint offset, nint length)
{
Context.glFlushMappedNamedBufferRange(buffer.Value, offset, length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GenerateTextureMipmap(GlHandle texture)
{
Context.glGenerateTextureMipmap(texture.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetCompressedTextureImage(GlHandle texture, int level, int bufSize, void* pixels)
{
Context.glGetCompressedTextureImage(texture.Value, level, bufSize, pixels);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetCompressedTextureSubImage(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int bufSize, void* pixels)
{
Context.glGetCompressedTextureSubImage(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, bufSize, pixels);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetGraphicsResetStatus()
{
return Context.glGetGraphicsResetStatus();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedBufferParameter(GlHandle buffer, uint pname, Span<long> @params)
{
fixed (long* @paramsPtr = @params)
{
Context.glGetNamedBufferParameteri64v(buffer.Value, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedBufferParameter(GlHandle buffer, uint pname, Span<int> @params)
{
fixed (int* @paramsPtr = @params)
{
Context.glGetNamedBufferParameteriv(buffer.Value, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedBufferPointerv(GlHandle buffer, uint pname, void** @params)
{
Context.glGetNamedBufferPointerv(buffer.Value, pname, @params);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedBufferSubData(GlHandle buffer, nint offset, nint size, void* data)
{
Context.glGetNamedBufferSubData(buffer.Value, offset, size, data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedFramebufferAttachmentParameteriv(GlHandle framebuffer, uint attachment, uint pname, Span<int> @params)
{
fixed (int* @paramsPtr = @params)
{
Context.glGetNamedFramebufferAttachmentParameteriv(framebuffer.Value, attachment, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedFramebufferParameteriv(GlHandle framebuffer, uint pname, Span<int> param)
{
fixed (int* paramPtr = param)
{
Context.glGetNamedFramebufferParameteriv(framebuffer.Value, pname, paramPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedRenderbufferParameteriv(GlHandle renderbuffer, uint pname, Span<int> @params)
{
fixed (int* @paramsPtr = @params)
{
Context.glGetNamedRenderbufferParameteriv(renderbuffer.Value, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryBufferObject(uint id, GlHandle buffer, uint pname, nint offset)
{
Context.glGetQueryBufferObjecti64v(id, buffer.Value, pname, offset);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryBufferObjectiv(uint id, GlHandle buffer, uint pname, nint offset)
{
Context.glGetQueryBufferObjectiv(id, buffer.Value, pname, offset);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryBufferObjectui64v(uint id, GlHandle buffer, uint pname, nint offset)
{
Context.glGetQueryBufferObjectui64v(id, buffer.Value, pname, offset);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryBufferObjectuiv(uint id, GlHandle buffer, uint pname, nint offset)
{
Context.glGetQueryBufferObjectuiv(id, buffer.Value, pname, offset);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTextureImage(GlHandle texture, int level, uint format, uint type, int bufSize, void* pixels)
{
Context.glGetTextureImage(texture.Value, level, format, type, bufSize, pixels);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTextureLevelParameter(GlHandle texture, int level, uint pname, Span<float> @params)
{
fixed (float* @paramsPtr = @params)
{
Context.glGetTextureLevelParameterfv(texture.Value, level, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTextureLevelParameter(GlHandle texture, int level, uint pname, Span<int> @params)
{
fixed (int* @paramsPtr = @params)
{
Context.glGetTextureLevelParameteriv(texture.Value, level, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTextureParameterI(GlHandle texture, uint pname, Span<int> @params)
{
fixed (int* @paramsPtr = @params)
{
Context.glGetTextureParameterIiv(texture.Value, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTextureParameterI(GlHandle texture, uint pname, Span<uint> @params)
{
fixed (uint* @paramsPtr = @params)
{
Context.glGetTextureParameterIuiv(texture.Value, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTextureParameter(GlHandle texture, uint pname, Span<float> @params)
{
fixed (float* @paramsPtr = @params)
{
Context.glGetTextureParameterfv(texture.Value, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTextureParameter(GlHandle texture, uint pname, Span<int> @params)
{
fixed (int* @paramsPtr = @params)
{
Context.glGetTextureParameteriv(texture.Value, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTextureSubImage(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, uint type, int bufSize, void* pixels)
{
Context.glGetTextureSubImage(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize, pixels);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTransformFeedbacki64_v(uint xfb, uint pname, uint index, Span<long> param)
{
fixed (long* paramPtr = param)
{
Context.glGetTransformFeedbacki64_v(xfb, pname, index, paramPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTransformFeedbacki_v(uint xfb, uint pname, uint index, Span<int> param)
{
fixed (int* paramPtr = param)
{
Context.glGetTransformFeedbacki_v(xfb, pname, index, paramPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTransformFeedbackiv(uint xfb, uint pname, Span<int> param)
{
fixed (int* paramPtr = param)
{
Context.glGetTransformFeedbackiv(xfb, pname, paramPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetVertexArrayIndexed64iv(uint vaobj, uint index, uint pname, Span<long> param)
{
fixed (long* paramPtr = param)
{
Context.glGetVertexArrayIndexed64iv(vaobj, index, pname, paramPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetVertexArrayIndexediv(uint vaobj, uint index, uint pname, Span<int> param)
{
fixed (int* paramPtr = param)
{
Context.glGetVertexArrayIndexediv(vaobj, index, pname, paramPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetVertexArrayiv(uint vaobj, uint pname, Span<int> param)
{
fixed (int* paramPtr = param)
{
Context.glGetVertexArrayiv(vaobj, pname, paramPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetnCompressedTexImage(uint target, int lod, int bufSize, void* pixels)
{
Context.glGetnCompressedTexImage(target, lod, bufSize, pixels);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetnTexImage(uint target, int level, uint format, uint type, int bufSize, void* pixels)
{
Context.glGetnTexImage(target, level, format, type, bufSize, pixels);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetnUniform(GlHandle program, int location, int bufSize, Span<double> @params)
{
if (@params.Length < checked((int)bufSize / 8)) {
throw new ArgumentException("Span is shorter than the OpenGL length expression 'bufSize / 8'.", nameof(@params));
}
fixed (double* @paramsPtr = @params)
{
Context.glGetnUniformdv(program.Value, location, bufSize, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetnUniform(GlHandle program, int location, int bufSize, Span<float> @params)
{
if (@params.Length < checked((int)bufSize / 4)) {
throw new ArgumentException("Span is shorter than the OpenGL length expression 'bufSize / 4'.", nameof(@params));
}
fixed (float* @paramsPtr = @params)
{
Context.glGetnUniformfv(program.Value, location, bufSize, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetnUniform(GlHandle program, int location, int bufSize, Span<int> @params)
{
if (@params.Length < checked((int)bufSize / 4)) {
throw new ArgumentException("Span is shorter than the OpenGL length expression 'bufSize / 4'.", nameof(@params));
}
fixed (int* @paramsPtr = @params)
{
Context.glGetnUniformiv(program.Value, location, bufSize, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetnUniform(GlHandle program, int location, int bufSize, Span<uint> @params)
{
if (@params.Length < checked((int)bufSize / 4)) {
throw new ArgumentException("Span is shorter than the OpenGL length expression 'bufSize / 4'.", nameof(@params));
}
fixed (uint* @paramsPtr = @params)
{
Context.glGetnUniformuiv(program.Value, location, bufSize, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateNamedFramebufferData(GlHandle framebuffer, ReadOnlySpan<uint> attachments)
{
fixed (uint* attachmentsPtr = attachments)
{
Context.glInvalidateNamedFramebufferData(framebuffer.Value, checked((int)attachments.Length), attachmentsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateNamedFramebufferSubData(GlHandle framebuffer, ReadOnlySpan<uint> attachments, int x, int y, int width, int height)
{
fixed (uint* attachmentsPtr = attachments)
{
Context.glInvalidateNamedFramebufferSubData(framebuffer.Value, checked((int)attachments.Length), attachmentsPtr, x, y, width, height);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void* MapNamedBuffer(GlHandle buffer, uint access)
{
return Context.glMapNamedBuffer(buffer.Value, access);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void* MapNamedBufferRange(GlHandle buffer, nint offset, nint length, uint access)
{
return Context.glMapNamedBufferRange(buffer.Value, offset, length, access);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MemoryBarrierByRegion(uint barriers)
{
Context.glMemoryBarrierByRegion(barriers);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedBufferData(GlHandle buffer, nint size, void* data, uint usage)
{
Context.glNamedBufferData(buffer.Value, size, data, usage);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedBufferStorage(GlHandle buffer, nint size, void* data, uint flags)
{
Context.glNamedBufferStorage(buffer.Value, size, data, flags);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedBufferSubData(GlHandle buffer, nint offset, nint size, void* data)
{
Context.glNamedBufferSubData(buffer.Value, offset, size, data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFramebufferDrawBuffer(GlHandle framebuffer, uint buf)
{
Context.glNamedFramebufferDrawBuffer(framebuffer.Value, buf);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFramebufferDrawBuffers(GlHandle framebuffer, ReadOnlySpan<uint> bufs)
{
fixed (uint* bufsPtr = bufs)
{
Context.glNamedFramebufferDrawBuffers(framebuffer.Value, checked((int)bufs.Length), bufsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFramebufferParameter(GlHandle framebuffer, uint pname, int param)
{
Context.glNamedFramebufferParameteri(framebuffer.Value, pname, param);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFramebufferReadBuffer(GlHandle framebuffer, uint src)
{
Context.glNamedFramebufferReadBuffer(framebuffer.Value, src);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFramebufferRenderbuffer(GlHandle framebuffer, uint attachment, uint renderbuffertarget, GlHandle renderbuffer)
{
Context.glNamedFramebufferRenderbuffer(framebuffer.Value, attachment, renderbuffertarget, renderbuffer.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFramebufferTexture(GlHandle framebuffer, uint attachment, GlHandle texture, int level)
{
Context.glNamedFramebufferTexture(framebuffer.Value, attachment, texture.Value, level);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFramebufferTextureLayer(GlHandle framebuffer, uint attachment, GlHandle texture, int level, int layer)
{
Context.glNamedFramebufferTextureLayer(framebuffer.Value, attachment, texture.Value, level, layer);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedRenderbufferStorage(GlHandle renderbuffer, uint internalformat, int width, int height)
{
Context.glNamedRenderbufferStorage(renderbuffer.Value, internalformat, width, height);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedRenderbufferStorageMultisample(GlHandle renderbuffer, int samples, uint internalformat, int width, int height)
{
Context.glNamedRenderbufferStorageMultisample(renderbuffer.Value, samples, internalformat, width, height);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReadnPixels(int x, int y, int width, int height, uint format, uint type, int bufSize, void* data)
{
Context.glReadnPixels(x, y, width, height, format, type, bufSize, data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureBarrier()
{
Context.glTextureBarrier();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureBuffer(GlHandle texture, uint internalformat, GlHandle buffer)
{
Context.glTextureBuffer(texture.Value, internalformat, buffer.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureBufferRange(GlHandle texture, uint internalformat, GlHandle buffer, nint offset, nint size)
{
Context.glTextureBufferRange(texture.Value, internalformat, buffer.Value, offset, size);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureParameterI(GlHandle texture, uint pname, ReadOnlySpan<int> @params)
{
fixed (int* @paramsPtr = @params)
{
Context.glTextureParameterIiv(texture.Value, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureParameterI(GlHandle texture, uint pname, ReadOnlySpan<uint> @params)
{
fixed (uint* @paramsPtr = @params)
{
Context.glTextureParameterIuiv(texture.Value, pname, @paramsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureParameter(GlHandle texture, uint pname, float param)
{
Context.glTextureParameterf(texture.Value, pname, param);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureParameter(GlHandle texture, uint pname, ReadOnlySpan<float> param)
{
fixed (float* paramPtr = param)
{
Context.glTextureParameterfv(texture.Value, pname, paramPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureParameter(GlHandle texture, uint pname, int param)
{
Context.glTextureParameteri(texture.Value, pname, param);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureParameter(GlHandle texture, uint pname, ReadOnlySpan<int> param)
{
fixed (int* paramPtr = param)
{
Context.glTextureParameteriv(texture.Value, pname, paramPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage1D(GlHandle texture, int levels, uint internalformat, int width)
{
Context.glTextureStorage1D(texture.Value, levels, internalformat, width);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage2D(GlHandle texture, int levels, uint internalformat, int width, int height)
{
Context.glTextureStorage2D(texture.Value, levels, internalformat, width, height);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage2DMultisample(GlHandle texture, int samples, uint internalformat, int width, int height, byte fixedsamplelocations)
{
Context.glTextureStorage2DMultisample(texture.Value, samples, internalformat, width, height, fixedsamplelocations);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage3D(GlHandle texture, int levels, uint internalformat, int width, int height, int depth)
{
Context.glTextureStorage3D(texture.Value, levels, internalformat, width, height, depth);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage3DMultisample(GlHandle texture, int samples, uint internalformat, int width, int height, int depth, byte fixedsamplelocations)
{
Context.glTextureStorage3DMultisample(texture.Value, samples, internalformat, width, height, depth, fixedsamplelocations);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureSubImage1D(GlHandle texture, int level, int xoffset, int width, uint format, uint type, void* pixels)
{
Context.glTextureSubImage1D(texture.Value, level, xoffset, width, format, type, pixels);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureSubImage2D(GlHandle texture, int level, int xoffset, int yoffset, int width, int height, uint format, uint type, void* pixels)
{
Context.glTextureSubImage2D(texture.Value, level, xoffset, yoffset, width, height, format, type, pixels);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureSubImage3D(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, uint type, void* pixels)
{
Context.glTextureSubImage3D(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TransformFeedbackBufferBase(uint xfb, uint index, GlHandle buffer)
{
Context.glTransformFeedbackBufferBase(xfb, index, buffer.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TransformFeedbackBufferRange(uint xfb, uint index, GlHandle buffer, nint offset, nint size)
{
Context.glTransformFeedbackBufferRange(xfb, index, buffer.Value, offset, size);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public byte UnmapNamedBuffer(GlHandle buffer)
{
return Context.glUnmapNamedBuffer(buffer.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayAttribBinding(uint vaobj, uint attribindex, uint bindingindex)
{
Context.glVertexArrayAttribBinding(vaobj, attribindex, bindingindex);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayAttribFormat(uint vaobj, uint attribindex, int size, uint type, byte normalized, uint relativeoffset)
{
Context.glVertexArrayAttribFormat(vaobj, attribindex, size, type, normalized, relativeoffset);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayAttribIFormat(uint vaobj, uint attribindex, int size, uint type, uint relativeoffset)
{
Context.glVertexArrayAttribIFormat(vaobj, attribindex, size, type, relativeoffset);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayAttribLFormat(uint vaobj, uint attribindex, int size, uint type, uint relativeoffset)
{
Context.glVertexArrayAttribLFormat(vaobj, attribindex, size, type, relativeoffset);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayBindingDivisor(uint vaobj, uint bindingindex, uint divisor)
{
Context.glVertexArrayBindingDivisor(vaobj, bindingindex, divisor);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayElementBuffer(uint vaobj, GlHandle buffer)
{
Context.glVertexArrayElementBuffer(vaobj, buffer.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayVertexBuffer(uint vaobj, uint bindingindex, GlHandle buffer, nint offset, int stride)
{
Context.glVertexArrayVertexBuffer(vaobj, bindingindex, buffer.Value, offset, stride);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayVertexBuffers(uint vaobj, uint first, ReadOnlySpan<uint> buffers, ReadOnlySpan<nint> offsets, ReadOnlySpan<int> strides)
{
if (offsets.Length != buffers.Length) {
throw new ArgumentException("Span lengths controlled by count must match.", nameof(offsets));
}
if (strides.Length != buffers.Length) {
throw new ArgumentException("Span lengths controlled by count must match.", nameof(strides));
}
fixed (uint* buffersPtr = buffers)
{
fixed (nint* offsetsPtr = offsets)
{
fixed (int* stridesPtr = strides)
{
Context.glVertexArrayVertexBuffers(vaobj, first, checked((int)buffers.Length), buffersPtr, offsetsPtr, stridesPtr);
}
}
}
}
}
}
@@ -1,51 +0,0 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL on 2026-08-25 09:22:55Z
// Version: 4.6
// </auto-generated>
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using StgSharp.Graphics.OpenGL;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawArraysIndirectCount(uint mode, void* indirect, nint drawcount, int maxdrawcount, int stride)
{
Context.glMultiDrawArraysIndirectCount(mode, indirect, drawcount, maxdrawcount, stride);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawElementsIndirectCount(uint mode, uint type, void* indirect, nint drawcount, int maxdrawcount, int stride)
{
Context.glMultiDrawElementsIndirectCount(mode, type, indirect, drawcount, maxdrawcount, stride);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PolygonOffsetClamp(float factor, float units, float clamp)
{
Context.glPolygonOffsetClamp(factor, units, clamp);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SpecializeShader(GlHandle shader, ReadOnlySpan<byte> pEntryPoint, ReadOnlySpan<uint> pConstantIndex, ReadOnlySpan<uint> pConstantValue)
{
if (pConstantValue.Length != pConstantIndex.Length) {
throw new ArgumentException("Span lengths controlled by numSpecializationConstants must match.", nameof(pConstantValue));
}
fixed (byte* pEntryPointPtr = pEntryPoint)
{
fixed (uint* pConstantIndexPtr = pConstantIndex)
{
fixed (uint* pConstantValuePtr = pConstantValue)
{
Context.glSpecializeShader(shader.Value, pEntryPointPtr, checked((uint)pConstantIndex.Length), pConstantIndexPtr, pConstantValuePtr);
}
}
}
}
}
}
@@ -1,261 +0,0 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL on 2026-08-25 09:22:55Z
// Uniform overloads introduced in OpenGL 3.3
// </auto-generated>
using System;
using System.Runtime.CompilerServices;
using StgSharp.Mathematics.Graphics;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<float> uniform, float v0)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform1f(uniform.id.SignedValue, v0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<float> uniform, ReadOnlySpan<float> values)
{
ArgumentNullException.ThrowIfNull(uniform);
fixed (float* valuesPtr = values) {
Context.glUniform1fv(uniform.id.SignedValue, values.Length, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<int> uniform, int v0)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform1i(uniform.id.SignedValue, v0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<int> uniform, ReadOnlySpan<int> values)
{
ArgumentNullException.ThrowIfNull(uniform);
fixed (int* valuesPtr = values) {
Context.glUniform1iv(uniform.id.SignedValue, values.Length, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<uint> uniform, uint v0)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform1ui(uniform.id.SignedValue, v0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<uint> uniform, ReadOnlySpan<uint> values)
{
ArgumentNullException.ThrowIfNull(uniform);
fixed (uint* valuesPtr = values) {
Context.glUniform1uiv(uniform.id.SignedValue, values.Length, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<float, float> uniform, float v0, float v1)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform2f(uniform.id.SignedValue, v0, v1);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<float, float> uniform, ReadOnlySpan<float> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 2) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 2.", nameof(values));
}
fixed (float* valuesPtr = values) {
Context.glUniform2fv(uniform.id.SignedValue, values.Length / 2, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<int, int> uniform, int v0, int v1)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform2i(uniform.id.SignedValue, v0, v1);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<int, int> uniform, ReadOnlySpan<int> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 2) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 2.", nameof(values));
}
fixed (int* valuesPtr = values) {
Context.glUniform2iv(uniform.id.SignedValue, values.Length / 2, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<uint, uint> uniform, uint v0, uint v1)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform2ui(uniform.id.SignedValue, v0, v1);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<uint, uint> uniform, ReadOnlySpan<uint> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 2) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 2.", nameof(values));
}
fixed (uint* valuesPtr = values) {
Context.glUniform2uiv(uniform.id.SignedValue, values.Length / 2, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<float, float, float> uniform, float v0, float v1, float v2)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform3f(uniform.id.SignedValue, v0, v1, v2);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<float, float, float> uniform, ReadOnlySpan<float> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 3) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 3.", nameof(values));
}
fixed (float* valuesPtr = values) {
Context.glUniform3fv(uniform.id.SignedValue, values.Length / 3, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<int, int, int> uniform, int v0, int v1, int v2)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform3i(uniform.id.SignedValue, v0, v1, v2);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<int, int, int> uniform, ReadOnlySpan<int> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 3) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 3.", nameof(values));
}
fixed (int* valuesPtr = values) {
Context.glUniform3iv(uniform.id.SignedValue, values.Length / 3, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<uint, uint, uint> uniform, uint v0, uint v1, uint v2)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform3ui(uniform.id.SignedValue, v0, v1, v2);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<uint, uint, uint> uniform, ReadOnlySpan<uint> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 3) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 3.", nameof(values));
}
fixed (uint* valuesPtr = values) {
Context.glUniform3uiv(uniform.id.SignedValue, values.Length / 3, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<float, float, float, float> uniform, float v0, float v1, float v2, float v3)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform4f(uniform.id.SignedValue, v0, v1, v2, v3);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<float, float, float, float> uniform, ReadOnlySpan<float> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 4) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 4.", nameof(values));
}
fixed (float* valuesPtr = values) {
Context.glUniform4fv(uniform.id.SignedValue, values.Length / 4, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<int, int, int, int> uniform, int v0, int v1, int v2, int v3)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform4i(uniform.id.SignedValue, v0, v1, v2, v3);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<int, int, int, int> uniform, ReadOnlySpan<int> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 4) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 4.", nameof(values));
}
fixed (int* valuesPtr = values) {
Context.glUniform4iv(uniform.id.SignedValue, values.Length / 4, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<uint, uint, uint, uint> uniform, uint v0, uint v1, uint v2, uint v3)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform4ui(uniform.id.SignedValue, v0, v1, v2, v3);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<uint, uint, uint, uint> uniform, ReadOnlySpan<uint> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 4) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 4.", nameof(values));
}
fixed (uint* valuesPtr = values) {
Context.glUniform4uiv(uniform.id.SignedValue, values.Length / 4, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<Vec2> uniform, Vec2 value)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform2fv(uniform.id.SignedValue, 1, (float*)&value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<Vec3> uniform, Vec3 value)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform3fv(uniform.id.SignedValue, 1, (float*)&value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<Vec4> uniform, Vec4 value)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform4fv(uniform.id.SignedValue, 1, (float*)&value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<GraphicsMatrix> uniform, GraphicsMatrix value, bool transpose = false)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniformMatrix4fv(uniform.id.SignedValue, 1, transpose ? (byte)1 : (byte)0, (float*)&value);
}
}
}
@@ -1,87 +0,0 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL on 2026-08-25 09:22:55Z
// Uniform overloads introduced in OpenGL 4.0
// </auto-generated>
using System;
using System.Runtime.CompilerServices;
using StgSharp.Mathematics.Graphics;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<double> uniform, double v0)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform1d(uniform.id.SignedValue, v0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<double> uniform, ReadOnlySpan<double> values)
{
ArgumentNullException.ThrowIfNull(uniform);
fixed (double* valuesPtr = values) {
Context.glUniform1dv(uniform.id.SignedValue, values.Length, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<double, double> uniform, double v0, double v1)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform2d(uniform.id.SignedValue, v0, v1);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<double, double> uniform, ReadOnlySpan<double> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 2) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 2.", nameof(values));
}
fixed (double* valuesPtr = values) {
Context.glUniform2dv(uniform.id.SignedValue, values.Length / 2, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<double, double, double> uniform, double v0, double v1, double v2)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform3d(uniform.id.SignedValue, v0, v1, v2);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<double, double, double> uniform, ReadOnlySpan<double> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 3) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 3.", nameof(values));
}
fixed (double* valuesPtr = values) {
Context.glUniform3dv(uniform.id.SignedValue, values.Length / 3, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<double, double, double, double> uniform, double v0, double v1, double v2, double v3)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glUniform4d(uniform.id.SignedValue, v0, v1, v2, v3);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(Uniform<double, double, double, double> uniform, ReadOnlySpan<double> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 4) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 4.", nameof(values));
}
fixed (double* valuesPtr = values) {
Context.glUniform4dv(uniform.id.SignedValue, values.Length / 4, valuesPtr);
}
}
}
}
@@ -1,334 +0,0 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL on 2026-08-25 09:22:55Z
// Uniform overloads introduced in OpenGL 4.1
// </auto-generated>
using System;
using System.Runtime.CompilerServices;
using StgSharp.Mathematics.Graphics;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<double> uniform, double v0)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform1d(program.Value, uniform.id.SignedValue, v0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<double> uniform, ReadOnlySpan<double> values)
{
ArgumentNullException.ThrowIfNull(uniform);
fixed (double* valuesPtr = values) {
Context.glProgramUniform1dv(program.Value, uniform.id.SignedValue, values.Length, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<float> uniform, float v0)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform1f(program.Value, uniform.id.SignedValue, v0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<float> uniform, ReadOnlySpan<float> values)
{
ArgumentNullException.ThrowIfNull(uniform);
fixed (float* valuesPtr = values) {
Context.glProgramUniform1fv(program.Value, uniform.id.SignedValue, values.Length, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<int> uniform, int v0)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform1i(program.Value, uniform.id.SignedValue, v0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<int> uniform, ReadOnlySpan<int> values)
{
ArgumentNullException.ThrowIfNull(uniform);
fixed (int* valuesPtr = values) {
Context.glProgramUniform1iv(program.Value, uniform.id.SignedValue, values.Length, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<uint> uniform, uint v0)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform1ui(program.Value, uniform.id.SignedValue, v0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<uint> uniform, ReadOnlySpan<uint> values)
{
ArgumentNullException.ThrowIfNull(uniform);
fixed (uint* valuesPtr = values) {
Context.glProgramUniform1uiv(program.Value, uniform.id.SignedValue, values.Length, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<double, double> uniform, double v0, double v1)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform2d(program.Value, uniform.id.SignedValue, v0, v1);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<double, double> uniform, ReadOnlySpan<double> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 2) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 2.", nameof(values));
}
fixed (double* valuesPtr = values) {
Context.glProgramUniform2dv(program.Value, uniform.id.SignedValue, values.Length / 2, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<float, float> uniform, float v0, float v1)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform2f(program.Value, uniform.id.SignedValue, v0, v1);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<float, float> uniform, ReadOnlySpan<float> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 2) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 2.", nameof(values));
}
fixed (float* valuesPtr = values) {
Context.glProgramUniform2fv(program.Value, uniform.id.SignedValue, values.Length / 2, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<int, int> uniform, int v0, int v1)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform2i(program.Value, uniform.id.SignedValue, v0, v1);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<int, int> uniform, ReadOnlySpan<int> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 2) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 2.", nameof(values));
}
fixed (int* valuesPtr = values) {
Context.glProgramUniform2iv(program.Value, uniform.id.SignedValue, values.Length / 2, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<uint, uint> uniform, uint v0, uint v1)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform2ui(program.Value, uniform.id.SignedValue, v0, v1);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<uint, uint> uniform, ReadOnlySpan<uint> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 2) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 2.", nameof(values));
}
fixed (uint* valuesPtr = values) {
Context.glProgramUniform2uiv(program.Value, uniform.id.SignedValue, values.Length / 2, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<double, double, double> uniform, double v0, double v1, double v2)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform3d(program.Value, uniform.id.SignedValue, v0, v1, v2);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<double, double, double> uniform, ReadOnlySpan<double> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 3) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 3.", nameof(values));
}
fixed (double* valuesPtr = values) {
Context.glProgramUniform3dv(program.Value, uniform.id.SignedValue, values.Length / 3, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<float, float, float> uniform, float v0, float v1, float v2)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform3f(program.Value, uniform.id.SignedValue, v0, v1, v2);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<float, float, float> uniform, ReadOnlySpan<float> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 3) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 3.", nameof(values));
}
fixed (float* valuesPtr = values) {
Context.glProgramUniform3fv(program.Value, uniform.id.SignedValue, values.Length / 3, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<int, int, int> uniform, int v0, int v1, int v2)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform3i(program.Value, uniform.id.SignedValue, v0, v1, v2);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<int, int, int> uniform, ReadOnlySpan<int> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 3) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 3.", nameof(values));
}
fixed (int* valuesPtr = values) {
Context.glProgramUniform3iv(program.Value, uniform.id.SignedValue, values.Length / 3, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<uint, uint, uint> uniform, uint v0, uint v1, uint v2)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform3ui(program.Value, uniform.id.SignedValue, v0, v1, v2);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<uint, uint, uint> uniform, ReadOnlySpan<uint> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 3) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 3.", nameof(values));
}
fixed (uint* valuesPtr = values) {
Context.glProgramUniform3uiv(program.Value, uniform.id.SignedValue, values.Length / 3, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<double, double, double, double> uniform, double v0, double v1, double v2, double v3)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform4d(program.Value, uniform.id.SignedValue, v0, v1, v2, v3);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<double, double, double, double> uniform, ReadOnlySpan<double> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 4) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 4.", nameof(values));
}
fixed (double* valuesPtr = values) {
Context.glProgramUniform4dv(program.Value, uniform.id.SignedValue, values.Length / 4, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<float, float, float, float> uniform, float v0, float v1, float v2, float v3)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform4f(program.Value, uniform.id.SignedValue, v0, v1, v2, v3);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<float, float, float, float> uniform, ReadOnlySpan<float> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 4) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 4.", nameof(values));
}
fixed (float* valuesPtr = values) {
Context.glProgramUniform4fv(program.Value, uniform.id.SignedValue, values.Length / 4, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<int, int, int, int> uniform, int v0, int v1, int v2, int v3)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform4i(program.Value, uniform.id.SignedValue, v0, v1, v2, v3);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<int, int, int, int> uniform, ReadOnlySpan<int> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 4) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 4.", nameof(values));
}
fixed (int* valuesPtr = values) {
Context.glProgramUniform4iv(program.Value, uniform.id.SignedValue, values.Length / 4, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<uint, uint, uint, uint> uniform, uint v0, uint v1, uint v2, uint v3)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform4ui(program.Value, uniform.id.SignedValue, v0, v1, v2, v3);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<uint, uint, uint, uint> uniform, ReadOnlySpan<uint> values)
{
ArgumentNullException.ThrowIfNull(uniform);
if ((values.Length % 4) != 0) {
throw new ArgumentException("Uniform data length must be divisible by 4.", nameof(values));
}
fixed (uint* valuesPtr = values) {
Context.glProgramUniform4uiv(program.Value, uniform.id.SignedValue, values.Length / 4, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<Vec2> uniform, Vec2 value)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform2fv(program.Value, uniform.id.SignedValue, 1, (float*)&value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<Vec3> uniform, Vec3 value)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform3fv(program.Value, uniform.id.SignedValue, 1, (float*)&value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<Vec4> uniform, Vec4 value)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniform4fv(program.Value, uniform.id.SignedValue, 1, (float*)&value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(GlHandle program, Uniform<GraphicsMatrix> uniform, GraphicsMatrix value, bool transpose = false)
{
ArgumentNullException.ThrowIfNull(uniform);
Context.glProgramUniformMatrix4fv(program.Value, uniform.id.SignedValue, 1, transpose ? (byte)1 : (byte)0, (float*)&value);
}
}
}
@@ -0,0 +1,215 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 3.3 core-profile forwarding methods.
// </auto-generated>
using StgSharp.Mathematics.Graphics;
using System;
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
/// <summary>Forwards to the native C API <c>void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBindFragDataLocationIndexed" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindFragmentDataLocationIndexed(GlHandle program, uint colorNumber, uint index, byte* name)
{
__context->glBindFragDataLocationIndexed(program.Value, colorNumber, index, name);
}
/// <summary>Forwards to the native C API <c>GLint glGetFragDataIndex(GLuint program, const GLchar *name);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetFragDataIndex" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetFragmentDataIndex(GlHandle program, byte* name)
{
return __context->glGetFragDataIndex(program.Value, name);
}
/// <summary>Forwards to the native C API <c>void glGenSamplers(GLsizei count, GLuint *samplers);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGenSamplers" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GenSamplers(Span<GlHandle> samplers)
{
fixed (GlHandle* __samplers = samplers)
{
__context->glGenSamplers(samplers.Length, (uint*)__samplers);
}
}
/// <summary>Forwards to the native C API <c>void glDeleteSamplers(GLsizei count, const GLuint *samplers);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDeleteSamplers" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DeleteSamplers(ReadOnlySpan<GlHandle> samplers)
{
fixed (GlHandle* __samplers = samplers)
{
__context->glDeleteSamplers(samplers.Length, (uint*)__samplers);
}
}
/// <summary>Forwards to the native C API <c>GLboolean glIsSampler(GLuint sampler);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glIsSampler" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public byte IsSampler(GlHandle sampler)
{
return __context->glIsSampler(sampler.Value);
}
/// <summary>Forwards to the native C API <c>void glBindSampler(GLuint unit, GLuint sampler);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBindSampler" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindSampler(uint unit, GlHandle sampler)
{
__context->glBindSampler(unit, sampler.Value);
}
/// <summary>Forwards to the native C API <c>void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glSamplerParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SamplerParameter(GlHandle sampler, uint pname, int param)
{
__context->glSamplerParameteri(sampler.Value, pname, param);
}
/// <summary>Forwards to the native C API <c>void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glSamplerParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SamplerParameter(GlHandle sampler, uint pname, int* param)
{
__context->glSamplerParameteriv(sampler.Value, pname, param);
}
/// <summary>Forwards to the native C API <c>void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glSamplerParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SamplerParameter(GlHandle sampler, uint pname, float param)
{
__context->glSamplerParameterf(sampler.Value, pname, param);
}
/// <summary>Forwards to the native C API <c>void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glSamplerParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SamplerParameter(GlHandle sampler, uint pname, float* param)
{
__context->glSamplerParameterfv(sampler.Value, pname, param);
}
/// <summary>Forwards to the native C API <c>void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glSamplerParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SamplerParameterInteger(GlHandle sampler, uint pname, int* param)
{
__context->glSamplerParameterIiv(sampler.Value, pname, param);
}
/// <summary>Forwards to the native C API <c>void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glSamplerParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SamplerParameterInteger(GlHandle sampler, uint pname, uint* param)
{
__context->glSamplerParameterIuiv(sampler.Value, pname, param);
}
/// <summary>Forwards to the native C API <c>void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetSamplerParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetSamplerParameter(GlHandle sampler, uint pname, int* @params)
{
__context->glGetSamplerParameteriv(sampler.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetSamplerParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetSamplerParameterInteger(GlHandle sampler, uint pname, int* @params)
{
__context->glGetSamplerParameterIiv(sampler.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetSamplerParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetSamplerParameter(GlHandle sampler, uint pname, float* @params)
{
__context->glGetSamplerParameterfv(sampler.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetSamplerParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetSamplerParameterInteger(GlHandle sampler, uint pname, uint* @params)
{
__context->glGetSamplerParameterIuiv(sampler.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glQueryCounter(GLuint id, GLenum target);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glQueryCounter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void QueryCounter(GlHandle id, uint target)
{
__context->glQueryCounter(id.Value, target);
}
/// <summary>Forwards to the native C API <c>void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetQueryObject" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryObject(GlHandle id, uint pname, long* @params)
{
__context->glGetQueryObjecti64v(id.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetQueryObject" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryObject(GlHandle id, uint pname, ulong* @params)
{
__context->glGetQueryObjectui64v(id.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glVertexAttribDivisor(GLuint index, GLuint divisor);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttribDivisor" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeDivisor(uint index, uint divisor)
{
__context->glVertexAttribDivisor(index, divisor);
}
/// <summary>Forwards to the native C API <c>void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttrib" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributePacked1(uint index, uint type, byte normalized, uint value)
{
__context->glVertexAttribP1ui(index, type, normalized, value);
}
/// <summary>Forwards to the native C API <c>void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttrib" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributePacked2(uint index, uint type, byte normalized, uint value)
{
__context->glVertexAttribP2ui(index, type, normalized, value);
}
/// <summary>Forwards to the native C API <c>void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttrib" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributePacked3(uint index, uint type, byte normalized, uint value)
{
__context->glVertexAttribP3ui(index, type, normalized, value);
}
/// <summary>Forwards to the native C API <c>void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttrib" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributePacked4(uint index, uint type, byte normalized, uint value)
{
__context->glVertexAttribP4ui(index, type, normalized, value);
}
}
}
@@ -0,0 +1,333 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 4.0 core-profile forwarding methods.
// </auto-generated>
using StgSharp.Mathematics.Graphics;
using System;
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
/// <summary>Forwards to the native C API <c>void glMinSampleShading(GLfloat value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glMinSampleShading" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MinSampleShading(float value)
{
__context->glMinSampleShading(value);
}
/// <summary>Forwards to the native C API <c>void glBlendEquationi(GLuint buf, GLenum mode);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBlendEquationi" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendEquationi(uint buf, uint mode)
{
__context->glBlendEquationi(buf, mode);
}
/// <summary>Forwards to the native C API <c>void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBlendEquationSeparatei" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendEquationSeparatei(uint buf, uint modeRGB, uint modeAlpha)
{
__context->glBlendEquationSeparatei(buf, modeRGB, modeAlpha);
}
/// <summary>Forwards to the native C API <c>void glBlendFunci(GLuint buf, GLenum src, GLenum dst);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBlendFunci" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendFunci(uint buf, uint src, uint dst)
{
__context->glBlendFunci(buf, src, dst);
}
/// <summary>Forwards to the native C API <c>void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBlendFuncSeparatei" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendFuncSeparatei(uint buf, uint srcRGB, uint dstRGB, uint srcAlpha, uint dstAlpha)
{
__context->glBlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
}
/// <summary>Forwards to the native C API <c>void glDrawArraysIndirect(GLenum mode, const void *indirect);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDrawArraysIndirect" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawArraysIndirect(uint mode, void* indirect)
{
__context->glDrawArraysIndirect(mode, indirect);
}
/// <summary>Forwards to the native C API <c>void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDrawElementsIndirect" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawElementsIndirect(uint mode, uint type, void* indirect)
{
__context->glDrawElementsIndirect(mode, type, indirect);
}
/// <summary>Forwards to the native C API <c>void glUniform1d(GLint location, GLdouble x);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform(int location, double x)
{
__context->glUniform1d(location, x);
}
/// <summary>Forwards to the native C API <c>void glUniform2d(GLint location, GLdouble x, GLdouble y);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform(int location, double x, double y)
{
__context->glUniform2d(location, x, y);
}
/// <summary>Forwards to the native C API <c>void glUniform2d(GLint location, GLdouble x, GLdouble y);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform(int location, Vec2<double> value)
{
__context->glUniform2d(location, value.X, value.Y);
}
/// <summary>Forwards to the native C API <c>void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform(int location, double x, double y, double z)
{
__context->glUniform3d(location, x, y, z);
}
/// <summary>Forwards to the native C API <c>void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform(int location, Vec3<double> value)
{
__context->glUniform3d(location, value.X, value.Y, value.Z);
}
/// <summary>Forwards to the native C API <c>void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform(int location, double x, double y, double z, double w)
{
__context->glUniform4d(location, x, y, z, w);
}
/// <summary>Forwards to the native C API <c>void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform(int location, Vec4<double> value)
{
__context->glUniform4d(location, value.X, value.Y, value.Z, value.W);
}
/// <summary>Forwards to the native C API <c>void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform(int location, ReadOnlySpan<double> values)
{
fixed (double* __value = values)
{
__context->glUniform1dv(location, values.Length, __value);
}
}
/// <summary>Forwards to the native C API <c>void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform(int location, ReadOnlySpan<Vec4<double>> values)
{
fixed (Vec4<double>* __vector = values)
{
__context->glUniform4dv(location, values.Length, (double*)__vector);
}
}
/// <summary>Forwards to the native C API <c>void glGetUniformdv(GLuint program, GLint location, GLdouble *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetUniform(GlHandle program, int location, double* @params)
{
__context->glGetUniformdv(program.Value, location, @params);
}
/// <summary>Forwards to the native C API <c>GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetSubroutineUniformLocation" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetSubroutineUniformLocation(GlHandle program, uint shadertype, byte* name)
{
return __context->glGetSubroutineUniformLocation(program.Value, shadertype, name);
}
/// <summary>Forwards to the native C API <c>GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetSubroutineIndex" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetSubroutineIndex(GlHandle program, uint shadertype, byte* name)
{
return __context->glGetSubroutineIndex(program.Value, shadertype, name);
}
/// <summary>Forwards to the native C API <c>void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetActiveSubroutineUniformiv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveSubroutineUniformiv(GlHandle program, uint shadertype, uint index, uint pname, int* values)
{
__context->glGetActiveSubroutineUniformiv(program.Value, shadertype, index, pname, values);
}
/// <summary>Forwards to the native C API <c>void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetActiveSubroutineUniformName" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveSubroutineUniformName(GlHandle program, uint shadertype, uint index, int bufSize, int* length, byte* name)
{
__context->glGetActiveSubroutineUniformName(program.Value, shadertype, index, bufSize, length, name);
}
/// <summary>Forwards to the native C API <c>void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetActiveSubroutineName" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveSubroutineName(GlHandle program, uint shadertype, uint index, int bufSize, int* length, byte* name)
{
__context->glGetActiveSubroutineName(program.Value, shadertype, index, bufSize, length, name);
}
/// <summary>Forwards to the native C API <c>void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glUniformSubroutinesuiv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UniformSubroutinesuiv(uint shadertype, int count, uint* indices)
{
__context->glUniformSubroutinesuiv(shadertype, count, indices);
}
/// <summary>Forwards to the native C API <c>void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetUniformSubroutineuiv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetUniformSubroutineuiv(uint shadertype, int location, uint* @params)
{
__context->glGetUniformSubroutineuiv(shadertype, location, @params);
}
/// <summary>Forwards to the native C API <c>void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetProgramStageiv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramStageiv(GlHandle program, uint shadertype, uint pname, int* values)
{
__context->glGetProgramStageiv(program.Value, shadertype, pname, values);
}
/// <summary>Forwards to the native C API <c>void glPatchParameteri(GLenum pname, GLint value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glPatchParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PatchParameter(uint pname, int value)
{
__context->glPatchParameteri(pname, value);
}
/// <summary>Forwards to the native C API <c>void glPatchParameterfv(GLenum pname, const GLfloat *values);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glPatchParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PatchParameter(uint pname, float* values)
{
__context->glPatchParameterfv(pname, values);
}
/// <summary>Forwards to the native C API <c>void glBindTransformFeedback(GLenum target, GLuint id);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBindTransformFeedback" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindTransformFeedback(uint target, GlHandle id)
{
__context->glBindTransformFeedback(target, id.Value);
}
/// <summary>Forwards to the native C API <c>void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDeleteTransformFeedbacks" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DeleteTransformFeedbacks(ReadOnlySpan<GlHandle> ids)
{
fixed (GlHandle* __ids = ids)
{
__context->glDeleteTransformFeedbacks(ids.Length, (uint*)__ids);
}
}
/// <summary>Forwards to the native C API <c>void glGenTransformFeedbacks(GLsizei n, GLuint *ids);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGenTransformFeedbacks" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GenTransformFeedbacks(Span<GlHandle> ids)
{
fixed (GlHandle* __ids = ids)
{
__context->glGenTransformFeedbacks(ids.Length, (uint*)__ids);
}
}
/// <summary>Forwards to the native C API <c>GLboolean glIsTransformFeedback(GLuint id);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glIsTransformFeedback" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public byte IsTransformFeedback(GlHandle id)
{
return __context->glIsTransformFeedback(id.Value);
}
/// <summary>Forwards to the native C API <c>void glPauseTransformFeedback();</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glPauseTransformFeedback" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PauseTransformFeedback()
{
__context->glPauseTransformFeedback();
}
/// <summary>Forwards to the native C API <c>void glResumeTransformFeedback();</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glResumeTransformFeedback" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ResumeTransformFeedback()
{
__context->glResumeTransformFeedback();
}
/// <summary>Forwards to the native C API <c>void glDrawTransformFeedback(GLenum mode, GLuint id);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDrawTransformFeedback" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedback(uint mode, GlHandle id)
{
__context->glDrawTransformFeedback(mode, id.Value);
}
/// <summary>Forwards to the native C API <c>void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDrawTransformFeedbackStream" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedbackStream(uint mode, GlHandle id, uint stream)
{
__context->glDrawTransformFeedbackStream(mode, id.Value, stream);
}
/// <summary>Forwards to the native C API <c>void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBeginQueryIndexed" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BeginQueryIndexed(uint target, uint index, GlHandle id)
{
__context->glBeginQueryIndexed(target, index, id.Value);
}
/// <summary>Forwards to the native C API <c>void glEndQueryIndexed(GLenum target, GLuint index);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glEndQueryIndexed" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void EndQueryIndexed(uint target, uint index)
{
__context->glEndQueryIndexed(target, index);
}
/// <summary>Forwards to the native C API <c>void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetQueryIndexediv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryIndexediv(uint target, uint index, uint pname, int* @params)
{
__context->glGetQueryIndexediv(target, index, pname, @params);
}
}
}
@@ -0,0 +1,635 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 4.1 core-profile forwarding methods.
// </auto-generated>
using StgSharp.Mathematics.Graphics;
using System;
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
/// <summary>Forwards to the native C API <c>void glReleaseShaderCompiler();</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glReleaseShaderCompiler" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReleaseShaderCompiler()
{
__context->glReleaseShaderCompiler();
}
/// <summary>Forwards to the native C API <c>void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glShaderBinary" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ShaderBinary(ReadOnlySpan<GlHandle> shaders, uint binaryFormat, void* binary, int length)
{
fixed (GlHandle* __shaders = shaders)
{
__context->glShaderBinary(shaders.Length, (uint*)__shaders, binaryFormat, binary, length);
}
}
/// <summary>Forwards to the native C API <c>void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetShaderPrecisionFormat" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetShaderPrecisionFormat(uint shadertype, uint precisiontype, int* range, int* precision)
{
__context->glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
}
/// <summary>Forwards to the native C API <c>void glDepthRangef(GLfloat n, GLfloat f);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDepthRangef" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DepthRangef(float n, float f)
{
__context->glDepthRangef(n, f);
}
/// <summary>Forwards to the native C API <c>void glClearDepthf(GLfloat d);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glClearDepthf" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearDepthf(float d)
{
__context->glClearDepthf(d);
}
/// <summary>Forwards to the native C API <c>void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetProgramBinary" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramBinary(GlHandle program, int bufSize, int* length, uint* binaryFormat, void* binary)
{
__context->glGetProgramBinary(program.Value, bufSize, length, binaryFormat, binary);
}
/// <summary>Forwards to the native C API <c>void glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramBinary" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramBinary(GlHandle program, uint binaryFormat, void* binary, int length)
{
__context->glProgramBinary(program.Value, binaryFormat, binary, length);
}
/// <summary>Forwards to the native C API <c>void glProgramParameteri(GLuint program, GLenum pname, GLint value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramParameteri" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramParameteri(GlHandle program, uint pname, int value)
{
__context->glProgramParameteri(program.Value, pname, value);
}
/// <summary>Forwards to the native C API <c>void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glUseProgramStages" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UseProgramStages(GlHandle pipeline, uint stages, GlHandle program)
{
__context->glUseProgramStages(pipeline.Value, stages, program.Value);
}
/// <summary>Forwards to the native C API <c>void glActiveShaderProgram(GLuint pipeline, GLuint program);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glActiveShaderProgram" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ActiveShaderProgram(GlHandle pipeline, GlHandle program)
{
__context->glActiveShaderProgram(pipeline.Value, program.Value);
}
/// <summary>Forwards to the native C API <c>GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const*strings);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCreateShaderProgramv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public GlHandle CreateShaderProgramv(uint type, int count, byte** strings)
{
return GlHandle.Create(__context->glCreateShaderProgramv(type, count, strings));
}
/// <summary>Forwards to the native C API <c>void glBindProgramPipeline(GLuint pipeline);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBindProgramPipeline" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindProgramPipeline(GlHandle pipeline)
{
__context->glBindProgramPipeline(pipeline.Value);
}
/// <summary>Forwards to the native C API <c>void glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDeleteProgramPipelines" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DeleteProgramPipelines(ReadOnlySpan<GlHandle> pipelines)
{
fixed (GlHandle* __pipelines = pipelines)
{
__context->glDeleteProgramPipelines(pipelines.Length, (uint*)__pipelines);
}
}
/// <summary>Forwards to the native C API <c>void glGenProgramPipelines(GLsizei n, GLuint *pipelines);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGenProgramPipelines" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GenProgramPipelines(Span<GlHandle> pipelines)
{
fixed (GlHandle* __pipelines = pipelines)
{
__context->glGenProgramPipelines(pipelines.Length, (uint*)__pipelines);
}
}
/// <summary>Forwards to the native C API <c>GLboolean glIsProgramPipeline(GLuint pipeline);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glIsProgramPipeline" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public byte IsProgramPipeline(GlHandle pipeline)
{
return __context->glIsProgramPipeline(pipeline.Value);
}
/// <summary>Forwards to the native C API <c>void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetProgramPipelineiv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramPipelineiv(GlHandle pipeline, uint pname, int* @params)
{
__context->glGetProgramPipelineiv(pipeline.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform1i(GLuint program, GLint location, GLint v0);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, int v0)
{
__context->glProgramUniform1i(program.Value, location, v0);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, ReadOnlySpan<int> values)
{
fixed (int* __value = values)
{
__context->glProgramUniform1iv(program.Value, location, values.Length, __value);
}
}
/// <summary>Forwards to the native C API <c>void glProgramUniform1f(GLuint program, GLint location, GLfloat v0);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, float v0)
{
__context->glProgramUniform1f(program.Value, location, v0);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, ReadOnlySpan<float> values)
{
fixed (float* __value = values)
{
__context->glProgramUniform1fv(program.Value, location, values.Length, __value);
}
}
/// <summary>Forwards to the native C API <c>void glProgramUniform1d(GLuint program, GLint location, GLdouble v0);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, double v0)
{
__context->glProgramUniform1d(program.Value, location, v0);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, ReadOnlySpan<double> values)
{
fixed (double* __value = values)
{
__context->glProgramUniform1dv(program.Value, location, values.Length, __value);
}
}
/// <summary>Forwards to the native C API <c>void glProgramUniform1ui(GLuint program, GLint location, GLuint v0);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, uint v0)
{
__context->glProgramUniform1ui(program.Value, location, v0);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, ReadOnlySpan<uint> values)
{
fixed (uint* __value = values)
{
__context->glProgramUniform1uiv(program.Value, location, values.Length, __value);
}
}
/// <summary>Forwards to the native C API <c>void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, int v0, int v1)
{
__context->glProgramUniform2i(program.Value, location, v0, v1);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, Vec2<int> value)
{
__context->glProgramUniform2i(program.Value, location, value.X, value.Y);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, float v0, float v1)
{
__context->glProgramUniform2f(program.Value, location, v0, v1);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, Vec2<float> value)
{
__context->glProgramUniform2f(program.Value, location, value.X, value.Y);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, double v0, double v1)
{
__context->glProgramUniform2d(program.Value, location, v0, v1);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, Vec2<double> value)
{
__context->glProgramUniform2d(program.Value, location, value.X, value.Y);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, uint v0, uint v1)
{
__context->glProgramUniform2ui(program.Value, location, v0, v1);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, Vec2<uint> value)
{
__context->glProgramUniform2ui(program.Value, location, value.X, value.Y);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, int v0, int v1, int v2)
{
__context->glProgramUniform3i(program.Value, location, v0, v1, v2);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, Vec3<int> value)
{
__context->glProgramUniform3i(program.Value, location, value.X, value.Y, value.Z);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, float v0, float v1, float v2)
{
__context->glProgramUniform3f(program.Value, location, v0, v1, v2);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, Vec3<float> value)
{
__context->glProgramUniform3f(program.Value, location, value.X, value.Y, value.Z);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, double v0, double v1, double v2)
{
__context->glProgramUniform3d(program.Value, location, v0, v1, v2);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, Vec3<double> value)
{
__context->glProgramUniform3d(program.Value, location, value.X, value.Y, value.Z);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, uint v0, uint v1, uint v2)
{
__context->glProgramUniform3ui(program.Value, location, v0, v1, v2);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, Vec3<uint> value)
{
__context->glProgramUniform3ui(program.Value, location, value.X, value.Y, value.Z);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, int v0, int v1, int v2, int v3)
{
__context->glProgramUniform4i(program.Value, location, v0, v1, v2, v3);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, Vec4<int> value)
{
__context->glProgramUniform4i(program.Value, location, value.X, value.Y, value.Z, value.W);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, ReadOnlySpan<Vec4<int>> values)
{
fixed (Vec4<int>* __vector = values)
{
__context->glProgramUniform4iv(program.Value, location, values.Length, (int*)__vector);
}
}
/// <summary>Forwards to the native C API <c>void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, float v0, float v1, float v2, float v3)
{
__context->glProgramUniform4f(program.Value, location, v0, v1, v2, v3);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, Vec4<float> value)
{
__context->glProgramUniform4f(program.Value, location, value.X, value.Y, value.Z, value.W);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, ReadOnlySpan<Vec4<float>> values)
{
fixed (Vec4<float>* __vector = values)
{
__context->glProgramUniform4fv(program.Value, location, values.Length, (float*)__vector);
}
}
/// <summary>Forwards to the native C API <c>void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, double v0, double v1, double v2, double v3)
{
__context->glProgramUniform4d(program.Value, location, v0, v1, v2, v3);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, Vec4<double> value)
{
__context->glProgramUniform4d(program.Value, location, value.X, value.Y, value.Z, value.W);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, ReadOnlySpan<Vec4<double>> values)
{
fixed (Vec4<double>* __vector = values)
{
__context->glProgramUniform4dv(program.Value, location, values.Length, (double*)__vector);
}
}
/// <summary>Forwards to the native C API <c>void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, uint v0, uint v1, uint v2, uint v3)
{
__context->glProgramUniform4ui(program.Value, location, v0, v1, v2, v3);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, Vec4<uint> value)
{
__context->glProgramUniform4ui(program.Value, location, value.X, value.Y, value.Z, value.W);
}
/// <summary>Forwards to the native C API <c>void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, ReadOnlySpan<Vec4<uint>> values)
{
fixed (Vec4<uint>* __vector = values)
{
__context->glProgramUniform4uiv(program.Value, location, values.Length, (uint*)__vector);
}
}
/// <summary>Forwards to the native C API <c>void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, bool transpose, GraphicsMatrix value)
{
__context->glProgramUniformMatrix4fv(program.Value, location, 1, transpose ? (byte)1 : (byte)0, (float*)&value);
}
/// <summary>Forwards to the native C API <c>void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glProgramUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramUniform(GlHandle program, int location, bool transpose, ReadOnlySpan<GraphicsMatrix> values)
{
fixed (GraphicsMatrix* __value = values)
{
__context->glProgramUniformMatrix4fv(program.Value, location, values.Length, transpose ? (byte)1 : (byte)0, (float*)__value);
}
}
/// <summary>Forwards to the native C API <c>void glValidateProgramPipeline(GLuint pipeline);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glValidateProgramPipeline" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ValidateProgramPipeline(GlHandle pipeline)
{
__context->glValidateProgramPipeline(pipeline.Value);
}
/// <summary>Forwards to the native C API <c>void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetProgramPipelineInfoLog" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramPipelineInfoLog(GlHandle pipeline, int bufSize, int* length, byte* infoLog)
{
__context->glGetProgramPipelineInfoLog(pipeline.Value, bufSize, length, infoLog);
}
/// <summary>Forwards to the native C API <c>void glVertexAttribL1d(GLuint index, GLdouble x);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttrib" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeDouble(uint index, double x)
{
__context->glVertexAttribL1d(index, x);
}
/// <summary>Forwards to the native C API <c>void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttrib" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeDouble(uint index, double x, double y)
{
__context->glVertexAttribL2d(index, x, y);
}
/// <summary>Forwards to the native C API <c>void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttrib" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeDouble(uint index, double x, double y, double z)
{
__context->glVertexAttribL3d(index, x, y, z);
}
/// <summary>Forwards to the native C API <c>void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttrib" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeDouble(uint index, double x, double y, double z, double w)
{
__context->glVertexAttribL4d(index, x, y, z, w);
}
/// <summary>Forwards to the native C API <c>void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttribPointer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeDoublePointer(uint index, int size, uint type, int stride, void* pointer)
{
__context->glVertexAttribLPointer(index, size, type, stride, pointer);
}
/// <summary>Forwards to the native C API <c>void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetVertexAttrib" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetVertexAttributeDouble(uint index, uint pname, double* @params)
{
__context->glGetVertexAttribLdv(index, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glViewportArrayv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ViewportArrayv(uint first, int count, float* v)
{
__context->glViewportArrayv(first, count, v);
}
/// <summary>Forwards to the native C API <c>void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glViewportIndexed" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ViewportIndexed(uint index, float x, float y, float w, float h)
{
__context->glViewportIndexedf(index, x, y, w, h);
}
/// <summary>Forwards to the native C API <c>void glViewportIndexedfv(GLuint index, const GLfloat *v);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glViewportIndexed" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ViewportIndexed(uint index, float* v)
{
__context->glViewportIndexedfv(index, v);
}
/// <summary>Forwards to the native C API <c>void glScissorArrayv(GLuint first, GLsizei count, const GLint *v);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glScissorArrayv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ScissorArrayv(uint first, int count, int* v)
{
__context->glScissorArrayv(first, count, v);
}
/// <summary>Forwards to the native C API <c>void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glScissorIndexed" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ScissorIndexed(uint index, int left, int bottom, int width, int height)
{
__context->glScissorIndexed(index, left, bottom, width, height);
}
/// <summary>Forwards to the native C API <c>void glScissorIndexedv(GLuint index, const GLint *v);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glScissorIndexed" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ScissorIndexed(uint index, int* v)
{
__context->glScissorIndexedv(index, v);
}
/// <summary>Forwards to the native C API <c>void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDepthRangeArrayv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DepthRangeArrayv(uint first, int count, double* v)
{
__context->glDepthRangeArrayv(first, count, v);
}
/// <summary>Forwards to the native C API <c>void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDepthRangeIndexed" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DepthRangeIndexed(uint index, double n, double f)
{
__context->glDepthRangeIndexed(index, n, f);
}
/// <summary>Forwards to the native C API <c>void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGet" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetValue(uint target, uint index, Span<float> values)
{
fixed (float* __value = values)
{
__context->glGetFloati_v(target, index, __value);
}
}
/// <summary>Forwards to the native C API <c>void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGet" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetValue(uint target, uint index, Span<double> values)
{
fixed (double* __value = values)
{
__context->glGetDoublei_v(target, index, __value);
}
}
}
}
@@ -0,0 +1,113 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 4.2 core-profile forwarding methods.
// </auto-generated>
using StgSharp.Mathematics.Graphics;
using System;
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
/// <summary>Forwards to the native C API <c>void glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDrawArraysInstancedBaseInstance" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawArraysInstancedBaseInstance(uint mode, int first, int count, int instancecount, uint baseinstance)
{
__context->glDrawArraysInstancedBaseInstance(mode, first, count, instancecount, baseinstance);
}
/// <summary>Forwards to the native C API <c>void glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDrawElementsInstancedBaseInstance" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawElementsInstancedBaseInstance(uint mode, int count, uint type, void* indices, int instancecount, uint baseinstance)
{
__context->glDrawElementsInstancedBaseInstance(mode, count, type, indices, instancecount, baseinstance);
}
/// <summary>Forwards to the native C API <c>void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDrawElementsInstancedBaseVertexBaseInstance" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawElementsInstancedBaseVertexBaseInstance(uint mode, int count, uint type, void* indices, int instancecount, int basevertex, uint baseinstance)
{
__context->glDrawElementsInstancedBaseVertexBaseInstance(mode, count, type, indices, instancecount, basevertex, baseinstance);
}
/// <summary>Forwards to the native C API <c>void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetInternalformat" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetInternalFormat(uint target, uint internalFormat, uint pname, int count, int* @params)
{
__context->glGetInternalformativ(target, internalFormat, pname, count, @params);
}
/// <summary>Forwards to the native C API <c>void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetActiveAtomicCounterBufferiv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveAtomicCounterBufferiv(GlHandle program, uint bufferIndex, uint pname, int* @params)
{
__context->glGetActiveAtomicCounterBufferiv(program.Value, bufferIndex, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBindImageTexture" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindImageTexture(uint unit, GlHandle texture, int level, byte layered, int layer, uint access, uint format)
{
__context->glBindImageTexture(unit, texture.Value, level, layered, layer, access, format);
}
/// <summary>Forwards to the native C API <c>void glMemoryBarrier(GLbitfield barriers);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glMemoryBarrier" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MemoryBarrier(uint barriers)
{
__context->glMemoryBarrier(barriers);
}
/// <summary>Forwards to the native C API <c>void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTexStorage1D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage1D(uint target, int levels, uint internalFormat, int width)
{
__context->glTexStorage1D(target, levels, internalFormat, width);
}
/// <summary>Forwards to the native C API <c>void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTexStorage2D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage2D(uint target, int levels, uint internalFormat, int width, int height)
{
__context->glTexStorage2D(target, levels, internalFormat, width, height);
}
/// <summary>Forwards to the native C API <c>void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTexStorage3D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage3D(uint target, int levels, uint internalFormat, int width, int height, int depth)
{
__context->glTexStorage3D(target, levels, internalFormat, width, height, depth);
}
/// <summary>Forwards to the native C API <c>void glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDrawTransformFeedbackInstanced" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedbackInstanced(uint mode, GlHandle id, int instancecount)
{
__context->glDrawTransformFeedbackInstanced(mode, id.Value, instancecount);
}
/// <summary>Forwards to the native C API <c>void glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDrawTransformFeedbackStreamInstanced" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedbackStreamInstanced(uint mode, GlHandle id, uint stream, int instancecount)
{
__context->glDrawTransformFeedbackStreamInstanced(mode, id.Value, stream, instancecount);
}
}
}
@@ -0,0 +1,361 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 4.3 core-profile forwarding methods.
// </auto-generated>
using StgSharp.Mathematics.Graphics;
using System;
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
/// <summary>Forwards to the native C API <c>void glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glClearBufferData" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearBufferData(uint target, uint internalFormat, uint format, uint type, void* data)
{
__context->glClearBufferData(target, internalFormat, format, type, data);
}
/// <summary>Forwards to the native C API <c>void glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glClearBufferSubData" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearBufferSubData(uint target, uint internalFormat, nint offset, nint size, uint format, uint type, void* data)
{
__context->glClearBufferSubData(target, internalFormat, offset, size, format, type, data);
}
/// <summary>Forwards to the native C API <c>void glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDispatchCompute" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DispatchCompute(uint num_groups_x, uint num_groups_y, uint num_groups_z)
{
__context->glDispatchCompute(num_groups_x, num_groups_y, num_groups_z);
}
/// <summary>Forwards to the native C API <c>void glDispatchComputeIndirect(GLintptr indirect);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDispatchComputeIndirect" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DispatchComputeIndirect(nint indirect)
{
__context->glDispatchComputeIndirect(indirect);
}
/// <summary>Forwards to the native C API <c>void glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCopyImageSubData" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CopyImageSubData(uint srcName, uint srcTarget, int srcLevel, int srcX, int srcY, int srcZ, uint dstName, uint dstTarget, int dstLevel, int dstX, int dstY, int dstZ, int srcWidth, int srcHeight, int srcDepth)
{
__context->glCopyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth);
}
/// <summary>Forwards to the native C API <c>void glFramebufferParameteri(GLenum target, GLenum pname, GLint param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glFramebufferParameteri" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FrameBufferParameteri(uint target, uint pname, int param)
{
__context->glFramebufferParameteri(target, pname, param);
}
/// <summary>Forwards to the native C API <c>void glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetFramebufferParameteriv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetFrameBufferParameteriv(uint target, uint pname, int* @params)
{
__context->glGetFramebufferParameteriv(target, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint64 *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetInternalformat" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetInternalFormat(uint target, uint internalFormat, uint pname, int count, long* @params)
{
__context->glGetInternalformati64v(target, internalFormat, pname, count, @params);
}
/// <summary>Forwards to the native C API <c>void glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glInvalidateTexSubImage" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateTexSubImage(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth)
{
__context->glInvalidateTexSubImage(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth);
}
/// <summary>Forwards to the native C API <c>void glInvalidateTexImage(GLuint texture, GLint level);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glInvalidateTexImage" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateTexImage(GlHandle texture, int level)
{
__context->glInvalidateTexImage(texture.Value, level);
}
/// <summary>Forwards to the native C API <c>void glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glInvalidateBufferSubData" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateBufferSubData(GlHandle buffer, nint offset, nint length)
{
__context->glInvalidateBufferSubData(buffer.Value, offset, length);
}
/// <summary>Forwards to the native C API <c>void glInvalidateBufferData(GLuint buffer);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glInvalidateBufferData" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateBufferData(GlHandle buffer)
{
__context->glInvalidateBufferData(buffer.Value);
}
/// <summary>Forwards to the native C API <c>void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glInvalidateFramebuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateFrameBuffer(uint target, int numAttachments, uint* attachments)
{
__context->glInvalidateFramebuffer(target, numAttachments, attachments);
}
/// <summary>Forwards to the native C API <c>void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glInvalidateSubFramebuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateSubFrameBuffer(uint target, int numAttachments, uint* attachments, int x, int y, int width, int height)
{
__context->glInvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
}
/// <summary>Forwards to the native C API <c>void glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glMultiDrawArraysIndirect" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawArraysIndirect(uint mode, void* indirect, int drawcount, int stride)
{
__context->glMultiDrawArraysIndirect(mode, indirect, drawcount, stride);
}
/// <summary>Forwards to the native C API <c>void glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glMultiDrawElementsIndirect" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawElementsIndirect(uint mode, uint type, void* indirect, int drawcount, int stride)
{
__context->glMultiDrawElementsIndirect(mode, type, indirect, drawcount, stride);
}
/// <summary>Forwards to the native C API <c>void glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetProgramInterfaceiv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramInterfaceiv(GlHandle program, uint programInterface, uint pname, int* @params)
{
__context->glGetProgramInterfaceiv(program.Value, programInterface, pname, @params);
}
/// <summary>Forwards to the native C API <c>GLuint glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetProgramResourceIndex" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetProgramResourceIndex(GlHandle program, uint programInterface, byte* name)
{
return __context->glGetProgramResourceIndex(program.Value, programInterface, name);
}
/// <summary>Forwards to the native C API <c>void glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetProgramResourceName" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramResourceName(GlHandle program, uint programInterface, uint index, int bufSize, int* length, byte* name)
{
__context->glGetProgramResourceName(program.Value, programInterface, index, bufSize, length, name);
}
/// <summary>Forwards to the native C API <c>void glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetProgramResourceiv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramResourceiv(GlHandle program, uint programInterface, uint index, int propCount, uint* props, int count, int* length, int* @params)
{
__context->glGetProgramResourceiv(program.Value, programInterface, index, propCount, props, count, length, @params);
}
/// <summary>Forwards to the native C API <c>GLint glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetProgramResourceLocation" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetProgramResourceLocation(GlHandle program, uint programInterface, byte* name)
{
return __context->glGetProgramResourceLocation(program.Value, programInterface, name);
}
/// <summary>Forwards to the native C API <c>GLint glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetProgramResourceLocationIndex" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetProgramResourceLocationIndex(GlHandle program, uint programInterface, byte* name)
{
return __context->glGetProgramResourceLocationIndex(program.Value, programInterface, name);
}
/// <summary>Forwards to the native C API <c>void glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glShaderStorageBlockBinding" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ShaderStorageBlockBinding(GlHandle program, uint storageBlockIndex, uint storageBlockBinding)
{
__context->glShaderStorageBlockBinding(program.Value, storageBlockIndex, storageBlockBinding);
}
/// <summary>Forwards to the native C API <c>void glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTexBufferRange" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexBufferRange(uint target, uint internalFormat, GlHandle buffer, nint offset, nint size)
{
__context->glTexBufferRange(target, internalFormat, buffer.Value, offset, size);
}
/// <summary>Forwards to the native C API <c>void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTexStorage2DMultisample" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage2DMultisample(uint target, int samples, uint internalFormat, int width, int height, byte fixedsamplelocations)
{
__context->glTexStorage2DMultisample(target, samples, internalFormat, width, height, fixedsamplelocations);
}
/// <summary>Forwards to the native C API <c>void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTexStorage3DMultisample" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage3DMultisample(uint target, int samples, uint internalFormat, int width, int height, int depth, byte fixedsamplelocations)
{
__context->glTexStorage3DMultisample(target, samples, internalFormat, width, height, depth, fixedsamplelocations);
}
/// <summary>Forwards to the native C API <c>void glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureView" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureView(GlHandle texture, uint target, GlHandle origtexture, uint internalFormat, uint minlevel, uint numlevels, uint minlayer, uint numlayers)
{
__context->glTextureView(texture.Value, target, origtexture.Value, internalFormat, minlevel, numlevels, minlayer, numlayers);
}
/// <summary>Forwards to the native C API <c>void glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBindVertexBuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindVertexBuffer(uint bindingIndex, GlHandle buffer, nint offset, int stride)
{
__context->glBindVertexBuffer(bindingIndex, buffer.Value, offset, stride);
}
/// <summary>Forwards to the native C API <c>void glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttribFormat" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeFormat(uint attributeIndex, int size, uint type, byte normalized, uint relativeOffset)
{
__context->glVertexAttribFormat(attributeIndex, size, type, normalized, relativeOffset);
}
/// <summary>Forwards to the native C API <c>void glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttribFormat" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeIntegerFormat(uint attributeIndex, int size, uint type, uint relativeOffset)
{
__context->glVertexAttribIFormat(attributeIndex, size, type, relativeOffset);
}
/// <summary>Forwards to the native C API <c>void glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttribFormat" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeDoubleFormat(uint attributeIndex, int size, uint type, uint relativeOffset)
{
__context->glVertexAttribLFormat(attributeIndex, size, type, relativeOffset);
}
/// <summary>Forwards to the native C API <c>void glVertexAttribBinding(GLuint attribindex, GLuint bindingindex);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttribBinding" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeBinding(uint attributeIndex, uint bindingIndex)
{
__context->glVertexAttribBinding(attributeIndex, bindingIndex);
}
/// <summary>Forwards to the native C API <c>void glVertexBindingDivisor(GLuint bindingindex, GLuint divisor);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexBindingDivisor" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexBindingDivisor(uint bindingIndex, uint divisor)
{
__context->glVertexBindingDivisor(bindingIndex, divisor);
}
/// <summary>Forwards to the native C API <c>void glDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDebugMessageControl" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DebugMessageControl(uint source, uint type, uint severity, int count, uint* ids, byte enabled)
{
__context->glDebugMessageControl(source, type, severity, count, ids, enabled);
}
/// <summary>Forwards to the native C API <c>void glDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDebugMessageInsert" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DebugMessageInsert(uint source, uint type, uint id, uint severity, int length, byte* buf)
{
__context->glDebugMessageInsert(source, type, id, severity, length, buf);
}
/// <summary>Forwards to the native C API <c>void glDebugMessageCallback(GLDEBUGPROC callback, const void *userParam);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDebugMessageCallback" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DebugMessageCallback(delegate* unmanaged<uint, uint, uint, uint, int, byte*, void*, void> callback, void* userParam)
{
__context->glDebugMessageCallback(callback, userParam);
}
/// <summary>Forwards to the native C API <c>GLuint glGetDebugMessageLog(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetDebugMessageLog" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetDebugMessageLog(uint count, int bufSize, uint* sources, uint* types, uint* ids, uint* severities, int* lengths, byte* messageLog)
{
return __context->glGetDebugMessageLog(count, bufSize, sources, types, ids, severities, lengths, messageLog);
}
/// <summary>Forwards to the native C API <c>void glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glPushDebugGroup" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PushDebugGroup(uint source, uint id, int length, byte* message)
{
__context->glPushDebugGroup(source, id, length, message);
}
/// <summary>Forwards to the native C API <c>void glPopDebugGroup();</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glPopDebugGroup" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PopDebugGroup()
{
__context->glPopDebugGroup();
}
/// <summary>Forwards to the native C API <c>void glObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glObjectLabel" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ObjectLabel(uint identifier, uint name, int length, byte* label)
{
__context->glObjectLabel(identifier, name, length, label);
}
/// <summary>Forwards to the native C API <c>void glGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetObjectLabel" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetObjectLabel(uint identifier, uint name, int bufSize, int* length, byte* label)
{
__context->glGetObjectLabel(identifier, name, bufSize, length, label);
}
/// <summary>Forwards to the native C API <c>void glObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glObjectPtrLabel" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ObjectPtrLabel(void* ptr, int length, byte* label)
{
__context->glObjectPtrLabel(ptr, length, label);
}
/// <summary>Forwards to the native C API <c>void glGetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetObjectPtrLabel" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetObjectPtrLabel(void* ptr, int bufSize, int* length, byte* label)
{
__context->glGetObjectPtrLabel(ptr, bufSize, length, label);
}
}
}
@@ -0,0 +1,107 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 4.4 core-profile forwarding methods.
// </auto-generated>
using StgSharp.Mathematics.Graphics;
using System;
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
/// <summary>Forwards to the native C API <c>void glBufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBufferStorage" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BufferStorage(uint target, nint size, void* data, uint flags)
{
__context->glBufferStorage(target, size, data, flags);
}
/// <summary>Forwards to the native C API <c>void glClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glClearTexImage" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearTexImage(GlHandle texture, int level, uint format, uint type, void* data)
{
__context->glClearTexImage(texture.Value, level, format, type, data);
}
/// <summary>Forwards to the native C API <c>void glClearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glClearTexSubImage" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearTexSubImage(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, uint type, void* data)
{
__context->glClearTexSubImage(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data);
}
/// <summary>Forwards to the native C API <c>void glBindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint *buffers);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBindBuffersBase" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindBuffersBase(uint target, uint first, ReadOnlySpan<GlHandle> buffers)
{
fixed (GlHandle* __buffers = buffers)
{
__context->glBindBuffersBase(target, first, buffers.Length, (uint*)__buffers);
}
}
/// <summary>Forwards to the native C API <c>void glBindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBindBuffersRange" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindBuffersRange(uint target, uint first, ReadOnlySpan<GlHandle> buffers, nint* offsets, nint* sizes)
{
fixed (GlHandle* __buffers = buffers)
{
__context->glBindBuffersRange(target, first, buffers.Length, (uint*)__buffers, offsets, sizes);
}
}
/// <summary>Forwards to the native C API <c>void glBindTextures(GLuint first, GLsizei count, const GLuint *textures);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBindTextures" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindTextures(uint first, ReadOnlySpan<GlHandle> textures)
{
fixed (GlHandle* __textures = textures)
{
__context->glBindTextures(first, textures.Length, (uint*)__textures);
}
}
/// <summary>Forwards to the native C API <c>void glBindSamplers(GLuint first, GLsizei count, const GLuint *samplers);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBindSamplers" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindSamplers(uint first, ReadOnlySpan<GlHandle> samplers)
{
fixed (GlHandle* __samplers = samplers)
{
__context->glBindSamplers(first, samplers.Length, (uint*)__samplers);
}
}
/// <summary>Forwards to the native C API <c>void glBindImageTextures(GLuint first, GLsizei count, const GLuint *textures);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBindImageTextures" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindImageTextures(uint first, ReadOnlySpan<GlHandle> textures)
{
fixed (GlHandle* __textures = textures)
{
__context->glBindImageTextures(first, textures.Length, (uint*)__textures);
}
}
/// <summary>Forwards to the native C API <c>void glBindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBindVertexBuffers" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindVertexBuffers(uint first, ReadOnlySpan<GlHandle> buffers, nint* offsets, int* strides)
{
fixed (GlHandle* __buffers = buffers)
{
__context->glBindVertexBuffers(first, buffers.Length, (uint*)__buffers, offsets, strides);
}
}
}
}
@@ -0,0 +1,927 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 4.5 core-profile forwarding methods.
// </auto-generated>
using StgSharp.Mathematics.Graphics;
using System;
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
/// <summary>Forwards to the native C API <c>void glClipControl(GLenum origin, GLenum depth);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glClipControl" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClipControl(uint origin, uint depth)
{
__context->glClipControl(origin, depth);
}
/// <summary>Forwards to the native C API <c>void glCreateTransformFeedbacks(GLsizei n, GLuint *ids);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCreateTransformFeedbacks" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateTransformFeedbacks(Span<GlHandle> ids)
{
fixed (GlHandle* __ids = ids)
{
__context->glCreateTransformFeedbacks(ids.Length, (uint*)__ids);
}
}
/// <summary>Forwards to the native C API <c>void glTransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTransformFeedbackBufferBase" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TransformFeedbackBufferBase(GlHandle xfb, uint index, GlHandle buffer)
{
__context->glTransformFeedbackBufferBase(xfb.Value, index, buffer.Value);
}
/// <summary>Forwards to the native C API <c>void glTransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTransformFeedbackBufferRange" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TransformFeedbackBufferRange(GlHandle xfb, uint index, GlHandle buffer, nint offset, nint size)
{
__context->glTransformFeedbackBufferRange(xfb.Value, index, buffer.Value, offset, size);
}
/// <summary>Forwards to the native C API <c>void glGetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetTransformFeedbackiv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTransformFeedbackiv(GlHandle xfb, uint pname, int* param)
{
__context->glGetTransformFeedbackiv(xfb.Value, pname, param);
}
/// <summary>Forwards to the native C API <c>void glGetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint *param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetTransformFeedbacki_v" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTransformFeedbacki_v(GlHandle xfb, uint pname, uint index, int* param)
{
__context->glGetTransformFeedbacki_v(xfb.Value, pname, index, param);
}
/// <summary>Forwards to the native C API <c>void glGetTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index, GLint64 *param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetTransformFeedbacki64_v" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTransformFeedbacki64_v(GlHandle xfb, uint pname, uint index, long* param)
{
__context->glGetTransformFeedbacki64_v(xfb.Value, pname, index, param);
}
/// <summary>Forwards to the native C API <c>void glCreateBuffers(GLsizei n, GLuint *buffers);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCreateBuffers" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateBuffers(Span<GlHandle> buffers)
{
fixed (GlHandle* __buffers = buffers)
{
__context->glCreateBuffers(buffers.Length, (uint*)__buffers);
}
}
/// <summary>Forwards to the native C API <c>void glNamedBufferStorage(GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glNamedBufferStorage" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedBufferStorage(GlHandle buffer, nint size, void* data, uint flags)
{
__context->glNamedBufferStorage(buffer.Value, size, data, flags);
}
/// <summary>Forwards to the native C API <c>void glNamedBufferData(GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glNamedBufferData" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedBufferData(GlHandle buffer, nint size, void* data, uint usage)
{
__context->glNamedBufferData(buffer.Value, size, data, usage);
}
/// <summary>Forwards to the native C API <c>void glNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glNamedBufferSubData" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedBufferSubData(GlHandle buffer, nint offset, nint size, void* data)
{
__context->glNamedBufferSubData(buffer.Value, offset, size, data);
}
/// <summary>Forwards to the native C API <c>void glCopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCopyNamedBufferSubData" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CopyNamedBufferSubData(GlHandle readBuffer, GlHandle writeBuffer, nint readOffset, nint writeOffset, nint size)
{
__context->glCopyNamedBufferSubData(readBuffer.Value, writeBuffer.Value, readOffset, writeOffset, size);
}
/// <summary>Forwards to the native C API <c>void glClearNamedBufferData(GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glClearNamedBufferData" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedBufferData(GlHandle buffer, uint internalFormat, uint format, uint type, void* data)
{
__context->glClearNamedBufferData(buffer.Value, internalFormat, format, type, data);
}
/// <summary>Forwards to the native C API <c>void glClearNamedBufferSubData(GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glClearNamedBufferSubData" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedBufferSubData(GlHandle buffer, uint internalFormat, nint offset, nint size, uint format, uint type, void* data)
{
__context->glClearNamedBufferSubData(buffer.Value, internalFormat, offset, size, format, type, data);
}
/// <summary>Forwards to the native C API <c>void *glMapNamedBuffer(GLuint buffer, GLenum access);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glMapNamedBuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void* MapNamedBuffer(GlHandle buffer, uint access)
{
return __context->glMapNamedBuffer(buffer.Value, access);
}
/// <summary>Forwards to the native C API <c>void *glMapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glMapNamedBufferRange" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void* MapNamedBufferRange(GlHandle buffer, nint offset, nint length, uint access)
{
return __context->glMapNamedBufferRange(buffer.Value, offset, length, access);
}
/// <summary>Forwards to the native C API <c>GLboolean glUnmapNamedBuffer(GLuint buffer);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glUnmapNamedBuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public byte UnmapNamedBuffer(GlHandle buffer)
{
return __context->glUnmapNamedBuffer(buffer.Value);
}
/// <summary>Forwards to the native C API <c>void glFlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glFlushMappedNamedBufferRange" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FlushMappedNamedBufferRange(GlHandle buffer, nint offset, nint length)
{
__context->glFlushMappedNamedBufferRange(buffer.Value, offset, length);
}
/// <summary>Forwards to the native C API <c>void glGetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetNamedBufferParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedBufferParameter(GlHandle buffer, uint pname, int* @params)
{
__context->glGetNamedBufferParameteriv(buffer.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glGetNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64 *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetNamedBufferParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedBufferParameter(GlHandle buffer, uint pname, long* @params)
{
__context->glGetNamedBufferParameteri64v(buffer.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glGetNamedBufferPointerv(GLuint buffer, GLenum pname, void **params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetNamedBufferPointerv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedBufferPointerv(GlHandle buffer, uint pname, void** @params)
{
__context->glGetNamedBufferPointerv(buffer.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glGetNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetNamedBufferSubData" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedBufferSubData(GlHandle buffer, nint offset, nint size, void* data)
{
__context->glGetNamedBufferSubData(buffer.Value, offset, size, data);
}
/// <summary>Forwards to the native C API <c>void glCreateFramebuffers(GLsizei n, GLuint *framebuffers);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCreateFramebuffers" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateFrameBuffers(Span<GlHandle> frameBuffers)
{
fixed (GlHandle* __frameBuffers = frameBuffers)
{
__context->glCreateFramebuffers(frameBuffers.Length, (uint*)__frameBuffers);
}
}
/// <summary>Forwards to the native C API <c>void glNamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glNamedFramebufferRenderbuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFrameBufferRenderBuffer(GlHandle frameBuffer, uint attachment, uint renderBuffertarget, GlHandle renderBuffer)
{
__context->glNamedFramebufferRenderbuffer(frameBuffer.Value, attachment, renderBuffertarget, renderBuffer.Value);
}
/// <summary>Forwards to the native C API <c>void glNamedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glNamedFramebufferParameteri" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFrameBufferParameteri(GlHandle frameBuffer, uint pname, int param)
{
__context->glNamedFramebufferParameteri(frameBuffer.Value, pname, param);
}
/// <summary>Forwards to the native C API <c>void glNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glNamedFramebufferTexture" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFrameBufferTexture(GlHandle frameBuffer, uint attachment, GlHandle texture, int level)
{
__context->glNamedFramebufferTexture(frameBuffer.Value, attachment, texture.Value, level);
}
/// <summary>Forwards to the native C API <c>void glNamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glNamedFramebufferTextureLayer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFrameBufferTextureLayer(GlHandle frameBuffer, uint attachment, GlHandle texture, int level, int layer)
{
__context->glNamedFramebufferTextureLayer(frameBuffer.Value, attachment, texture.Value, level, layer);
}
/// <summary>Forwards to the native C API <c>void glNamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glNamedFramebufferDrawBuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFrameBufferDrawBuffer(GlHandle frameBuffer, uint buf)
{
__context->glNamedFramebufferDrawBuffer(frameBuffer.Value, buf);
}
/// <summary>Forwards to the native C API <c>void glNamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum *bufs);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glNamedFramebufferDrawBuffers" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFrameBufferDrawBuffers(GlHandle frameBuffer, int n, uint* bufs)
{
__context->glNamedFramebufferDrawBuffers(frameBuffer.Value, n, bufs);
}
/// <summary>Forwards to the native C API <c>void glNamedFramebufferReadBuffer(GLuint framebuffer, GLenum src);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glNamedFramebufferReadBuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFrameBufferReadBuffer(GlHandle frameBuffer, uint src)
{
__context->glNamedFramebufferReadBuffer(frameBuffer.Value, src);
}
/// <summary>Forwards to the native C API <c>void glInvalidateNamedFramebufferData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glInvalidateNamedFramebufferData" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateNamedFrameBufferData(GlHandle frameBuffer, int numAttachments, uint* attachments)
{
__context->glInvalidateNamedFramebufferData(frameBuffer.Value, numAttachments, attachments);
}
/// <summary>Forwards to the native C API <c>void glInvalidateNamedFramebufferSubData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glInvalidateNamedFramebufferSubData" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateNamedFrameBufferSubData(GlHandle frameBuffer, int numAttachments, uint* attachments, int x, int y, int width, int height)
{
__context->glInvalidateNamedFramebufferSubData(frameBuffer.Value, numAttachments, attachments, x, y, width, height);
}
/// <summary>Forwards to the native C API <c>void glClearNamedFramebufferiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glClearNamedFramebuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedFrameBuffer(GlHandle frameBuffer, uint buffer, int drawbuffer, int* value)
{
__context->glClearNamedFramebufferiv(frameBuffer.Value, buffer, drawbuffer, value);
}
/// <summary>Forwards to the native C API <c>void glClearNamedFramebufferuiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glClearNamedFramebuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedFrameBuffer(GlHandle frameBuffer, uint buffer, int drawbuffer, uint* value)
{
__context->glClearNamedFramebufferuiv(frameBuffer.Value, buffer, drawbuffer, value);
}
/// <summary>Forwards to the native C API <c>void glClearNamedFramebufferfv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glClearNamedFramebuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedFrameBuffer(GlHandle frameBuffer, uint buffer, int drawbuffer, float* value)
{
__context->glClearNamedFramebufferfv(frameBuffer.Value, buffer, drawbuffer, value);
}
/// <summary>Forwards to the native C API <c>void glClearNamedFramebufferfi(GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glClearNamedFramebuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedFrameBuffer(GlHandle frameBuffer, uint buffer, int drawbuffer, float depth, int stencil)
{
__context->glClearNamedFramebufferfi(frameBuffer.Value, buffer, drawbuffer, depth, stencil);
}
/// <summary>Forwards to the native C API <c>void glBlitNamedFramebuffer(GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBlitNamedFramebuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlitNamedFrameBuffer(GlHandle readFrameBuffer, GlHandle drawFrameBuffer, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, uint mask, uint filter)
{
__context->glBlitNamedFramebuffer(readFrameBuffer.Value, drawFrameBuffer.Value, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
}
/// <summary>Forwards to the native C API <c>GLenum glCheckNamedFramebufferStatus(GLuint framebuffer, GLenum target);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCheckNamedFramebufferStatus" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint CheckNamedFrameBufferStatus(GlHandle frameBuffer, uint target)
{
return __context->glCheckNamedFramebufferStatus(frameBuffer.Value, target);
}
/// <summary>Forwards to the native C API <c>void glGetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint *param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetNamedFramebufferParameteriv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedFrameBufferParameteriv(GlHandle frameBuffer, uint pname, int* param)
{
__context->glGetNamedFramebufferParameteriv(frameBuffer.Value, pname, param);
}
/// <summary>Forwards to the native C API <c>void glGetNamedFramebufferAttachmentParameteriv(GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetNamedFramebufferAttachmentParameteriv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedFrameBufferAttachmentParameteriv(GlHandle frameBuffer, uint attachment, uint pname, int* @params)
{
__context->glGetNamedFramebufferAttachmentParameteriv(frameBuffer.Value, attachment, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glCreateRenderbuffers(GLsizei n, GLuint *renderbuffers);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCreateRenderbuffers" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateRenderBuffers(Span<GlHandle> renderBuffers)
{
fixed (GlHandle* __renderBuffers = renderBuffers)
{
__context->glCreateRenderbuffers(renderBuffers.Length, (uint*)__renderBuffers);
}
}
/// <summary>Forwards to the native C API <c>void glNamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glNamedRenderbufferStorage" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedRenderBufferStorage(GlHandle renderBuffer, uint internalFormat, int width, int height)
{
__context->glNamedRenderbufferStorage(renderBuffer.Value, internalFormat, width, height);
}
/// <summary>Forwards to the native C API <c>void glNamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glNamedRenderbufferStorageMultisample" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedRenderBufferStorageMultisample(GlHandle renderBuffer, int samples, uint internalFormat, int width, int height)
{
__context->glNamedRenderbufferStorageMultisample(renderBuffer.Value, samples, internalFormat, width, height);
}
/// <summary>Forwards to the native C API <c>void glGetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetNamedRenderbufferParameteriv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedRenderBufferParameteriv(GlHandle renderBuffer, uint pname, int* @params)
{
__context->glGetNamedRenderbufferParameteriv(renderBuffer.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glCreateTextures(GLenum target, GLsizei n, GLuint *textures);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCreateTextures" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateTextures(uint target, Span<GlHandle> textures)
{
fixed (GlHandle* __textures = textures)
{
__context->glCreateTextures(target, textures.Length, (uint*)__textures);
}
}
/// <summary>Forwards to the native C API <c>void glTextureBuffer(GLuint texture, GLenum internalformat, GLuint buffer);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureBuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureBuffer(GlHandle texture, uint internalFormat, GlHandle buffer)
{
__context->glTextureBuffer(texture.Value, internalFormat, buffer.Value);
}
/// <summary>Forwards to the native C API <c>void glTextureBufferRange(GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureBufferRange" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureBufferRange(GlHandle texture, uint internalFormat, GlHandle buffer, nint offset, nint size)
{
__context->glTextureBufferRange(texture.Value, internalFormat, buffer.Value, offset, size);
}
/// <summary>Forwards to the native C API <c>void glTextureStorage1D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureStorage1D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage1D(GlHandle texture, int levels, uint internalFormat, int width)
{
__context->glTextureStorage1D(texture.Value, levels, internalFormat, width);
}
/// <summary>Forwards to the native C API <c>void glTextureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureStorage2D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage2D(GlHandle texture, int levels, uint internalFormat, int width, int height)
{
__context->glTextureStorage2D(texture.Value, levels, internalFormat, width, height);
}
/// <summary>Forwards to the native C API <c>void glTextureStorage3D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureStorage3D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage3D(GlHandle texture, int levels, uint internalFormat, int width, int height, int depth)
{
__context->glTextureStorage3D(texture.Value, levels, internalFormat, width, height, depth);
}
/// <summary>Forwards to the native C API <c>void glTextureStorage2DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureStorage2DMultisample" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage2DMultisample(GlHandle texture, int samples, uint internalFormat, int width, int height, byte fixedsamplelocations)
{
__context->glTextureStorage2DMultisample(texture.Value, samples, internalFormat, width, height, fixedsamplelocations);
}
/// <summary>Forwards to the native C API <c>void glTextureStorage3DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureStorage3DMultisample" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage3DMultisample(GlHandle texture, int samples, uint internalFormat, int width, int height, int depth, byte fixedsamplelocations)
{
__context->glTextureStorage3DMultisample(texture.Value, samples, internalFormat, width, height, depth, fixedsamplelocations);
}
/// <summary>Forwards to the native C API <c>void glTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureSubImage1D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureSubImage1D(GlHandle texture, int level, int xoffset, int width, uint format, uint type, void* pixels)
{
__context->glTextureSubImage1D(texture.Value, level, xoffset, width, format, type, pixels);
}
/// <summary>Forwards to the native C API <c>void glTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureSubImage2D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureSubImage2D(GlHandle texture, int level, int xoffset, int yoffset, int width, int height, uint format, uint type, void* pixels)
{
__context->glTextureSubImage2D(texture.Value, level, xoffset, yoffset, width, height, format, type, pixels);
}
/// <summary>Forwards to the native C API <c>void glTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureSubImage3D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureSubImage3D(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, uint type, void* pixels)
{
__context->glTextureSubImage3D(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
}
/// <summary>Forwards to the native C API <c>void glCompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCompressedTextureSubImage1D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CompressedTextureSubImage1D(GlHandle texture, int level, int xoffset, int width, uint format, int imageSize, void* data)
{
__context->glCompressedTextureSubImage1D(texture.Value, level, xoffset, width, format, imageSize, data);
}
/// <summary>Forwards to the native C API <c>void glCompressedTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCompressedTextureSubImage2D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CompressedTextureSubImage2D(GlHandle texture, int level, int xoffset, int yoffset, int width, int height, uint format, int imageSize, void* data)
{
__context->glCompressedTextureSubImage2D(texture.Value, level, xoffset, yoffset, width, height, format, imageSize, data);
}
/// <summary>Forwards to the native C API <c>void glCompressedTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCompressedTextureSubImage3D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CompressedTextureSubImage3D(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, int imageSize, void* data)
{
__context->glCompressedTextureSubImage3D(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
}
/// <summary>Forwards to the native C API <c>void glCopyTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCopyTextureSubImage1D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CopyTextureSubImage1D(GlHandle texture, int level, int xoffset, int x, int y, int width)
{
__context->glCopyTextureSubImage1D(texture.Value, level, xoffset, x, y, width);
}
/// <summary>Forwards to the native C API <c>void glCopyTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCopyTextureSubImage2D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CopyTextureSubImage2D(GlHandle texture, int level, int xoffset, int yoffset, int x, int y, int width, int height)
{
__context->glCopyTextureSubImage2D(texture.Value, level, xoffset, yoffset, x, y, width, height);
}
/// <summary>Forwards to the native C API <c>void glCopyTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCopyTextureSubImage3D" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CopyTextureSubImage3D(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height)
{
__context->glCopyTextureSubImage3D(texture.Value, level, xoffset, yoffset, zoffset, x, y, width, height);
}
/// <summary>Forwards to the native C API <c>void glTextureParameterf(GLuint texture, GLenum pname, GLfloat param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedTextureParameter(GlHandle texture, uint pname, float param)
{
__context->glTextureParameterf(texture.Value, pname, param);
}
/// <summary>Forwards to the native C API <c>void glTextureParameterfv(GLuint texture, GLenum pname, const GLfloat *param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedTextureParameter(GlHandle texture, uint pname, float* param)
{
__context->glTextureParameterfv(texture.Value, pname, param);
}
/// <summary>Forwards to the native C API <c>void glTextureParameteri(GLuint texture, GLenum pname, GLint param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedTextureParameter(GlHandle texture, uint pname, int param)
{
__context->glTextureParameteri(texture.Value, pname, param);
}
/// <summary>Forwards to the native C API <c>void glTextureParameterIiv(GLuint texture, GLenum pname, const GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedTextureParameterInteger(GlHandle texture, uint pname, int* @params)
{
__context->glTextureParameterIiv(texture.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glTextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedTextureParameterInteger(GlHandle texture, uint pname, uint* @params)
{
__context->glTextureParameterIuiv(texture.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glTextureParameteriv(GLuint texture, GLenum pname, const GLint *param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedTextureParameter(GlHandle texture, uint pname, int* param)
{
__context->glTextureParameteriv(texture.Value, pname, param);
}
/// <summary>Forwards to the native C API <c>void glGenerateTextureMipmap(GLuint texture);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGenerateTextureMipmap" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GenerateTextureMipmap(GlHandle texture)
{
__context->glGenerateTextureMipmap(texture.Value);
}
/// <summary>Forwards to the native C API <c>void glBindTextureUnit(GLuint unit, GLuint texture);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glBindTextureUnit" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindTextureUnit(uint unit, GlHandle texture)
{
__context->glBindTextureUnit(unit, texture.Value);
}
/// <summary>Forwards to the native C API <c>void glGetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetTextureImage" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTextureImage(GlHandle texture, int level, uint format, uint type, int bufSize, void* pixels)
{
__context->glGetTextureImage(texture.Value, level, format, type, bufSize, pixels);
}
/// <summary>Forwards to the native C API <c>void glGetCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize, void *pixels);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetCompressedTextureImage" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetCompressedTextureImage(GlHandle texture, int level, int bufSize, void* pixels)
{
__context->glGetCompressedTextureImage(texture.Value, level, bufSize, pixels);
}
/// <summary>Forwards to the native C API <c>void glGetTextureLevelParameterfv(GLuint texture, GLint level, GLenum pname, GLfloat *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetTextureLevelParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedTextureLevelParameter(GlHandle texture, int level, uint pname, float* @params)
{
__context->glGetTextureLevelParameterfv(texture.Value, level, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glGetTextureLevelParameteriv(GLuint texture, GLint level, GLenum pname, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetTextureLevelParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedTextureLevelParameter(GlHandle texture, int level, uint pname, int* @params)
{
__context->glGetTextureLevelParameteriv(texture.Value, level, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glGetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetTextureParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedTextureParameter(GlHandle texture, uint pname, float* @params)
{
__context->glGetTextureParameterfv(texture.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glGetTextureParameterIiv(GLuint texture, GLenum pname, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetTextureParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedTextureParameterInteger(GlHandle texture, uint pname, int* @params)
{
__context->glGetTextureParameterIiv(texture.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glGetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetTextureParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedTextureParameterInteger(GlHandle texture, uint pname, uint* @params)
{
__context->glGetTextureParameterIuiv(texture.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glGetTextureParameteriv(GLuint texture, GLenum pname, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetTextureParameter" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedTextureParameter(GlHandle texture, uint pname, int* @params)
{
__context->glGetTextureParameteriv(texture.Value, pname, @params);
}
/// <summary>Forwards to the native C API <c>void glCreateVertexArrays(GLsizei n, GLuint *arrays);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCreateVertexArrays" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateVertexArrays(Span<GlHandle> arrays)
{
fixed (GlHandle* __arrays = arrays)
{
__context->glCreateVertexArrays(arrays.Length, (uint*)__arrays);
}
}
/// <summary>Forwards to the native C API <c>void glDisableVertexArrayAttrib(GLuint vaobj, GLuint index);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glDisableVertexArrayAttrib" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DisableVertexArrayAttribute(GlHandle vaobj, uint index)
{
__context->glDisableVertexArrayAttrib(vaobj.Value, index);
}
/// <summary>Forwards to the native C API <c>void glEnableVertexArrayAttrib(GLuint vaobj, GLuint index);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glEnableVertexArrayAttrib" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void EnableVertexArrayAttribute(GlHandle vaobj, uint index)
{
__context->glEnableVertexArrayAttrib(vaobj.Value, index);
}
/// <summary>Forwards to the native C API <c>void glVertexArrayElementBuffer(GLuint vaobj, GLuint buffer);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexArrayElementBuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayElementBuffer(GlHandle vaobj, GlHandle buffer)
{
__context->glVertexArrayElementBuffer(vaobj.Value, buffer.Value);
}
/// <summary>Forwards to the native C API <c>void glVertexArrayVertexBuffer(GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexArrayVertexBuffer" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayVertexBuffer(GlHandle vaobj, uint bindingIndex, GlHandle buffer, nint offset, int stride)
{
__context->glVertexArrayVertexBuffer(vaobj.Value, bindingIndex, buffer.Value, offset, stride);
}
/// <summary>Forwards to the native C API <c>void glVertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexArrayVertexBuffers" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayVertexBuffers(GlHandle vaobj, uint first, ReadOnlySpan<GlHandle> buffers, nint* offsets, int* strides)
{
fixed (GlHandle* __buffers = buffers)
{
__context->glVertexArrayVertexBuffers(vaobj.Value, first, buffers.Length, (uint*)__buffers, offsets, strides);
}
}
/// <summary>Forwards to the native C API <c>void glVertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexArrayAttribBinding" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayAttributeBinding(GlHandle vaobj, uint attributeIndex, uint bindingIndex)
{
__context->glVertexArrayAttribBinding(vaobj.Value, attributeIndex, bindingIndex);
}
/// <summary>Forwards to the native C API <c>void glVertexArrayAttribFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttribFormat" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayAttributeFormat(GlHandle vaobj, uint attributeIndex, int size, uint type, byte normalized, uint relativeOffset)
{
__context->glVertexArrayAttribFormat(vaobj.Value, attributeIndex, size, type, normalized, relativeOffset);
}
/// <summary>Forwards to the native C API <c>void glVertexArrayAttribIFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttribFormat" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayAttributeIntegerFormat(GlHandle vaobj, uint attributeIndex, int size, uint type, uint relativeOffset)
{
__context->glVertexArrayAttribIFormat(vaobj.Value, attributeIndex, size, type, relativeOffset);
}
/// <summary>Forwards to the native C API <c>void glVertexArrayAttribLFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexAttribFormat" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayAttributeDoubleFormat(GlHandle vaobj, uint attributeIndex, int size, uint type, uint relativeOffset)
{
__context->glVertexArrayAttribLFormat(vaobj.Value, attributeIndex, size, type, relativeOffset);
}
/// <summary>Forwards to the native C API <c>void glVertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glVertexArrayBindingDivisor" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayBindingDivisor(GlHandle vaobj, uint bindingIndex, uint divisor)
{
__context->glVertexArrayBindingDivisor(vaobj.Value, bindingIndex, divisor);
}
/// <summary>Forwards to the native C API <c>void glGetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetVertexArrayiv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetVertexArrayiv(GlHandle vaobj, uint pname, int* param)
{
__context->glGetVertexArrayiv(vaobj.Value, pname, param);
}
/// <summary>Forwards to the native C API <c>void glGetVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint *param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetVertexArrayIndexediv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetVertexArrayIndexediv(GlHandle vaobj, uint index, uint pname, int* param)
{
__context->glGetVertexArrayIndexediv(vaobj.Value, index, pname, param);
}
/// <summary>Forwards to the native C API <c>void glGetVertexArrayIndexed64iv(GLuint vaobj, GLuint index, GLenum pname, GLint64 *param);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetVertexArrayIndexed64iv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetVertexArrayIndexed64iv(GlHandle vaobj, uint index, uint pname, long* param)
{
__context->glGetVertexArrayIndexed64iv(vaobj.Value, index, pname, param);
}
/// <summary>Forwards to the native C API <c>void glCreateSamplers(GLsizei n, GLuint *samplers);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCreateSamplers" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateSamplers(Span<GlHandle> samplers)
{
fixed (GlHandle* __samplers = samplers)
{
__context->glCreateSamplers(samplers.Length, (uint*)__samplers);
}
}
/// <summary>Forwards to the native C API <c>void glCreateProgramPipelines(GLsizei n, GLuint *pipelines);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCreateProgramPipelines" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateProgramPipelines(Span<GlHandle> pipelines)
{
fixed (GlHandle* __pipelines = pipelines)
{
__context->glCreateProgramPipelines(pipelines.Length, (uint*)__pipelines);
}
}
/// <summary>Forwards to the native C API <c>void glCreateQueries(GLenum target, GLsizei n, GLuint *ids);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glCreateQueries" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateQueries(uint target, Span<GlHandle> ids)
{
fixed (GlHandle* __ids = ids)
{
__context->glCreateQueries(target, ids.Length, (uint*)__ids);
}
}
/// <summary>Forwards to the native C API <c>void glGetQueryBufferObjecti64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetQueryBufferObjecti64v" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryBufferObjecti64v(GlHandle id, GlHandle buffer, uint pname, nint offset)
{
__context->glGetQueryBufferObjecti64v(id.Value, buffer.Value, pname, offset);
}
/// <summary>Forwards to the native C API <c>void glGetQueryBufferObjectiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetQueryBufferObjectiv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryBufferObjectiv(GlHandle id, GlHandle buffer, uint pname, nint offset)
{
__context->glGetQueryBufferObjectiv(id.Value, buffer.Value, pname, offset);
}
/// <summary>Forwards to the native C API <c>void glGetQueryBufferObjectui64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetQueryBufferObjectui64v" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryBufferObjectui64v(GlHandle id, GlHandle buffer, uint pname, nint offset)
{
__context->glGetQueryBufferObjectui64v(id.Value, buffer.Value, pname, offset);
}
/// <summary>Forwards to the native C API <c>void glGetQueryBufferObjectuiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetQueryBufferObjectuiv" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryBufferObjectuiv(GlHandle id, GlHandle buffer, uint pname, nint offset)
{
__context->glGetQueryBufferObjectuiv(id.Value, buffer.Value, pname, offset);
}
/// <summary>Forwards to the native C API <c>void glMemoryBarrierByRegion(GLbitfield barriers);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glMemoryBarrierByRegion" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MemoryBarrierByRegion(uint barriers)
{
__context->glMemoryBarrierByRegion(barriers);
}
/// <summary>Forwards to the native C API <c>void glGetTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetTextureSubImage" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTextureSubImage(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, uint format, uint type, int bufSize, void* pixels)
{
__context->glGetTextureSubImage(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize, pixels);
}
/// <summary>Forwards to the native C API <c>void glGetCompressedTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetCompressedTextureSubImage" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetCompressedTextureSubImage(GlHandle texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int bufSize, void* pixels)
{
__context->glGetCompressedTextureSubImage(texture.Value, level, xoffset, yoffset, zoffset, width, height, depth, bufSize, pixels);
}
/// <summary>Forwards to the native C API <c>GLenum glGetGraphicsResetStatus();</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetGraphicsResetStatus" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetGraphicsResetStatus()
{
return __context->glGetGraphicsResetStatus();
}
/// <summary>Forwards to the native C API <c>void glGetnCompressedTexImage(GLenum target, GLint lod, GLsizei bufSize, void *pixels);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetnCompressedTexImage" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetnCompressedTexImage(uint target, int lod, int bufSize, void* pixels)
{
__context->glGetnCompressedTexImage(target, lod, bufSize, pixels);
}
/// <summary>Forwards to the native C API <c>void glGetnTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetnTexImage" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetnTexImage(uint target, int level, uint format, uint type, int bufSize, void* pixels)
{
__context->glGetnTexImage(target, level, format, type, bufSize, pixels);
}
/// <summary>Forwards to the native C API <c>void glGetnUniformdv(GLuint program, GLint location, GLsizei bufSize, GLdouble *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetnUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetUniform(GlHandle program, int location, int bufSize, double* @params)
{
__context->glGetnUniformdv(program.Value, location, bufSize, @params);
}
/// <summary>Forwards to the native C API <c>void glGetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetnUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetUniform(GlHandle program, int location, int bufSize, float* @params)
{
__context->glGetnUniformfv(program.Value, location, bufSize, @params);
}
/// <summary>Forwards to the native C API <c>void glGetnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetnUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetUniform(GlHandle program, int location, int bufSize, int* @params)
{
__context->glGetnUniformiv(program.Value, location, bufSize, @params);
}
/// <summary>Forwards to the native C API <c>void glGetnUniformuiv(GLuint program, GLint location, GLsizei bufSize, GLuint *params);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glGetnUniform" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetUniform(GlHandle program, int location, int bufSize, uint* @params)
{
__context->glGetnUniformuiv(program.Value, location, bufSize, @params);
}
/// <summary>Forwards to the native C API <c>void glReadnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glReadnPixels" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReadnPixels(int x, int y, int width, int height, uint format, uint type, int bufSize, void* data)
{
__context->glReadnPixels(x, y, width, height, format, type, bufSize, data);
}
/// <summary>Forwards to the native C API <c>void glTextureBarrier();</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glTextureBarrier" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureBarrier()
{
__context->glTextureBarrier();
}
}
}
@@ -0,0 +1,49 @@
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 4.6 core-profile forwarding methods.
// </auto-generated>
using StgSharp.Mathematics.Graphics;
using System;
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
/// <summary>Forwards to the native C API <c>void glSpecializeShader(GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glSpecializeShader" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SpecializeShader(GlHandle shader, byte* pEntryPoint, uint numSpecializationConstants, uint* pConstantIndex, uint* pConstantValue)
{
__context->glSpecializeShader(shader.Value, pEntryPoint, numSpecializationConstants, pConstantIndex, pConstantValue);
}
/// <summary>Forwards to the native C API <c>void glMultiDrawArraysIndirectCount(GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glMultiDrawArraysIndirectCount" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawArraysIndirectCount(uint mode, void* indirect, nint drawcount, int maxdrawcount, int stride)
{
__context->glMultiDrawArraysIndirectCount(mode, indirect, drawcount, maxdrawcount, stride);
}
/// <summary>Forwards to the native C API <c>void glMultiDrawElementsIndirectCount(GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glMultiDrawElementsIndirectCount" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawElementsIndirectCount(uint mode, uint type, void* indirect, nint drawcount, int maxdrawcount, int stride)
{
__context->glMultiDrawElementsIndirectCount(mode, type, indirect, drawcount, maxdrawcount, stride);
}
/// <summary>Forwards to the native C API <c>void glPolygonOffsetClamp(GLfloat factor, GLfloat units, GLfloat clamp);</c>.</summary>
/// <seealso href="https://docs.gl/gl4/glPolygonOffsetClamp" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PolygonOffsetClamp(float factor, float units, float clamp)
{
__context->glPolygonOffsetClamp(factor, units, clamp);
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,31 @@
// -----------------------------------------------------------------------------
// file="glConst"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System;
using System.Drawing;
namespace StgSharp.Graphics.OpenGL
{
// rename types in style of glConst
public static class glAttachment
{
public const uint Depth = glConst.DEPTH_ATTACHMENT;
public const uint DepthAndStencil = glConst.DEPTH_STENCIL_ATTACHMENT;
public const uint Stencil = glConst.STENCIL_ATTACHMENT;
public static uint Color(
int i
)
{
ArgumentOutOfRangeException.ThrowIfNegative(i);
return (uint)(glConst.COLOR_ATTACHMENT0 + i);
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,429 @@
// -----------------------------------------------------------------------------
// file="GlFunctionFamilyAnalyzer"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using StgSharp.GenerateGL.Naming;
using StgSharp.GenerateGL.Registry;
namespace StgSharp.GenerateGL.Analysis
{
/// <summary>
/// Builds inspectable function-family candidates without changing generation.
/// </summary>
internal static class GlFunctionFamilyAnalyzer
{
public static GlFunctionFamilyAnalysis Analyze(
GlRegistryModel registry
)
{
ArgumentNullException.ThrowIfNull(registry);
return Analyze(registry, registry.Commands);
}
public static GlFunctionFamilyAnalysis Analyze(
GlRegistryProjection projection
)
{
ArgumentNullException.ThrowIfNull(projection);
return Analyze(projection.Source, projection.Commands);
}
private static GlFunctionFamilyAnalysis Analyze(
GlRegistryModel registry,
IReadOnlyList<GlCommandDefinition> commands
)
{
Dictionary<string, IReadOnlyList<GlCommandDefinition>> commandsByName = commands
.GroupBy(value => value.Name, StringComparer.Ordinal)
.ToDictionary(
value => value.Key,
value => (IReadOnlyList<GlCommandDefinition>)Array.AsReadOnly(
value.ToArray()),
StringComparer.Ordinal);
Dictionary<string, GlFunctionNameShape> shapes =
GlFunctionNameFactorizer.Factor(registry, commands);
Dictionary<string, FamilyBuilder> builders = new Dictionary<string, FamilyBuilder>(
StringComparer.Ordinal);
List<GlFunctionRelation> relations = new List<GlFunctionRelation>();
foreach (GlCommandDefinition command in commands)
{
if (shapes.TryGetValue(command.Name, out GlFunctionNameShape? shape))
{
ReadBuilder(builders, shape.FamilyName).Add(command, shape);
}
}
AddRegistryRelations(commands, commandsByName, shapes, builders, relations);
AddSingleValuePointerRelations(commandsByName, shapes, builders, relations);
GlFunctionFamily[] families = builders.Values
.Where(value => value.Members.Count > 1 || value.Relations.Count != 0)
.Select(value => value.Build())
.OrderBy(value => value.Name, StringComparer.Ordinal)
.ToArray();
HashSet<string> classifiedNames = families
.SelectMany(value => value.Members)
.Select(value => value.Command.Name)
.ToHashSet(StringComparer.Ordinal);
GlCommandDefinition[] unclassified = commands
.Where(value => !classifiedNames.Contains(value.Name))
.OrderBy(value => value.Name, StringComparer.Ordinal)
.ToArray();
return new GlFunctionFamilyAnalysis(
Freeze(families),
Freeze(unclassified),
Freeze(relations));
}
private static void AddRegistryRelations(
IReadOnlyList<GlCommandDefinition> commands,
Dictionary<string, IReadOnlyList<GlCommandDefinition>> commandsByName,
Dictionary<string, GlFunctionNameShape> shapes,
IDictionary<string, FamilyBuilder> builders,
List<GlFunctionRelation> relations
)
{
foreach (GlCommandDefinition command in commands)
{
foreach (GlNamedReference reference in command.VectorEquivalents)
{
bool exists = commandsByName.TryGetValue(
reference.Name,
out IReadOnlyList<GlCommandDefinition>? targets);
GlFunctionRelation relation = new GlFunctionRelation(
command.Name,
reference.Name,
GlFunctionRelationKind.RegistryVectorEquivalent,
exists
? GlFunctionRelationState.Verified
: GlFunctionRelationState.MissingTarget,
exists
? "declared by gl.xml <vecequiv>"
: "gl.xml <vecequiv> target is not registered");
relations.Add(relation);
string familyName = ReadRelationFamilyName(
command.Name,
reference.Name,
shapes);
FamilyBuilder builder = ReadBuilder(builders, familyName);
builder.Add(
command,
shapes.TryGetValue(command.Name, out GlFunctionNameShape? sourceShape)
? sourceShape
: null);
builder.Relations.Add(relation);
if (!exists)
{
builder.Diagnostics.Add(
$"Missing vector-equivalent target '{reference.Name}'.");
continue;
}
foreach (GlCommandDefinition target in targets!)
{
builder.Add(
target,
shapes.TryGetValue(target.Name, out GlFunctionNameShape? targetShape)
? targetShape
: null);
}
}
}
}
private static void AddSingleValuePointerRelations(
Dictionary<string, IReadOnlyList<GlCommandDefinition>> commandsByName,
Dictionary<string, GlFunctionNameShape> shapes,
IDictionary<string, FamilyBuilder> builders,
List<GlFunctionRelation> relations
)
{
HashSet<string> existingPairs = relations
.Select(value => $"{value.SourceName}\0{value.TargetName}")
.ToHashSet(StringComparer.Ordinal);
foreach ((string commandName, GlFunctionNameShape pointerShape) in shapes)
{
if (!pointerShape.IsVectorForm ||
!commandsByName.TryGetValue(
commandName,
out IReadOnlyList<GlCommandDefinition>? pointerCommands))
{
continue;
}
string scalarName = commandName[..^1];
if (!shapes.TryGetValue(scalarName, out GlFunctionNameShape? scalarShape) ||
!commandsByName.TryGetValue(
scalarName,
out IReadOnlyList<GlCommandDefinition>? scalarCommands))
{
continue;
}
foreach (GlCommandDefinition pointer in pointerCommands)
{
if (pointer.Parameters.Count == 0 ||
!string.Equals(pointer.Parameters[^1].Length, "1", StringComparison.Ordinal))
{
continue;
}
foreach (GlCommandDefinition scalar in scalarCommands)
{
if (existingPairs.Contains($"{scalar.Name}\0{pointer.Name}"))
{
continue;
}
bool valid = IsSingleValuePointerPair(scalar, pointer, out string detail);
GlFunctionRelation relation = new GlFunctionRelation(
scalar.Name,
pointer.Name,
GlFunctionRelationKind.InferredSingleValuePointer,
valid
? GlFunctionRelationState.Verified
: GlFunctionRelationState.Rejected,
detail);
relations.Add(relation);
FamilyBuilder builder = ReadBuilder(builders, pointerShape.FamilyName);
builder.Add(scalar, scalarShape);
builder.Add(pointer, pointerShape);
builder.Relations.Add(relation);
if (!valid)
{
builder.Diagnostics.Add(
$"Rejected scalar/pointer pair {scalar.Name} -> {pointer.Name}: " +
detail);
}
}
}
}
}
private static bool IsSingleValuePointerPair(
GlCommandDefinition scalar,
GlCommandDefinition pointer,
out string detail
)
{
if (!string.Equals(
scalar.Return.TypeName,
pointer.Return.TypeName,
StringComparison.Ordinal) ||
scalar.Parameters.Count != pointer.Parameters.Count)
{
detail = "return type or parameter count differs";
return false;
}
int lastIndex = scalar.Parameters.Count - 1;
for (int index = 0; index < lastIndex; index++)
{
if (!HaveEquivalentParameterTypes(
scalar.Parameters[index],
pointer.Parameters[index]))
{
detail = $"parameter {index + 1} differs";
return false;
}
}
GlParameterDefinition scalarValue = scalar.Parameters[lastIndex];
GlParameterDefinition pointerValue = pointer.Parameters[lastIndex];
if (!string.Equals(
scalarValue.TypeName,
pointerValue.TypeName,
StringComparison.Ordinal) ||
scalarValue.DeclarationText.Contains('*', StringComparison.Ordinal) ||
!pointerValue.DeclarationText.Contains('*', StringComparison.Ordinal) ||
!pointerValue.DeclarationText.TrimStart().StartsWith(
"const ",
StringComparison.Ordinal) ||
!string.Equals(pointerValue.Length, "1", StringComparison.Ordinal))
{
detail = "last parameter is not a matching T / const T* len=1 pair";
return false;
}
detail = "verified T / const T* len=1 pair";
return true;
}
private static bool HaveEquivalentParameterTypes(
GlParameterDefinition left,
GlParameterDefinition right
)
{
return string.Equals(left.TypeName, right.TypeName, StringComparison.Ordinal) &&
left.DeclarationText.Contains('*', StringComparison.Ordinal) ==
right.DeclarationText.Contains('*', StringComparison.Ordinal);
}
private static string ReadRelationFamilyName(
string sourceName,
string targetName,
Dictionary<string, GlFunctionNameShape> shapes
)
{
if (shapes.TryGetValue(sourceName, out GlFunctionNameShape? sourceShape))
{
return sourceShape.FamilyName;
}
if (shapes.TryGetValue(targetName, out GlFunctionNameShape? targetShape))
{
return targetShape.FamilyName;
}
string source = RemoveGlPrefix(sourceName);
string target = RemoveGlPrefix(targetName);
if (target.EndsWith('v') &&
string.Equals(source, target[..^1], StringComparison.Ordinal))
{
return CSharpIdentifierPolicy.NormalizeMemberName(source);
}
int length = 0;
int maximum = Math.Min(source.Length, target.Length);
while (length < maximum && source[length] == target[length])
{
length++;
}
string familyName = length == 0 ? source : source[..length].TrimEnd('_');
return CSharpIdentifierPolicy.NormalizeMemberName(familyName);
}
private static string RemoveGlPrefix(
string name
)
{
return name.StartsWith("gl", StringComparison.Ordinal) && name.Length > 2
? name[2..]
: name;
}
private static FamilyBuilder ReadBuilder(
IDictionary<string, FamilyBuilder> builders,
string familyName
)
{
if (!builders.TryGetValue(familyName, out FamilyBuilder? builder))
{
builder = new FamilyBuilder(familyName);
builders.Add(familyName, builder);
}
return builder;
}
private static ReadOnlyCollection<T> Freeze<T>(
IEnumerable<T> values
)
{
return Array.AsReadOnly(values.ToArray());
}
private sealed class FamilyBuilder
{
private readonly Dictionary<string, GlFunctionFamilyMember> _members = new Dictionary<string, GlFunctionFamilyMember>(
StringComparer.Ordinal);
public FamilyBuilder(
string name
)
{
Name = name;
}
public string Name { get; }
public Dictionary<string, GlFunctionFamilyMember>.ValueCollection Members =>
_members.Values;
public List<GlFunctionRelation> Relations { get; } = new List<GlFunctionRelation>();
public List<string> Diagnostics { get; } = new List<string>();
public void Add(
GlCommandDefinition command,
GlFunctionNameShape? shape
)
{
_members.TryAdd(
command.Name,
new GlFunctionFamilyMember(command, shape));
}
public GlFunctionFamily Build()
{
GlFunctionFamilyMember[] members = _members.Values
.OrderBy(value => value.Command.Name, StringComparer.Ordinal)
.ToArray();
string[] diagnostics = Diagnostics
.Distinct(StringComparer.Ordinal)
.OrderBy(value => value, StringComparer.Ordinal)
.ToArray();
return new GlFunctionFamily(
Name,
Freeze(members),
Freeze(Relations.Distinct().ToArray()),
Freeze(diagnostics),
ReadShapeNamePolicy(members));
}
private static GlFunctionShapeNamePolicy ReadShapeNamePolicy(
IReadOnlyCollection<GlFunctionFamilyMember> members
)
{
GlFunctionFamilyMember[] scalarMembers = members
.Where(
value => value.NameShape is
{ IsVectorForm: false, Shape: not null })
.ToArray();
if (scalarMembers.Select(value => value.NameShape!.Shape)
.Distinct(StringComparer.Ordinal)
.Count() < 2)
{
return GlFunctionShapeNamePolicy.NotApplicable;
}
bool collision = scalarMembers
.GroupBy(ReadNativeSignature, StringComparer.Ordinal)
.Any(group => group.Select(value => value.NameShape!.Shape)
.Distinct(StringComparer.Ordinal)
.Count() > 1);
return collision
? GlFunctionShapeNamePolicy.MustRetain
: GlFunctionShapeNamePolicy.CanRemove;
}
private static string ReadNativeSignature(
GlFunctionFamilyMember member
)
{
GlCommandDefinition command = member.Command;
return $"{command.Return.TypeName}:" + string.Join(
",",
command.Parameters.Select(
value => $"{value.TypeName}:{value.DeclarationText.Contains('*', StringComparison.Ordinal)}"));
}
}
}
}
@@ -0,0 +1,68 @@
// -----------------------------------------------------------------------------
// file="GlFunctionFamilyModel"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System.Collections.Generic;
using StgSharp.GenerateGL.Registry;
namespace StgSharp.GenerateGL.Analysis
{
internal sealed record GlFunctionNameShape(
string FamilyName,
string? Shape,
int? Columns,
int? Rows,
string TypeSuffix,
bool IsVectorForm
);
internal sealed record GlFunctionFamilyMember(
GlCommandDefinition Command,
GlFunctionNameShape? NameShape
);
internal sealed record GlFunctionRelation(
string SourceName,
string TargetName,
GlFunctionRelationKind Kind,
GlFunctionRelationState State,
string Detail
);
internal sealed record GlFunctionFamily(
string Name,
IReadOnlyList<GlFunctionFamilyMember> Members,
IReadOnlyList<GlFunctionRelation> Relations,
IReadOnlyList<string> Diagnostics,
GlFunctionShapeNamePolicy ShapeNamePolicy
);
internal sealed record GlFunctionFamilyAnalysis(
IReadOnlyList<GlFunctionFamily> Families,
IReadOnlyList<GlCommandDefinition> UnclassifiedCommands,
IReadOnlyList<GlFunctionRelation> Relations
);
internal enum GlFunctionRelationKind
{
RegistryVectorEquivalent,
InferredSingleValuePointer,
}
internal enum GlFunctionRelationState
{
Verified,
MissingTarget,
Rejected,
}
internal enum GlFunctionShapeNamePolicy
{
NotApplicable,
CanRemove,
MustRetain,
}
}
@@ -0,0 +1,472 @@
// -----------------------------------------------------------------------------
// file="GlFunctionNameFactorizer"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using StgSharp.GenerateGL.Naming;
using StgSharp.GenerateGL.Registry;
namespace StgSharp.GenerateGL.Analysis
{
/// <summary>
/// Factors command-name alternatives by their common prefix and interprets only the
/// remaining suffix as overload axes.
/// </summary>
internal static class GlFunctionNameFactorizer
{
private static readonly string[] _typeSuffixes =
{
"ui64",
"i64",
"ui",
"ub",
"us",
"b",
"s",
"i",
"f",
"d",
"h",
"x",
};
public static Dictionary<string, GlFunctionNameShape> Factor(
GlRegistryModel registry,
IReadOnlyList<GlCommandDefinition> commands
)
{
ArgumentNullException.ThrowIfNull(registry);
ArgumentNullException.ThrowIfNull(commands);
string[] vendorSuffixes = ReadVendorSuffixes(registry);
NameEntry[] entries = commands
.Select(
command => new NameEntry(
command,
command.Name,
ReadCoreName(command.Name, vendorSuffixes)))
.ToArray();
TrieNode root = new TrieNode(string.Empty);
for (int index = 0; index < entries.Length; index++)
{
Add(root, entries[index].CoreName, index);
}
List<FactorCandidate>[] candidatesByEntry = Enumerable.Range(0, entries.Length)
.Select(_ => new List<FactorCandidate>())
.ToArray();
CollectCandidates(root, entries, candidatesByEntry);
Dictionary<string, GlFunctionNameShape> result = new Dictionary<string, GlFunctionNameShape>(
StringComparer.Ordinal);
for (int index = 0; index < entries.Length; index++)
{
FactorCandidate? candidate = candidatesByEntry[index]
.OrderByDescending(value => value.DistinctVariantCount)
.ThenByDescending(value => value.MemberCount)
.ThenBy(value => value.FamilyName.Length)
.FirstOrDefault();
if (candidate is null ||
!candidate.Shapes.TryGetValue(index, out GlFunctionNameShape? shape))
{
continue;
}
result.TryAdd(entries[index].CommandName, shape);
}
AddFixedVectorPairs(result, commands);
return result;
}
private static void AddFixedVectorPairs(
Dictionary<string, GlFunctionNameShape> shapes,
IReadOnlyList<GlCommandDefinition> commands
)
{
Dictionary<string, GlCommandDefinition> commandsByName = commands.ToDictionary(
value => value.Name,
StringComparer.Ordinal);
foreach (GlCommandDefinition vector in commands)
{
if (!vector.Name.EndsWith('v') ||
shapes.ContainsKey(vector.Name) ||
vector.Parameters.Count == 0 ||
!int.TryParse(vector.Parameters[^1].Length, out int componentCount) ||
componentCount < 2)
{
continue;
}
string scalarName = vector.Name[..^1];
if (shapes.ContainsKey(scalarName) ||
!commandsByName.TryGetValue(
scalarName,
out GlCommandDefinition? scalar) ||
!IsFixedVectorPair(scalar, vector, componentCount))
{
continue;
}
string familyName = CSharpIdentifierPolicy.NormalizeMemberName(
scalarName.StartsWith("gl", StringComparison.Ordinal) &&
scalarName.Length > 2
? scalarName[2..]
: scalarName);
shapes.Add(
scalarName,
new GlFunctionNameShape(
familyName,
null,
null,
null,
string.Empty,
false));
shapes.Add(
vector.Name,
new GlFunctionNameShape(
familyName,
null,
null,
null,
string.Empty,
true));
}
}
private static bool IsFixedVectorPair(
GlCommandDefinition scalar,
GlCommandDefinition vector,
int componentCount
)
{
if (!string.Equals(
scalar.Return.TypeName,
vector.Return.TypeName,
StringComparison.Ordinal) ||
scalar.Parameters.Count != vector.Parameters.Count - 1 + componentCount)
{
return false;
}
int prefixCount = vector.Parameters.Count - 1;
for (int index = 0; index < prefixCount; index++)
{
if (!HaveEquivalentScalarTypes(
scalar.Parameters[index].TypeName,
vector.Parameters[index].TypeName) ||
scalar.Parameters[index].DeclarationText.Contains('*', StringComparison.Ordinal) !=
vector.Parameters[index].DeclarationText.Contains('*', StringComparison.Ordinal))
{
return false;
}
}
GlParameterDefinition vectorValue = vector.Parameters[^1];
if (!vectorValue.DeclarationText.Contains('*', StringComparison.Ordinal))
{
return false;
}
for (int index = prefixCount; index < scalar.Parameters.Count; index++)
{
if (!HaveEquivalentScalarTypes(
scalar.Parameters[index].TypeName,
vectorValue.TypeName) ||
scalar.Parameters[index].DeclarationText.Contains('*', StringComparison.Ordinal))
{
return false;
}
}
return true;
}
private static bool HaveEquivalentScalarTypes(
string? left,
string? right
)
{
if (string.Equals(left, right, StringComparison.Ordinal))
{
return true;
}
return left is "GLint" or "GLsizei" &&
right is "GLint" or "GLsizei";
}
private static List<int> CollectCandidates(
TrieNode node,
IReadOnlyList<NameEntry> entries,
IReadOnlyList<List<FactorCandidate>> candidatesByEntry
)
{
List<int> descendants = new List<int>(node.Terminals);
foreach (TrieNode child in node.Children.Values)
{
descendants.AddRange(CollectCandidates(child, entries, candidatesByEntry));
}
if (node.Prefix.Length == 0 || descendants.Count < 2)
{
return descendants;
}
Dictionary<int, GlFunctionNameShape> shapes = new Dictionary<int, GlFunctionNameShape>();
foreach (int index in descendants)
{
string coreName = entries[index].CoreName;
if (coreName.Length <= node.Prefix.Length ||
!TryParseVariantSuffix(
coreName[node.Prefix.Length..],
node.Prefix,
entries[index].Command,
out GlFunctionNameShape? shape))
{
continue;
}
shapes.Add(index, shape!);
}
int distinctVariantCount = shapes.Keys
.Select(index => entries[index].CoreName)
.Distinct(StringComparer.Ordinal)
.Count();
if (distinctVariantCount < 2)
{
return descendants;
}
FactorCandidate candidate = new FactorCandidate(
node.Prefix,
shapes,
distinctVariantCount);
foreach (int index in shapes.Keys)
{
candidatesByEntry[index].Add(candidate);
}
return descendants;
}
private static bool TryParseVariantSuffix(
string suffix,
string familyName,
GlCommandDefinition command,
out GlFunctionNameShape? shape
)
{
bool isVectorForm = suffix.EndsWith('v');
if (isVectorForm)
{
suffix = suffix[..^1];
}
string? typeSuffix = null;
foreach (string candidate in _typeSuffixes)
{
if (suffix.EndsWith(candidate, StringComparison.Ordinal))
{
typeSuffix = candidate;
suffix = suffix[..^candidate.Length];
break;
}
}
if (typeSuffix is null ||
!IsTypeSuffixConsistent(command, typeSuffix) ||
!TryParseShape(
suffix,
out string? shapeText,
out int? columns,
out int? rows))
{
shape = null;
return false;
}
shape = new GlFunctionNameShape(
CSharpIdentifierPolicy.NormalizeMemberName(familyName),
shapeText,
columns,
rows,
typeSuffix,
isVectorForm);
return true;
}
private static bool IsTypeSuffixConsistent(
GlCommandDefinition command,
string typeSuffix
)
{
string? glType = typeSuffix switch
{
"b" => "GLbyte",
"ub" => "GLubyte",
"s" => "GLshort",
"us" => "GLushort",
"i" => "GLint",
"ui" => "GLuint",
"i64" => "GLint64",
"ui64" => "GLuint64",
"f" => "GLfloat",
"d" => "GLdouble",
"h" => "GLhalf",
"x" => "GLfixed",
_ => null,
};
if (glType is null)
{
return false;
}
return string.Equals(command.Return.TypeName, glType, StringComparison.Ordinal) ||
command.Parameters.Any(
value => string.Equals(
value.TypeName,
glType,
StringComparison.Ordinal));
}
private static bool TryParseShape(
string value,
out string? shape,
out int? columns,
out int? rows
)
{
if (value.Length == 0)
{
shape = null;
columns = null;
rows = null;
return true;
}
if (value.Length == 1 && value[0] is >= '1' and <= '4')
{
shape = value;
columns = value[0] - '0';
rows = 1;
return true;
}
if (value.Length == 3 &&
value[0] is >= '2' and <= '4' &&
value[1] == 'x' &&
value[2] is >= '2' and <= '4')
{
shape = value;
columns = value[0] - '0';
rows = value[2] - '0';
return true;
}
shape = null;
columns = null;
rows = null;
return false;
}
private static void Add(
TrieNode root,
string value,
int entryIndex
)
{
TrieNode current = root;
foreach (char character in value)
{
if (!current.Children.TryGetValue(character, out TrieNode? child))
{
child = new TrieNode(current.Prefix + character);
current.Children.Add(character, child);
}
current = child;
}
current.Terminals.Add(entryIndex);
}
private static string ReadCoreName(
string commandName,
IReadOnlyList<string> vendorSuffixes
)
{
string name = commandName.StartsWith("gl", StringComparison.Ordinal) &&
commandName.Length > 2
? commandName[2..]
: commandName;
foreach (string vendorSuffix in vendorSuffixes)
{
if (name.Length > vendorSuffix.Length && name.EndsWith(
vendorSuffix,
StringComparison.Ordinal))
{
return name[..^vendorSuffix.Length];
}
}
return name;
}
private static string[] ReadVendorSuffixes(
GlRegistryModel registry
)
{
return registry.Extensions
.Select(value => value.Name.Split('_', StringSplitOptions.RemoveEmptyEntries))
.Where(value => value.Length > 2 && value[0] == "GL")
.Select(value => value[1])
.Where(value => value.All(character => char.IsUpper(character) || char.IsDigit(character)))
.Distinct(StringComparer.Ordinal)
.OrderByDescending(value => value.Length)
.ThenBy(value => value, StringComparer.Ordinal)
.ToArray();
}
private sealed record NameEntry(
GlCommandDefinition Command,
string CommandName,
string CoreName
);
private sealed record FactorCandidate(
string FamilyName,
IReadOnlyDictionary<int, GlFunctionNameShape> Shapes,
int DistinctVariantCount
)
{
public int MemberCount => Shapes.Count;
}
private sealed class TrieNode
{
public TrieNode(
string prefix
)
{
Prefix = prefix;
}
public string Prefix { get; }
public Dictionary<char, TrieNode> Children { get; } = new Dictionary<char, TrieNode>();
public List<int> Terminals { get; } = new List<int>();
}
}
}
@@ -0,0 +1,556 @@
// -----------------------------------------------------------------------------
// file="FunctionFamilyCli"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using StgSharp.GenerateGL.Analysis;
namespace StgSharp.GenerateGL
{
/// <summary>
/// Presents the function-family analysis without affecting generation.
/// </summary>
internal static class FunctionFamilyCli
{
private const int ShowAllResults = int.MaxValue;
private const int QueryErrorExitCode = 1;
private const int SuccessExitCode = 0;
private const int UsageErrorExitCode = 2;
public static int Execute(
GlFunctionFamilyAnalysis analysis,
IReadOnlyList<string> arguments
)
{
ArgumentNullException.ThrowIfNull(analysis);
ArgumentNullException.ThrowIfNull(arguments);
if (arguments.Count == 0)
{
WriteHelp();
return SuccessExitCode;
}
string command = arguments[0].ToUpperInvariant();
string[] queryArguments = arguments.Skip(1).ToArray();
return command switch
{
"SUMMARY" => QuerySummary(analysis, queryArguments),
"LIST" or "LS" => QueryList(analysis, queryArguments),
"SHOW" or "INFO" => QueryShow(analysis, queryArguments),
"RELATIONS" or "PAIRS" => QueryRelations(analysis, queryArguments),
"UNRESOLVED" or "UNCLASSIFIED" => QueryUnclassified(
analysis,
queryArguments),
"CONFLICTS" or "CONSTRAINTS" => QueryConstraints(
analysis,
queryArguments),
"HELP" or "?" => WriteHelpResult(queryArguments),
_ => WriteUsageError($"Unknown family command '{arguments[0]}'."),
};
}
public static void WriteHelp()
{
Console.WriteLine("Function-family analysis commands:");
Console.WriteLine(" families summary");
Console.WriteLine(" families list [filter] [--showcount <n>]");
Console.WriteLine(" families show <family>");
Console.WriteLine(" families relations [filter] [--showcount <n>]");
Console.WriteLine(" families unresolved [filter] [--showcount <n>]");
Console.WriteLine(" families conflicts [filter] [--showcount <n>]");
}
private static int QuerySummary(
GlFunctionFamilyAnalysis analysis,
string[] arguments
)
{
if (arguments.Length != 0)
{
return WriteUsageError("families summary does not accept arguments.");
}
Console.WriteLine("Function-family analysis");
WriteProperty("families", analysis.Families.Count);
WriteProperty(
"classified commands",
analysis.Families.SelectMany(value => value.Members)
.Select(value => value.Command.Name)
.Distinct(StringComparer.Ordinal)
.Count());
WriteProperty("unclassified commands", analysis.UnclassifiedCommands.Count);
WriteProperty("relations", analysis.Relations.Count);
WriteProperty(
"registry vector relations",
analysis.Relations.Count(
value => value.Kind == GlFunctionRelationKind.RegistryVectorEquivalent));
WriteProperty(
"inferred len=1 relations",
analysis.Relations.Count(
value => value.Kind == GlFunctionRelationKind.InferredSingleValuePointer));
WriteProperty(
"verified relations",
analysis.Relations.Count(
value => value.State == GlFunctionRelationState.Verified));
WriteProperty(
"relations requiring review",
analysis.Relations.Count(
value => value.State != GlFunctionRelationState.Verified));
WriteProperty(
"shape suffix must remain",
analysis.Families.Count(
value => value.ShapeNamePolicy == GlFunctionShapeNamePolicy.MustRetain));
return SuccessExitCode;
}
private static int QueryList(
GlFunctionFamilyAnalysis analysis,
IReadOnlyList<string> arguments
)
{
if (!TryReadFilterOptions(
arguments,
out string? filter,
out int limit,
out string? error))
{
return WriteUsageError(error);
}
GlFunctionFamily[] families = FilterFamilies(analysis, filter).ToArray();
if (families.Length == 0)
{
Console.Error.WriteLine(
filter is null
? "No function families were recognized."
: $"No function families contain '{filter}'.");
return QueryErrorExitCode;
}
int displayedCount = Math.Min(families.Length, limit);
for (int index = 0; index < displayedCount; index++)
{
GlFunctionFamily family = families[index];
Console.WriteLine($"[{index + 1}] {family.Name}");
WriteProperty("members", family.Members.Count);
WriteProperty(
"shapes",
JoinDistinct(
family.Members.Select(value => value.NameShape?.Shape)));
WriteProperty(
"types",
JoinDistinct(
family.Members.Select(value => value.NameShape?.TypeSuffix)));
WriteProperty(
"forms",
JoinDistinct(
family.Members.Where(value => value.NameShape is not null)
.Select(
value => value.NameShape!.IsVectorForm
? "pointer"
: "scalar")));
WriteProperty("relations", family.Relations.Count);
WriteProperty("shape name", ReadShapePolicy(family.ShapeNamePolicy));
}
WriteTruncation(families.Length, displayedCount);
return SuccessExitCode;
}
private static int QueryShow(
GlFunctionFamilyAnalysis analysis,
string[] arguments
)
{
if (arguments.Length != 1)
{
return WriteUsageError("families show requires one exact family name.");
}
GlFunctionFamily? family = analysis.Families.FirstOrDefault(
value => string.Equals(
value.Name,
arguments[0],
StringComparison.OrdinalIgnoreCase));
if (family is null)
{
Console.Error.WriteLine($"No function family named '{arguments[0]}'.");
Console.Error.WriteLine($"Try: families list {arguments[0]}");
return QueryErrorExitCode;
}
Console.WriteLine($"function family: {family.Name}");
WriteProperty("members", family.Members.Count);
WriteProperty("shape name", ReadShapePolicy(family.ShapeNamePolicy));
for (int index = 0; index < family.Members.Count; index++)
{
GlFunctionFamilyMember member = family.Members[index];
Console.WriteLine($" [{index + 1}] {member.Command.Name}");
if (member.NameShape is not null)
{
if (member.NameShape.Shape is not null)
{
WriteIndentedProperty("shape", member.NameShape.Shape, 8);
}
WriteIndentedProperty(
"type suffix",
string.IsNullOrWhiteSpace(member.NameShape.TypeSuffix)
? "-"
: member.NameShape.TypeSuffix,
8);
WriteIndentedProperty(
"form",
member.NameShape.IsVectorForm ? "pointer" : "scalar",
8);
}
WriteIndentedProperty(
"parameters",
ReadParameterList(member.Command),
8);
}
WriteRelations(family.Relations);
if (family.Diagnostics.Count != 0)
{
Console.WriteLine(" diagnostics:");
foreach (string diagnostic in family.Diagnostics)
{
Console.WriteLine($" - {diagnostic}");
}
}
return SuccessExitCode;
}
private static int QueryRelations(
GlFunctionFamilyAnalysis analysis,
IReadOnlyList<string> arguments
)
{
if (!TryReadFilterOptions(
arguments,
out string? filter,
out int limit,
out string? error))
{
return WriteUsageError(error);
}
GlFunctionRelation[] relations = analysis.Relations
.Where(
value => filter is null ||
value.SourceName.Contains(
filter,
StringComparison.OrdinalIgnoreCase) ||
value.TargetName.Contains(
filter,
StringComparison.OrdinalIgnoreCase))
.OrderBy(value => value.SourceName, StringComparer.Ordinal)
.ThenBy(value => value.TargetName, StringComparer.Ordinal)
.ToArray();
if (relations.Length == 0)
{
Console.Error.WriteLine(
filter is null
? "No function relations were recognized."
: $"No function relations contain '{filter}'.");
return QueryErrorExitCode;
}
int displayedCount = Math.Min(relations.Length, limit);
for (int index = 0; index < displayedCount; index++)
{
WriteRelation(index + 1, relations[index]);
}
WriteTruncation(relations.Length, displayedCount);
return SuccessExitCode;
}
private static int QueryUnclassified(
GlFunctionFamilyAnalysis analysis,
IReadOnlyList<string> arguments
)
{
if (!TryReadFilterOptions(
arguments,
out string? filter,
out int limit,
out string? error))
{
return WriteUsageError(error);
}
string[] commands = analysis.UnclassifiedCommands
.Select(value => value.Name)
.Where(
value => filter is null || value.Contains(
filter,
StringComparison.OrdinalIgnoreCase))
.ToArray();
if (commands.Length == 0)
{
Console.Error.WriteLine(
filter is null
? "Every command belongs to a candidate family."
: $"No unclassified commands contain '{filter}'.");
return QueryErrorExitCode;
}
int displayedCount = Math.Min(commands.Length, limit);
for (int index = 0; index < displayedCount; index++)
{
Console.WriteLine($"[{index + 1}] {commands[index]}");
}
WriteTruncation(commands.Length, displayedCount);
return SuccessExitCode;
}
private static int QueryConstraints(
GlFunctionFamilyAnalysis analysis,
IReadOnlyList<string> arguments
)
{
if (!TryReadFilterOptions(
arguments,
out string? filter,
out int limit,
out string? error))
{
return WriteUsageError(error);
}
GlFunctionFamily[] families = FilterFamilies(analysis, filter)
.Where(
value => value.ShapeNamePolicy == GlFunctionShapeNamePolicy.MustRetain ||
value.Diagnostics.Count != 0 ||
value.Relations.Any(
relation => relation.State != GlFunctionRelationState.Verified))
.ToArray();
if (families.Length == 0)
{
Console.Error.WriteLine(
filter is null
? "No family constraints require review."
: $"No constrained families contain '{filter}'.");
return QueryErrorExitCode;
}
int displayedCount = Math.Min(families.Length, limit);
for (int index = 0; index < displayedCount; index++)
{
GlFunctionFamily family = families[index];
Console.WriteLine($"[{index + 1}] {family.Name}");
if (family.ShapeNamePolicy == GlFunctionShapeNamePolicy.MustRetain)
{
WriteProperty(
"constraint",
"shape suffix must remain because normalized signatures collide");
}
foreach (string diagnostic in family.Diagnostics)
{
WriteProperty("diagnostic", diagnostic);
}
}
WriteTruncation(families.Length, displayedCount);
return SuccessExitCode;
}
private static IEnumerable<GlFunctionFamily> FilterFamilies(
GlFunctionFamilyAnalysis analysis,
string? filter
)
{
return analysis.Families.Where(
value => filter is null || value.Name.Contains(
filter,
StringComparison.OrdinalIgnoreCase));
}
private static bool TryReadFilterOptions(
IReadOnlyList<string> arguments,
out string? filter,
out int limit,
out string? error
)
{
filter = null;
limit = ShowAllResults;
int index = 0;
if (index < arguments.Count && !arguments[index].StartsWith(
"--",
StringComparison.Ordinal))
{
filter = arguments[index++];
}
while (index < arguments.Count)
{
string argument = arguments[index++];
if ((argument == "--showcount" || argument == "--limit") &&
index < arguments.Count && int.TryParse(
arguments[index++],
NumberStyles.None,
CultureInfo.InvariantCulture,
out limit) && limit > 0)
{
continue;
}
error = $"Unknown or invalid family option '{argument}'.";
return false;
}
error = null;
return true;
}
private static string ReadParameterList(
Registry.GlCommandDefinition command
)
{
return string.Join(
", ",
command.Parameters.Select(value => value.DeclarationText));
}
private static void WriteRelations(
IReadOnlyList<GlFunctionRelation> relations
)
{
if (relations.Count == 0)
{
return;
}
Console.WriteLine(" relations:");
for (int index = 0; index < relations.Count; index++)
{
WriteRelation(index + 1, relations[index], 4);
}
}
private static void WriteRelation(
int index,
GlFunctionRelation relation,
int indentation = 0
)
{
string prefix = new string(' ', indentation);
Console.WriteLine(
$"{prefix}[{index}] {relation.SourceName} -> {relation.TargetName}");
WriteIndentedProperty(
"source",
relation.Kind == GlFunctionRelationKind.RegistryVectorEquivalent
? "gl.xml vecequiv"
: "inferred len=1 pair",
indentation + 4);
WriteIndentedProperty(
"state",
ReadRelationState(relation.State),
indentation + 4);
WriteIndentedProperty("detail", relation.Detail, indentation + 4);
}
private static string ReadShapePolicy(
GlFunctionShapeNamePolicy policy
)
{
return policy switch
{
GlFunctionShapeNamePolicy.NotApplicable => "not applicable",
GlFunctionShapeNamePolicy.CanRemove => "may be removed",
GlFunctionShapeNamePolicy.MustRetain => "must remain",
_ => throw new ArgumentOutOfRangeException(nameof(policy)),
};
}
private static string ReadRelationState(
GlFunctionRelationState state
)
{
return state switch
{
GlFunctionRelationState.Verified => "verified",
GlFunctionRelationState.MissingTarget => "missing target",
GlFunctionRelationState.Rejected => "rejected",
_ => throw new ArgumentOutOfRangeException(nameof(state)),
};
}
private static string JoinDistinct(
IEnumerable<string?> values
)
{
string[] distinct = values.Where(value => !string.IsNullOrWhiteSpace(value))
.Select(value => value!)
.Distinct(StringComparer.Ordinal)
.OrderBy(value => value, StringComparer.Ordinal)
.ToArray();
return distinct.Length == 0 ? "-" : string.Join(", ", distinct);
}
private static int WriteHelpResult(
string[] arguments
)
{
if (arguments.Length != 0)
{
return WriteUsageError("families help does not accept arguments.");
}
WriteHelp();
return SuccessExitCode;
}
private static int WriteUsageError(
string? error
)
{
Console.Error.WriteLine($"error: {error}");
return UsageErrorExitCode;
}
private static void WriteProperty(
string name,
object value
)
{
WriteIndentedProperty(name, value, 2);
}
private static void WriteIndentedProperty(
string name,
object value,
int indentation
)
{
Console.WriteLine($"{new string(' ', indentation)}{name}: {value}");
}
private static void WriteTruncation(
int totalCount,
int displayedCount
)
{
if (displayedCount != totalCount)
{
Console.WriteLine($"... {totalCount - displayedCount} more result(s)");
}
}
}
}
+149 -11
View File
@@ -9,6 +9,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using StgSharp.GenerateGL.Generation;
using StgSharp.GenerateGL.Registry;
@@ -23,14 +24,15 @@ namespace StgSharp.GenerateGL
private const int QueryErrorExitCode = 1;
private const int SuccessExitCode = 0;
private const int UsageErrorExitCode = 2;
private const string GeneratedFileMarker = "// <auto-generated>";
public static int Generate(
GlRegistryModel registry,
GlRegistryProjection projection,
IReadOnlyList<string> arguments,
out GeneratedFileSet? generatedFiles
)
{
ArgumentNullException.ThrowIfNull(registry);
ArgumentNullException.ThrowIfNull(projection);
ArgumentNullException.ThrowIfNull(arguments);
generatedFiles = null;
@@ -40,17 +42,24 @@ namespace StgSharp.GenerateGL
return SuccessExitCode;
}
if (arguments.Count != 0)
if (arguments.Count > 1)
{
Console.Error.WriteLine(
$"error: unknown generate option '{arguments[0]}'.");
Console.Error.WriteLine("error: generate accepts at most one output directory.");
Console.Error.WriteLine("Run 'generate --help' for command information.");
return UsageErrorExitCode;
}
string? outputDirectory = arguments.Count == 1 ? arguments[0] : null;
string? resolvedOutputDirectory = null;
try
{
generatedFiles = OpenGlGenerator.Generate(registry);
generatedFiles = OpenGlGenerator.Generate(projection);
if (outputDirectory is not null)
{
resolvedOutputDirectory = WriteGeneratedFiles(
generatedFiles,
outputDirectory);
}
}
catch (InvalidDataException exception)
{
@@ -62,14 +71,136 @@ namespace StgSharp.GenerateGL
Console.Error.WriteLine($"error: {exception.Message}");
return QueryErrorExitCode;
}
catch (UnauthorizedAccessException exception)
{
Console.Error.WriteLine($"error: {exception.Message}");
return QueryErrorExitCode;
}
catch (IOException exception)
{
Console.Error.WriteLine($"error: {exception.Message}");
return QueryErrorExitCode;
}
catch (ArgumentException exception)
{
Console.Error.WriteLine($"error: {exception.Message}");
return QueryErrorExitCode;
}
catch (NotSupportedException exception)
{
Console.Error.WriteLine($"error: {exception.Message}");
return QueryErrorExitCode;
}
Console.WriteLine(
$"Generated {generatedFiles.Files.Count} file(s) in memory.");
Console.WriteLine("Use 'list files' and 'preview <filename>' to inspect them.");
Console.WriteLine("No files were written to disk.");
Console.WriteLine(
resolvedOutputDirectory is null
? "No files were written to disk."
: $"Wrote {generatedFiles.Files.Count} file(s) to " +
$"'{resolvedOutputDirectory}'.");
return SuccessExitCode;
}
private static string WriteGeneratedFiles(
GeneratedFileSet files,
string outputDirectory
)
{
ArgumentNullException.ThrowIfNull(files);
ArgumentException.ThrowIfNullOrWhiteSpace(outputDirectory);
string directory = Path.TrimEndingDirectorySeparator(
Path.GetFullPath(outputDirectory));
if (!Directory.Exists(directory))
{
throw new DirectoryNotFoundException(
$"Output directory '{directory}' does not exist.");
}
StringComparison pathComparison = OperatingSystem.IsWindows()
? StringComparison.OrdinalIgnoreCase
: StringComparison.Ordinal;
List<StagedGeneratedFile> stagedFiles = new List<StagedGeneratedFile>(
files.Files.Count);
try
{
foreach (GeneratedFile file in files.Files)
{
string fileName = Path.GetFileName(file.Name);
if (!string.Equals(fileName, file.Name, StringComparison.Ordinal) ||
string.IsNullOrWhiteSpace(fileName))
{
throw new InvalidDataException(
$"Generated file name '{file.Name}' is not a plain file name.");
}
string targetPath = Path.GetFullPath(Path.Combine(directory, fileName));
if (!string.Equals(
Path.GetDirectoryName(targetPath),
directory,
pathComparison))
{
throw new InvalidDataException(
$"Generated file '{file.Name}' escapes the output directory.");
}
EnsureTargetCanBeReplaced(targetPath);
string temporaryPath = Path.Combine(
directory,
$".{fileName}.{Guid.NewGuid():N}.tmp");
using (FileStream stream = new FileStream(
temporaryPath,
FileMode.CreateNew,
FileAccess.Write,
FileShare.None))
using (StreamWriter writer = new StreamWriter(
stream,
new UTF8Encoding(false)))
{
writer.Write(file.Content);
}
stagedFiles.Add(new StagedGeneratedFile(temporaryPath, targetPath));
}
foreach (StagedGeneratedFile file in stagedFiles)
{
File.Move(file.TemporaryPath, file.TargetPath, true);
}
}
finally
{
foreach (StagedGeneratedFile file in stagedFiles)
{
if (File.Exists(file.TemporaryPath))
{
File.Delete(file.TemporaryPath);
}
}
}
return directory;
}
private static void EnsureTargetCanBeReplaced(
string targetPath
)
{
if (!File.Exists(targetPath))
{
return;
}
string? firstLine = File.ReadLines(targetPath).FirstOrDefault();
if (!string.Equals(firstLine, GeneratedFileMarker, StringComparison.Ordinal))
{
throw new IOException(
$"Refusing to overwrite non-generated file '{targetPath}'.");
}
}
public static int ListFiles(
GeneratedFileSet files,
IReadOnlyList<string> arguments
@@ -90,7 +221,7 @@ namespace StgSharp.GenerateGL
return QueryErrorExitCode;
}
Console.WriteLine("Generated files (memory only)");
Console.WriteLine("Generated files held in the current session");
for (int index = 0; index < files.Files.Count; index++)
{
GeneratedFile file = files.Files[index];
@@ -141,16 +272,23 @@ namespace StgSharp.GenerateGL
Console.WriteLine();
Console.WriteLine("Usage:");
Console.WriteLine(" generate");
Console.WriteLine(" generate <output-directory>");
Console.WriteLine(" generate --help");
Console.WriteLine();
Console.WriteLine("Status:");
Console.WriteLine(" Output is retained in the current process only.");
Console.WriteLine(" Running 'generate' does not create or modify disk files.");
Console.WriteLine("Output:");
Console.WriteLine(" Without a directory, output is retained in memory only.");
Console.WriteLine(" The output directory must already exist and be writable.");
Console.WriteLine(" Existing files are replaced only when marked as generated.");
Console.WriteLine();
Console.WriteLine("Inspection:");
Console.WriteLine(" list files");
Console.WriteLine(" preview <filename>");
}
private sealed record StagedGeneratedFile(
string TemporaryPath,
string TargetPath
);
}
}
@@ -0,0 +1,111 @@
// -----------------------------------------------------------------------------
// file="GlGetValueApiFilter"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using StgSharp.GenerateGL.Registry;
namespace StgSharp.GenerateGL.Generation
{
/// <summary>
/// Replaces desktop state query pointer families with typed Span overloads.
/// </summary>
internal sealed class GlGetValueApiFilter : IGlApiFilter
{
private static readonly Regex _pattern = new Regex(
@"^glGet(?<type>Boolean|Double|Float|Integer64|Integer)(?<indexed>i_)?v$",
RegexOptions.Compiled | RegexOptions.CultureInvariant);
public IReadOnlyList<ManagedMethodDefinition> Apply(
GlCommandDefinition command,
IReadOnlyList<ManagedMethodDefinition> methods,
GlEquivalentTypeMapper typeMapper
)
{
ArgumentNullException.ThrowIfNull(command);
ArgumentNullException.ThrowIfNull(methods);
ArgumentNullException.ThrowIfNull(typeMapper);
Match match = _pattern.Match(command.Name);
if (!match.Success)
{
return methods;
}
bool isIndexed = match.Groups["indexed"].Success;
int prefixCount = isIndexed ? 2 : 1;
if (typeMapper.ReadReturnType(command) != "void" ||
command.Parameters.Count != prefixCount + 1)
{
throw new InvalidOperationException(
$"State query '{command.Name}' does not match its recognized shape.");
}
GlParameterDefinition output = command.Parameters[^1];
string elementType = ReadElementType(match.Groups["type"].Value);
string expectedLength = $"COMPSIZE({command.Parameters[0].Name})";
if (output.DeclarationText.Contains("const", StringComparison.Ordinal) ||
typeMapper.ReadParameterType(output) != $"{elementType}*" ||
!string.Equals(output.Length, expectedLength, StringComparison.Ordinal))
{
throw new InvalidOperationException(
$"State query '{command.Name}' has inconsistent output metadata.");
}
List<ManagedParameterDefinition> parameters = new List<ManagedParameterDefinition>();
List<ManagedArgument> arguments = new List<ManagedArgument>();
for (int index = 0; index < prefixCount; index++)
{
GlParameterDefinition source = command.Parameters[index];
parameters.Add(
new ManagedParameterDefinition(
typeMapper.ReadParameterType(source),
source.Name,
source));
arguments.Add(new ParameterArgument(index));
}
parameters.Add(
new ManagedParameterDefinition(
$"Span<{elementType}>",
"values",
output));
return Array.AsReadOnly(
new[]
{
new ManagedMethodDefinition(
"GetValue",
"void",
Array.AsReadOnly(parameters.ToArray()),
command,
new QuerySpanInvocation(
Array.AsReadOnly(arguments.ToArray()),
parameters.Count - 1,
elementType)),
});
}
private static string ReadElementType(
string name
)
{
return name switch
{
"Boolean" => "byte",
"Double" => "double",
"Float" => "float",
"Integer" => "int",
"Integer64" => "long",
_ => throw new InvalidOperationException(
$"Unsupported state query component type '{name}'."),
};
}
}
}
@@ -34,6 +34,10 @@ namespace StgSharp.GenerateGL.Generation
@"^glVertexAttrib(?<width>[1-4])(?<type>d|f|s)(?<vector>v?)$",
RegexOptions.Compiled | RegexOptions.CultureInvariant);
private static readonly Regex _redundantVertexAttributeVectorPattern = new Regex(
@"^glVertexAttrib(?:I[1-4](?:i|ui)|L[1-4]d|P[1-4]ui|4Nub)v$",
RegexOptions.Compiled | RegexOptions.CultureInvariant);
private static readonly string[] _components = { "X", "Y", "Z", "W" };
public IReadOnlyList<ManagedMethodDefinition> Apply(
@@ -46,6 +50,11 @@ namespace StgSharp.GenerateGL.Generation
ArgumentNullException.ThrowIfNull(methods);
ArgumentNullException.ThrowIfNull(typeMapper);
if (_redundantVertexAttributeVectorPattern.IsMatch(command.Name))
{
return Array.Empty<ManagedMethodDefinition>();
}
Match matrixMatch = _matrixUniformPattern.Match(command.Name);
if (matrixMatch.Success)
{
@@ -16,7 +16,8 @@ namespace StgSharp.GenerateGL.Generation
IReadOnlyList<ManagedParameterDefinition> Parameters,
GlCommandDefinition NativeCommand,
ManagedInvocation Invocation,
bool WrapHandleReturn = false
bool WrapHandleReturn = false,
string? DocumentationPage = null
);
internal sealed record ManagedParameterDefinition(
@@ -53,6 +54,12 @@ namespace StgSharp.GenerateGL.Generation
bool IsSpan
) : ManagedInvocation;
internal sealed record QuerySpanInvocation(
IReadOnlyList<ManagedArgument> PrefixArguments,
int SpanParameterIndex,
string ElementType
) : ManagedInvocation;
internal abstract record ManagedArgument;
internal sealed record ParameterArgument(
@@ -8,6 +8,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using StgSharp.GenerateGL.Analysis;
using StgSharp.GenerateGL.Naming;
using StgSharp.GenerateGL.Registry;
namespace StgSharp.GenerateGL.Generation
@@ -19,16 +21,21 @@ namespace StgSharp.GenerateGL.Generation
new IGlApiFilter[]
{
new GlOverloadApiFilter(),
new GlGetValueApiFilter(),
new GlHandleApiFilter(),
});
private readonly GlEquivalentTypeMapper _typeMapper;
private readonly GlManagedApiNamePolicy _namePolicy;
public ManagedApiPlanner(
GlEquivalentTypeMapper typeMapper
GlEquivalentTypeMapper typeMapper,
GlFunctionFamilyAnalysis familyAnalysis
)
{
ArgumentNullException.ThrowIfNull(typeMapper);
ArgumentNullException.ThrowIfNull(familyAnalysis);
_typeMapper = typeMapper;
_namePolicy = new GlManagedApiNamePolicy(familyAnalysis);
}
public IReadOnlyList<ManagedMethodDefinition> Plan(
@@ -50,9 +57,23 @@ namespace StgSharp.GenerateGL.Generation
methods = filter.Apply(command, methods, _typeMapper);
}
result.AddRange(methods);
result.AddRange(
methods.Select(
method => method with
{
Name = _namePolicy.ReadMethodName(command, method.Name),
DocumentationPage = _namePolicy.ReadDocumentationPage(command),
Parameters = Array.AsReadOnly(
method.Parameters.Select(
parameter => parameter with
{
Name = CSharpIdentifierPolicy.NormalizeParameterName(
parameter.Name),
}).ToArray()),
}));
}
ResolveNameCollisions(result);
return Array.AsReadOnly(result.ToArray());
}
@@ -78,6 +99,55 @@ namespace StgSharp.GenerateGL.Generation
}
}
private static void ResolveNameCollisions(
List<ManagedMethodDefinition> methods
)
{
ILookup<string, int> indicesBySignature = methods
.Select(
(method, index) => new
{
Index = index,
Signature = ReadManagedSignature(method),
})
.ToLookup(value => value.Signature, value => value.Index, StringComparer.Ordinal);
foreach (IGrouping<string, int> group in indicesBySignature)
{
int[] indices = group.ToArray();
if (indices.Length < 2)
{
continue;
}
string[] nativeNames = indices
.Select(value => methods[value].NativeCommand.Name)
.Distinct(StringComparer.Ordinal)
.ToArray();
if (nativeNames.Length != indices.Length)
{
throw new InvalidOperationException(
$"Managed overload '{group.Key}' is duplicated by one native command.");
}
foreach (int index in indices)
{
ManagedMethodDefinition method = methods[index];
methods[index] = method with
{
Name = GlManagedApiNamePolicy.ReadNativeMethodName(
method.NativeCommand),
};
}
}
}
private static string ReadManagedSignature(
ManagedMethodDefinition method
)
{
return $"{method.Name}({string.Join(",", method.Parameters.Select(value => value.Type))})";
}
private ManagedMethodDefinition CreateRawMethod(
GlCommandDefinition command
)
@@ -13,6 +13,7 @@ using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using StgSharp.GenerateGL.Analysis;
using StgSharp.GenerateGL.Registry;
namespace StgSharp.GenerateGL.Generation
@@ -23,9 +24,6 @@ namespace StgSharp.GenerateGL.Generation
internal static class OpenGlGenerator
{
private const string ApiName = "gl";
private const string CoreProfile = "core";
private static readonly HashSet<string> _csharpKeywords = new HashSet<string>(
new[]
{
@@ -44,25 +42,41 @@ namespace StgSharp.GenerateGL.Generation
StringComparer.Ordinal);
public static GeneratedFileSet Generate(
GlRegistryModel registry
GlRegistryProjection projection
)
{
ArgumentNullException.ThrowIfNull(registry);
ArgumentNullException.ThrowIfNull(projection);
IReadOnlyList<GlCommandGroup> commandGroups = ReadCoreCommandGroups(registry);
IReadOnlyList<GlCommandGroup> commandGroups = ReadCoreCommandGroups(projection);
IReadOnlyList<GlCommandDefinition> commands = Array.AsReadOnly(
commandGroups.SelectMany(value => value.Commands).ToArray());
GlEquivalentTypeMapper typeMapper = new GlEquivalentTypeMapper(registry);
ManagedApiPlanner apiPlanner = new ManagedApiPlanner(typeMapper);
GlEquivalentTypeMapper typeMapper = new GlEquivalentTypeMapper(projection.Source);
GlFunctionFamilyAnalysis familyAnalysis = GlFunctionFamilyAnalyzer.Analyze(projection);
ManagedApiPlanner apiPlanner = new ManagedApiPlanner(typeMapper, familyAnalysis);
IReadOnlyList<ManagedMethodDefinition> managedMethods = apiPlanner.Plan(commands);
Dictionary<string, IReadOnlyList<ManagedMethodDefinition>> methodsByCommand =
managedMethods.GroupBy(value => value.NativeCommand.Name, StringComparer.Ordinal)
.ToDictionary(
value => value.Key,
value => (IReadOnlyList<ManagedMethodDefinition>)Array.AsReadOnly(
value.ToArray()),
StringComparer.Ordinal);
List<ManagedCommandGroup> managedGroups = commandGroups.Select(
group => new ManagedCommandGroup(
group,
apiPlanner.Plan(group.Commands))).ToList();
Array.AsReadOnly(
group.Commands.SelectMany(
command => methodsByCommand.TryGetValue(
command.Name,
out IReadOnlyList<ManagedMethodDefinition>? methods)
? methods
: Array.Empty<ManagedMethodDefinition>())
.ToArray()))).ToList();
ManagedApiPlanner.Validate(
managedGroups.SelectMany(value => value.Methods));
List<GeneratedFile> files = new List<GeneratedFile>
{
new GeneratedFile("glconst.cs", GenerateConstants(registry)),
new GeneratedFile("glconst.cs", GenerateConstants(projection.Enums)),
new GeneratedFile(
"OpenglContext.g.cs",
GenerateContext(commands, typeMapper)),
@@ -84,67 +98,26 @@ namespace StgSharp.GenerateGL.Generation
}
private static ReadOnlyCollection<GlCommandGroup> ReadCoreCommandGroups(
GlRegistryModel registry
GlRegistryProjection projection
)
{
Dictionary<string, GlCommandDefinition> definitions = new Dictionary<string, GlCommandDefinition>(
StringComparer.Ordinal);
foreach (GlCommandDefinition command in registry.Commands)
{
if (!definitions.TryAdd(command.Name, command))
{
throw new InvalidDataException(
$"Command '{command.Name}' has more than one definition.");
}
}
List<string> order = new List<string>();
HashSet<string> known = new HashSet<string>(StringComparer.Ordinal);
HashSet<string> active = new HashSet<string>(StringComparer.Ordinal);
Dictionary<string, string> introducedVersions = new Dictionary<string, string>(
StringComparer.Ordinal);
foreach (GlFeatureDefinition feature in registry.Features.Where(
value => string.Equals(value.Api, ApiName, StringComparison.Ordinal)))
{
foreach (GlRequirementBlock block in feature.Requirements.Where(AppliesToCoreGl))
{
foreach (GlRegistryReference reference in block.References.Where(
value => value.Kind == GlRegistryReferenceKind.Command))
{
if (!definitions.ContainsKey(reference.Name))
{
throw new InvalidDataException(
$"Feature '{feature.Name}' references undefined command " +
$"'{reference.Name}'.");
}
if (block.Operation == GlRequirementOperation.Require)
{
active.Add(reference.Name);
if (known.Add(reference.Name))
{
order.Add(reference.Name);
introducedVersions.Add(reference.Name, feature.Number);
}
}
else
{
active.Remove(reference.Name);
}
}
}
}
List<GlCommandDefinition> foundation = new List<GlCommandDefinition>();
Dictionary<string, List<GlCommandDefinition>> versionGroups = new Dictionary<string, List<GlCommandDefinition>>(
StringComparer.Ordinal);
List<string> versionOrder = new List<string>();
foreach (string commandName in order.Where(active.Contains))
foreach (GlCommandDefinition command in projection.Commands)
{
string version = introducedVersions[commandName];
if (!projection.CommandIntroducedVersions.TryGetValue(
command.Name,
out string? version))
{
throw new InvalidDataException(
$"Command '{command.Name}' has no introduction version.");
}
if (IsFoundationVersion(version))
{
foundation.Add(definitions[commandName]);
foundation.Add(command);
continue;
}
@@ -157,7 +130,7 @@ namespace StgSharp.GenerateGL.Generation
versionOrder.Add(version);
}
commands.Add(definitions[commandName]);
commands.Add(command);
}
List<GlCommandGroup> groups = new List<GlCommandGroup>
@@ -203,23 +176,8 @@ namespace StgSharp.GenerateGL.Generation
return major < 3 || major == 3 && minor <= 2;
}
private static bool AppliesToCoreGl(
GlRequirementBlock block
)
{
bool matchesApi = block.Api is null || string.Equals(
block.Api,
ApiName,
StringComparison.Ordinal);
bool matchesProfile = block.Profile is null || string.Equals(
block.Profile,
CoreProfile,
StringComparison.Ordinal);
return matchesApi && matchesProfile;
}
private static string GenerateConstants(
GlRegistryModel registry
IReadOnlyList<GlEnumDefinition> enums
)
{
StringBuilder builder = new StringBuilder(512 * 1024);
@@ -231,8 +189,7 @@ namespace StgSharp.GenerateGL.Generation
Dictionary<string, GlEnumDefinition> emitted = new Dictionary<string, GlEnumDefinition>(
StringComparer.Ordinal);
foreach (GlEnumDefinition value in registry.EnumBlocks.SelectMany(
block => block.Enums).Where(IsDesktopEnum))
foreach (GlEnumDefinition value in enums)
{
if (value.Value is null)
{
@@ -267,16 +224,6 @@ namespace StgSharp.GenerateGL.Generation
return builder.ToString();
}
private static bool IsDesktopEnum(
GlEnumDefinition value
)
{
return value.Api is null || string.Equals(
value.Api,
ApiName,
StringComparison.Ordinal);
}
private static ConstantExpression ReadConstantExpression(
GlEnumDefinition value
)
@@ -430,6 +377,7 @@ namespace StgSharp.GenerateGL.Generation
foreach (ManagedMethodDefinition method in methods)
{
AppendMethodDocumentation(builder, method);
builder.Append("\n [MethodImpl(MethodImplOptions.AggressiveInlining)]\n");
builder.Append(" public ");
builder.Append(method.ReturnType);
@@ -460,6 +408,41 @@ namespace StgSharp.GenerateGL.Generation
return builder.ToString();
}
private static void AppendMethodDocumentation(
StringBuilder builder,
ManagedMethodDefinition method
)
{
string declaration = ReadNativeDeclaration(method.NativeCommand);
string page = method.DocumentationPage ?? method.NativeCommand.Name;
builder.Append("\n /// <summary>Forwards to the native C API <c>");
builder.Append(EscapeXml(declaration));
builder.Append("</c>.</summary>\n");
builder.Append(" /// <seealso href=\"https://docs.gl/gl4/");
builder.Append(page);
builder.Append("\" />");
}
private static string ReadNativeDeclaration(
GlCommandDefinition command
)
{
return $"{command.Return.DeclarationText}(" +
string.Join(", ", command.Parameters.Select(value => value.DeclarationText)) +
");";
}
private static string EscapeXml(
string value
)
{
return value.Replace("&", "&amp;", StringComparison.Ordinal)
.Replace("<", "&lt;", StringComparison.Ordinal)
.Replace(">", "&gt;", StringComparison.Ordinal)
.Replace("\"", "&quot;", StringComparison.Ordinal)
.Replace("'", "&apos;", StringComparison.Ordinal);
}
private static void AppendInvocation(
StringBuilder builder,
ManagedMethodDefinition method
@@ -479,12 +462,42 @@ namespace StgSharp.GenerateGL.Generation
case Matrix4Invocation matrix:
AppendMatrix4Invocation(builder, method, matrix);
break;
case QuerySpanInvocation query:
AppendQuerySpanInvocation(builder, method, query);
break;
default:
throw new InvalidOperationException(
$"Unsupported managed invocation '{method.Invocation.GetType().Name}'.");
}
}
private static void AppendQuerySpanInvocation(
StringBuilder builder,
ManagedMethodDefinition method,
QuerySpanInvocation invocation
)
{
ManagedParameterDefinition span = method.Parameters[invocation.SpanParameterIndex];
string spanName = EscapeIdentifier(span.Name);
builder.Append(" fixed (");
builder.Append(invocation.ElementType);
builder.Append("* __value = ");
builder.Append(spanName);
builder.Append(")\n");
builder.Append(" {\n");
builder.Append(" __context->");
builder.Append(method.NativeCommand.Name);
builder.Append('(');
AppendArguments(builder, method, invocation.PrefixArguments);
if (invocation.PrefixArguments.Count != 0)
{
builder.Append(", ");
}
builder.Append("__value);\n");
builder.Append(" }\n");
}
private static void AppendDirectInvocation(
StringBuilder builder,
ManagedMethodDefinition method,
@@ -0,0 +1,94 @@
// -----------------------------------------------------------------------------
// file="CSharpIdentifierPolicy"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System;
using System.Text.RegularExpressions;
namespace StgSharp.GenerateGL.Naming
{
internal static class CSharpIdentifierPolicy
{
private static readonly Regex _attributeWord = new Regex(
@"Attrib(?!ute)",
RegexOptions.Compiled | RegexOptions.CultureInvariant);
private static readonly Regex _attributeParameterWord = new Regex(
@"attrib(?!ute)",
RegexOptions.Compiled | RegexOptions.CultureInvariant);
private static readonly Regex _fragmentWord = new Regex(
@"Frag(?!ment)",
RegexOptions.Compiled | RegexOptions.CultureInvariant);
public static string NormalizeMemberName(
string value
)
{
ArgumentException.ThrowIfNullOrWhiteSpace(value);
string result = value.Replace(
"Framebuffer",
"FrameBuffer",
StringComparison.Ordinal)
.Replace(
"Renderbuffer",
"RenderBuffer",
StringComparison.Ordinal)
.Replace(
"Internalformat",
"InternalFormat",
StringComparison.Ordinal);
result = _attributeWord.Replace(result, "Attribute");
return _fragmentWord.Replace(result, "Fragment");
}
public static string NormalizeParameterName(
string value
)
{
ArgumentException.ThrowIfNullOrWhiteSpace(value);
string result = value.Replace(
"Framebuffer",
"FrameBuffer",
StringComparison.Ordinal)
.Replace(
"framebuffer",
"frameBuffer",
StringComparison.Ordinal)
.Replace(
"Renderbuffer",
"RenderBuffer",
StringComparison.Ordinal)
.Replace(
"renderbuffer",
"renderBuffer",
StringComparison.Ordinal)
.Replace(
"Internalformat",
"InternalFormat",
StringComparison.Ordinal)
.Replace(
"internalformat",
"internalFormat",
StringComparison.Ordinal)
.Replace(
"attribindex",
"attributeIndex",
StringComparison.Ordinal)
.Replace(
"bindingindex",
"bindingIndex",
StringComparison.Ordinal)
.Replace(
"relativeoffset",
"relativeOffset",
StringComparison.Ordinal);
return _attributeParameterWord.Replace(result, "attribute");
}
}
}
@@ -0,0 +1,345 @@
// -----------------------------------------------------------------------------
// file="GlManagedApiNamePolicy"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using StgSharp.GenerateGL.Analysis;
using StgSharp.GenerateGL.Registry;
namespace StgSharp.GenerateGL.Naming
{
/// <summary>
/// Translates native overload families into stable, semantic C# method names.
/// </summary>
internal sealed class GlManagedApiNamePolicy
{
private static readonly Regex _getVertexAttributeModePattern = new Regex(
@"^glGetVertexAttrib(?<mode>I|L)(?:i|ui|d)v$",
RegexOptions.Compiled | RegexOptions.CultureInvariant);
private static readonly Regex _vertexAttributeModePattern = new Regex(
@"^glVertexAttrib(?<mode>I|L|P)[1-4]",
RegexOptions.Compiled | RegexOptions.CultureInvariant);
private readonly Dictionary<string, FamilyEntry> _familiesByCommand;
public GlManagedApiNamePolicy(
GlFunctionFamilyAnalysis analysis
)
{
ArgumentNullException.ThrowIfNull(analysis);
_familiesByCommand = analysis.Families
.SelectMany(
family => family.Members.Select(
member => new KeyValuePair<string, FamilyEntry>(
member.Command.Name,
new FamilyEntry(family, member.NameShape))))
.ToDictionary(
value => value.Key,
value => value.Value,
StringComparer.Ordinal);
}
public string ReadMethodName(
GlCommandDefinition command,
string currentName
)
{
ArgumentNullException.ThrowIfNull(command);
ArgumentException.ThrowIfNullOrWhiteSpace(currentName);
string rawName = CSharpIdentifierPolicy.NormalizeMemberName(
RemoveGlPrefix(command.Name));
string normalizedCurrentName = CSharpIdentifierPolicy.NormalizeMemberName(
currentName);
if (!string.Equals(normalizedCurrentName, rawName, StringComparison.Ordinal))
{
return normalizedCurrentName;
}
string? specialName = ReadSpecialMethodName(command.Name);
if (specialName is not null)
{
return specialName;
}
if (!_familiesByCommand.TryGetValue(
command.Name,
out FamilyEntry? entry))
{
return rawName;
}
string familyName = ReadSemanticFamilyName(entry.Family.Name);
if (entry.Family.ShapeNamePolicy == GlFunctionShapeNamePolicy.MustRetain &&
entry.Shape?.Shape is not null)
{
familyName += entry.Shape.Shape;
}
return CSharpIdentifierPolicy.NormalizeMemberName(familyName);
}
public static string ReadNativeMethodName(
GlCommandDefinition command
)
{
ArgumentNullException.ThrowIfNull(command);
return CSharpIdentifierPolicy.NormalizeMemberName(RemoveGlPrefix(command.Name));
}
public string ReadDocumentationPage(
GlCommandDefinition command
)
{
ArgumentNullException.ThrowIfNull(command);
string? specialPage = ReadSpecialDocumentationPage(command.Name);
if (specialPage is not null)
{
return specialPage;
}
if (!_familiesByCommand.TryGetValue(
command.Name,
out FamilyEntry? entry))
{
return command.Name;
}
string familyName = entry.Family.Name
.Replace("FrameBuffer", "Framebuffer", StringComparison.Ordinal)
.Replace("RenderBuffer", "Renderbuffer", StringComparison.Ordinal)
.Replace("InternalFormat", "Internalformat", StringComparison.Ordinal)
.Replace("Attribute", "Attrib", StringComparison.Ordinal)
.Replace("Fragment", "Frag", StringComparison.Ordinal);
return $"gl{ReadDocumentationFamilyName(familyName)}";
}
private static string? ReadSpecialMethodName(
string commandName
)
{
if (commandName == "glClearBufferfi")
{
return "ClearBuffer";
}
if (commandName == "glClearNamedFramebufferfi")
{
return "ClearNamedFrameBuffer";
}
if (commandName == "glGetVertexAttribPointerv")
{
return "GetVertexAttributePointer";
}
if (commandName.StartsWith("glVertexAttrib4N", StringComparison.Ordinal))
{
return "VertexAttributeNormalized";
}
Match getMatch = _getVertexAttributeModePattern.Match(commandName);
if (getMatch.Success)
{
return getMatch.Groups["mode"].Value == "I"
? "GetVertexAttributeInteger"
: "GetVertexAttributeDouble";
}
if (commandName is "glVertexAttribIFormat" or "glVertexArrayAttribIFormat")
{
return CSharpIdentifierPolicy.NormalizeMemberName(
RemoveGlPrefix(commandName).Replace(
"AttribIFormat",
"AttributeIntegerFormat",
StringComparison.Ordinal));
}
if (commandName is "glVertexAttribLFormat" or "glVertexArrayAttribLFormat")
{
return CSharpIdentifierPolicy.NormalizeMemberName(
RemoveGlPrefix(commandName).Replace(
"AttribLFormat",
"AttributeDoubleFormat",
StringComparison.Ordinal));
}
if (commandName == "glVertexAttribIPointer")
{
return "VertexAttributeIntegerPointer";
}
if (commandName == "glVertexAttribLPointer")
{
return "VertexAttributeDoublePointer";
}
Match vertexMatch = _vertexAttributeModePattern.Match(commandName);
if (!vertexMatch.Success)
{
return null;
}
return vertexMatch.Groups["mode"].Value switch
{
"I" => "VertexAttributeInteger",
"L" => "VertexAttributeDouble",
"P" => $"VertexAttributePacked{ReadVertexAttributeWidth(commandName, 'P')}",
_ => null,
};
}
private static string ReadSemanticFamilyName(
string familyName
)
{
return familyName switch
{
"VertexAttrib" or "VertexAttribute" => "VertexAttribute",
"VertexAttrib4N" or "VertexAttribute4N" => "VertexAttributeNormalized",
"VertexAttribI" or "VertexAttributeI" => "VertexAttributeInteger",
"VertexAttribL" or "VertexAttributeL" => "VertexAttributeDouble",
"VertexAttribP" or "VertexAttributeP" => "VertexAttributePacked",
"GetVertexAttrib" or "GetVertexAttribute" => "GetVertexAttribute",
"GetVertexAttribI" or "GetVertexAttributeI" => "GetVertexAttributeInteger",
"GetnUniform" => "GetUniform",
"SamplerParameterI" => "SamplerParameterInteger",
"GetSamplerParameterI" => "GetSamplerParameterInteger",
"TexParameter" => "TextureParameter",
"TexParameterI" => "TextureParameterInteger",
"GetTexParameter" => "GetTextureParameter",
"GetTexParameterI" => "GetTextureParameterInteger",
"GetTexLevelParameter" => "GetTextureLevelParameter",
"TextureParameter" => "NamedTextureParameter",
"TextureParameterI" => "NamedTextureParameterInteger",
"GetTextureParameter" => "GetNamedTextureParameter",
"GetTextureParameterI" => "GetNamedTextureParameterInteger",
"GetTextureLevelParameter" => "GetNamedTextureLevelParameter",
_ => familyName,
};
}
private static string ReadDocumentationFamilyName(
string familyName
)
{
return familyName switch
{
"VertexAttrib4N" or "VertexAttribI" or "VertexAttribL" or
"VertexAttribP" => "VertexAttrib",
"GetVertexAttribI" => "GetVertexAttrib",
"SamplerParameterI" => "SamplerParameter",
"GetSamplerParameterI" => "GetSamplerParameter",
"TexParameterI" => "TexParameter",
"GetTexParameterI" => "GetTexParameter",
"TextureParameterI" => "TextureParameter",
"GetTextureParameterI" => "GetTextureParameter",
_ => familyName,
};
}
private static string? ReadSpecialDocumentationPage(
string commandName
)
{
if (commandName.StartsWith("glProgramUniformMatrix", StringComparison.Ordinal))
{
return "glProgramUniform";
}
if (commandName.StartsWith("glUniformMatrix", StringComparison.Ordinal))
{
return "glUniform";
}
if (commandName is "glVertexAttribIPointer" or "glVertexAttribLPointer")
{
return "glVertexAttribPointer";
}
if (commandName is "glVertexAttribIFormat" or "glVertexAttribLFormat" or
"glVertexArrayAttribFormat" or "glVertexArrayAttribIFormat" or
"glVertexArrayAttribLFormat")
{
return "glVertexAttribFormat";
}
if (commandName == "glClearBufferfi")
{
return "glClearBuffer";
}
if (commandName == "glClearNamedFramebufferfi")
{
return "glClearNamedFramebuffer";
}
if (commandName is "glGetBooleanv" or "glGetDoublev" or
"glGetFloatv" or "glGetIntegerv" or "glGetInteger64v" or
"glGetBooleani_v" or "glGetDoublei_v" or "glGetFloati_v" or
"glGetIntegeri_v" or "glGetInteger64i_v")
{
return "glGet";
}
if (commandName == "glGetVertexAttribPointerv")
{
return commandName;
}
if (commandName.StartsWith("glGetVertexAttrib", StringComparison.Ordinal))
{
return "glGetVertexAttrib";
}
if (commandName.StartsWith("glVertexAttrib", StringComparison.Ordinal) &&
commandName.Length > "glVertexAttrib".Length &&
char.IsDigit(commandName["glVertexAttrib".Length]) ||
commandName.StartsWith("glVertexAttribI", StringComparison.Ordinal) &&
commandName != "glVertexAttribIFormat" &&
commandName != "glVertexAttribIPointer" ||
commandName.StartsWith("glVertexAttribL", StringComparison.Ordinal) &&
commandName != "glVertexAttribLFormat" &&
commandName != "glVertexAttribLPointer" ||
commandName.StartsWith("glVertexAttribP", StringComparison.Ordinal))
{
return "glVertexAttrib";
}
return null;
}
private static char ReadVertexAttributeWidth(
string commandName,
char mode
)
{
int index = commandName.IndexOf(mode, "glVertexAttrib".Length) + 1;
return commandName[index];
}
private static string RemoveGlPrefix(
string name
)
{
return name.StartsWith("gl", StringComparison.Ordinal) && name.Length > 2
? name[2..]
: name;
}
private sealed record FamilyEntry(
GlFunctionFamily Family,
GlFunctionNameShape? Shape
);
}
}
+157
View File
@@ -0,0 +1,157 @@
# StgSharp.GenerateGL
`StgSharp.GenerateGL` generates the StgSharp desktop OpenGL C# bindings from the Khronos `gl.xml` registry.
The current target is OpenGL 4.6 Core. The generator does not emit OpenGL ES or mix extension entry points into the core API. `gl.xml` is the authoritative generation input; the retained `gl.h` is reference material only.
## Usage
Start the interactive CLI:
```powershell
dotnet run --project tools/StgSharp.GenerateGL/StgSharp.GenerateGL.csproj
```
Common commands:
```text
summary
find glBindBuffer
show command glBindBuffer
target summary
families list Vertex
families show VertexAttributeP
generate
list files
preview OpenGLFunction.v4_1.g.cs
```
Generate directly into an existing directory:
```powershell
dotnet run --project tools/StgSharp.GenerateGL/StgSharp.GenerateGL.csproj -- generate src/StgSharp.Graphics/OpenGL/Generated
```
Without a directory, `generate` retains its output in the current CLI session. With a directory:
- the directory must already exist and be writable;
- each file is staged in the destination directory before replacing its target;
- an existing file is replaced only when its first line is `// <auto-generated>`;
- unrelated and obsolete generated files are not deleted.
Use a directory dedicated to generated source files.
## Pipeline
```text
gl.xml
-> lossless XML and registry models
-> desktop OpenGL 4.6 Core projection
-> function-family and scalar/vector relation analysis
-> managed API filters
-> C# naming and signature validation
-> in-memory generated file set
-> preview or directory output
```
The target projection removes GLES and ARB/NV/EXT extension entry points. It retains only commands and constants present in the target Core Profile.
Generated files:
- `glconst.cs`: core constants;
- `OpenglContext.g.cs`: the function-pointer table with native names and ABI types;
- `OpenGLFunction.Base.g.cs`: APIs introduced through OpenGL 3.2 and retained in the target profile;
- `OpenGLFunction.v3_3.g.cs` through `OpenGLFunction.v4_6.g.cs`: APIs introduced by each later core version.
`OpenglContext` intentionally remains close to the C ABI. Overloads, `Span<T>`, `GlHandle`, and managed naming exist only in the `OpenGLFunction` layer.
## Overload rules
The generator merges a family only when it can validate the resulting signatures. Every managed method retains a reference to its original `gl*` command.
| Native C API | Generated API |
| --- | --- |
| `glUniform1f` through `glUniform4f` | Scalar `Uniform(...)` overloads |
| `glUniform*i`, `glUniform*ui`, and `glUniform*d` | Merged into `Uniform(...)` by C# parameter type |
| `glProgramUniform*` | Merged into `ProgramUniform(...)` by the same rules |
| `glUniform1*v` | `Uniform(..., ReadOnlySpan<T>)` |
| `glUniform4*v` | `Uniform(..., ReadOnlySpan<Vec4<T>>)` |
| `glUniform2*v` and `glUniform3*v` | Omitted because `Vec2` and `Vec3` storage is not a tightly packed C array |
| `glUniformMatrix4fv` | `Uniform(..., GraphicsMatrix)` and matrix-span overloads |
| Other matrix sizes and double matrices | Omitted because only the graphics-oriented 4x4 float layout is defined |
| `glGetBooleanv`, `glGetFloatv`, `glGetIntegerv`, and related queries | `GetValue(..., Span<T>)` |
| `glVertexAttrib1f/2f/3f/4f` and equivalent scalar forms | `VertexAttribute(...)`; component count is expressed by the parameter list |
| `glVertexAttrib*fv/*iv/...` with a scalar equivalent | Omitted instead of exposing a duplicate C-style pointer entry point |
| `glVertexAttrib4N*` | `VertexAttributeNormalized(...)` |
| `glVertexAttribI*` | `VertexAttributeInteger(...)` |
| `glVertexAttribL*` | `VertexAttributeDouble(...)`; `L` does not mean C# `long` |
| `glVertexAttribP1ui` through `P4ui` | `VertexAttributePacked1(...)` through `Packed4(...)`; the width prevents signature collisions |
| `glGetVertexAttribI*` and `L*` | `GetVertexAttributeInteger(...)` and `GetVertexAttributeDouble(...)` |
| `glScissorIndexed` and `glScissorIndexedv` | `ScissorIndexed(...)` overloads |
Function families are inferred from common name prefixes, shape suffixes, type suffixes, and vector forms. Candidates are checked against:
- the `gl.xml` `<vecequiv>` relation;
- parameter `len`, `kind`, and native types;
- scalar `T` versus `const T*` relationships;
- uniqueness of the final C# signature.
If incomplete type mapping causes two methods to collapse to the same C# signature, the generator conservatively restores their normalized native names instead of emitting uncompilable overloads.
## Renaming rules
Safe lexical normalization applies to all public methods:
| OpenGL spelling | C# spelling |
| --- | --- |
| `Framebuffer` / `framebuffer` | `FrameBuffer` / `frameBuffer` |
| `Renderbuffer` / `renderbuffer` | `RenderBuffer` / `renderBuffer` |
| `Internalformat` / `internalformat` | `InternalFormat` / `internalFormat` |
| `Attrib` / `attrib` | `Attribute` / `attribute` |
| `Frag` | `Fragment` |
| `attribindex` | `attributeIndex` |
| `bindingindex` | `bindingIndex` |
| `relativeoffset` | `relativeOffset` |
Families that represent distinct semantics receive explicit names:
| Native family | Managed family |
| --- | --- |
| `TexParameter*` | `TextureParameter(...)` |
| DSA `TextureParameter*` | `NamedTextureParameter(...)` |
| `TexParameterI*` | `TextureParameterInteger(...)` |
| DSA `TextureParameterI*` | `NamedTextureParameterInteger(...)` |
| `SamplerParameterI*` | `SamplerParameterInteger(...)` |
| `GetnUniform*` | Merged into `GetUniform(...)` when signatures permit |
| `VertexAttribI/L/P/N` | Expanded to `Integer/Double/Packed/Normalized` |
Renaming never changes the native target. For example, `VertexAttributeInteger(...)` still calls `__context->glVertexAttribI*`.
## Type rules
- `gl.xml` typedefs map to equivalent C# ABI types; the generator does not emit separate type aliases;
- a `GLuint` is converted to `GlHandle` only when object class and parameter semantics identify it as an object handle;
- handle arrays use `Span<GlHandle>` or `ReadOnlySpan<GlHandle>`;
- `OpenGLFunction` stores an `OpenglContext*` and forwards through `__context->glFunction(...)`;
- unknown-length arrays, complex outputs, multiple indirection, and `void*` remain pointers.
A `T*` alone does not determine whether a managed API should use `Span<T>`, `ReadOnlySpan<T>`, `out T`, or a return value. Future pointer improvements should be implemented as family-specific filters validated with `len`, parameter direction, and OpenGL state semantics.
## Documentation comments
Every generated public method contains:
- its original C API declaration;
- a `<seealso>` link to the corresponding docs.gl OpenGL 4 page or family page.
The generator does not emit `<param>` or `<returns>` elements and does not copy docs.gl content.
## Source layout
- `Registry/`: the `gl.xml` object model and Core Profile projection;
- `Analysis/`: function families, name shapes, and scalar/vector relations;
- `Generation/`: type mapping, API filters, signature planning, and file generation;
- `Naming/`: C# identifier and semantic-family naming policies;
- `XmlCli.cs`, `RegistryCli.cs`, and `FunctionFamilyCli.cs`: interactive inspection;
- `GenerateCli.cs`: in-memory preview and protected directory output.
@@ -0,0 +1,258 @@
// -----------------------------------------------------------------------------
// file="DesktopGlCoreRegistryFilter"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
namespace StgSharp.GenerateGL.Registry
{
/// <summary>
/// Selects the active desktop OpenGL core API without extension requirements.
/// </summary>
internal static class DesktopGlCoreRegistryFilter
{
public const string ApiName = "gl";
public const string CoreProfile = "core";
public const string LatestVersion = "4.6";
public static GlRegistryProjection Apply(
GlRegistryModel registry,
string maximumVersion = LatestVersion
)
{
ArgumentNullException.ThrowIfNull(registry);
Version maximum = ReadVersion(maximumVersion);
GlFeatureDefinition[] features = registry.Features
.Where(
value => string.Equals(value.Api, ApiName, StringComparison.Ordinal) &&
ReadVersion(value.Number) <= maximum)
.ToArray();
Dictionary<string, GlCommandDefinition> commandDefinitions = ReadCommandDefinitions(
registry);
Dictionary<string, GlEnumDefinition> enumDefinitions = ReadEnumDefinitions(registry);
SymbolSelection commands = new SymbolSelection();
SymbolSelection enums = new SymbolSelection();
foreach (GlFeatureDefinition feature in features)
{
foreach (GlRequirementBlock block in feature.Requirements.Where(AppliesToTarget))
{
foreach (GlRegistryReference reference in block.References)
{
SymbolSelection? selection = reference.Kind switch
{
GlRegistryReferenceKind.Command => commands,
GlRegistryReferenceKind.Enum => enums,
GlRegistryReferenceKind.Type => null,
_ => throw new InvalidDataException(
$"Unknown registry reference kind '{reference.Kind}'."),
};
if (selection is null)
{
continue;
}
if (block.Operation == GlRequirementOperation.Require)
{
selection.Require(reference.Name, feature.Number);
}
else
{
selection.Remove(reference.Name);
}
}
}
}
GlCommandDefinition[] selectedCommands = commands.ReadActiveNames()
.Select(
name => ReadDefinition(
commandDefinitions,
name,
"command"))
.ToArray();
GlEnumDefinition[] selectedEnums = enums.ReadActiveNames()
.Select(
name => ReadDefinition(
enumDefinitions,
name,
"enum"))
.ToArray();
return new GlRegistryProjection(
registry,
ApiName,
CoreProfile,
maximumVersion,
Freeze(features),
Freeze(selectedCommands),
Freeze(selectedEnums),
commands.FreezeIntroducedVersions(),
enums.FreezeIntroducedVersions());
}
private static bool AppliesToTarget(
GlRequirementBlock block
)
{
bool matchesApi = block.Api is null || string.Equals(
block.Api,
ApiName,
StringComparison.Ordinal);
bool matchesProfile = block.Profile is null || string.Equals(
block.Profile,
CoreProfile,
StringComparison.Ordinal);
return matchesApi && matchesProfile;
}
private static Dictionary<string, GlCommandDefinition> ReadCommandDefinitions(
GlRegistryModel registry
)
{
Dictionary<string, GlCommandDefinition> result = new Dictionary<string, GlCommandDefinition>(
StringComparer.Ordinal);
foreach (GlCommandDefinition command in registry.Commands)
{
if (!result.TryAdd(command.Name, command))
{
throw new InvalidDataException(
$"Command '{command.Name}' has more than one definition.");
}
}
return result;
}
private static Dictionary<string, GlEnumDefinition> ReadEnumDefinitions(
GlRegistryModel registry
)
{
Dictionary<string, GlEnumDefinition> result = new Dictionary<string, GlEnumDefinition>(
StringComparer.Ordinal);
foreach (GlEnumDefinition value in registry.EnumBlocks.SelectMany(
block => block.Enums).Where(IsDesktopDefinition))
{
if (!result.TryGetValue(value.Name, out GlEnumDefinition? previous))
{
result.Add(value.Name, value);
continue;
}
if (previous.Value is not null && value.Value is not null && !string.Equals(
previous.Value,
value.Value,
StringComparison.Ordinal))
{
throw new InvalidDataException(
$"Enum '{value.Name}' has conflicting desktop values " +
$"'{previous.Value}' and '{value.Value}'.");
}
if (previous.Value is null && value.Value is not null)
{
result[value.Name] = value;
}
}
return result;
}
private static bool IsDesktopDefinition(
GlEnumDefinition value
)
{
return value.Api is null || string.Equals(
value.Api,
ApiName,
StringComparison.Ordinal);
}
private static T ReadDefinition<T>(
IReadOnlyDictionary<string, T> definitions,
string name,
string kind
)
{
if (!definitions.TryGetValue(name, out T? definition))
{
throw new InvalidDataException(
$"Desktop OpenGL core references undefined {kind} '{name}'.");
}
return definition;
}
private static Version ReadVersion(
string value
)
{
if (!Version.TryParse(value, out Version? version))
{
throw new InvalidDataException(
$"OpenGL feature version '{value}' is not a valid version.");
}
return version;
}
private static ReadOnlyCollection<T> Freeze<T>(
IEnumerable<T> values
)
{
return Array.AsReadOnly(values.ToArray());
}
private sealed class SymbolSelection
{
private readonly HashSet<string> _active = new HashSet<string>(StringComparer.Ordinal);
private readonly Dictionary<string, string> _introducedVersions = new Dictionary<string, string>(
StringComparer.Ordinal);
private readonly List<string> _order = new List<string>();
public void Require(
string name,
string version
)
{
_active.Add(name);
if (_introducedVersions.TryAdd(name, version))
{
_order.Add(name);
}
}
public void Remove(
string name
)
{
_active.Remove(name);
}
public IEnumerable<string> ReadActiveNames()
{
return _order.Where(_active.Contains);
}
public ReadOnlyDictionary<string, string> FreezeIntroducedVersions()
{
return new ReadOnlyDictionary<string, string>(
new Dictionary<string, string>(
_introducedVersions,
StringComparer.Ordinal));
}
}
}
}
@@ -0,0 +1,26 @@
// -----------------------------------------------------------------------------
// file="GlRegistryProjection"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System.Collections.Generic;
namespace StgSharp.GenerateGL.Registry
{
/// <summary>
/// Represents one API/profile target selected from the complete registry.
/// </summary>
internal sealed record GlRegistryProjection(
GlRegistryModel Source,
string Api,
string Profile,
string MaximumVersion,
IReadOnlyList<GlFeatureDefinition> Features,
IReadOnlyList<GlCommandDefinition> Commands,
IReadOnlyList<GlEnumDefinition> Enums,
IReadOnlyDictionary<string, string> CommandIntroducedVersions,
IReadOnlyDictionary<string, string> EnumIntroducedVersions
);
}
+10 -8
View File
@@ -19,8 +19,7 @@ namespace StgSharp.GenerateGL
internal static class RegistryCli
{
private const int DefaultFindLimit = 10;
private const int DefaultListLimit = 20;
private const int ShowAllResults = int.MaxValue;
private const int QueryErrorExitCode = 1;
private const int SuccessExitCode = 0;
private const int UsageErrorExitCode = 2;
@@ -559,7 +558,7 @@ namespace StgSharp.GenerateGL
}
filter = null;
limit = DefaultListLimit;
limit = ShowAllResults;
int index = 1;
if (index < arguments.Count && !arguments[index].StartsWith(
"--",
@@ -571,7 +570,8 @@ namespace StgSharp.GenerateGL
while (index < arguments.Count)
{
string argument = arguments[index++];
if (argument == "--limit" && TryReadPositiveInt(
if ((argument == "--showcount" || argument == "--limit") &&
TryReadPositiveInt(
arguments,
ref index,
out limit))
@@ -608,7 +608,7 @@ namespace StgSharp.GenerateGL
text = arguments[0];
exact = false;
limit = DefaultFindLimit;
limit = ShowAllResults;
int index = 1;
while (index < arguments.Count)
{
@@ -619,7 +619,8 @@ namespace StgSharp.GenerateGL
continue;
}
if (argument == "--limit" && TryReadPositiveInt(
if ((argument == "--showcount" || argument == "--limit") &&
TryReadPositiveInt(
arguments,
ref index,
out limit))
@@ -653,12 +654,13 @@ namespace StgSharp.GenerateGL
}
name = arguments[1];
limit = DefaultListLimit;
limit = ShowAllResults;
int index = 2;
while (index < arguments.Count)
{
string argument = arguments[index++];
if (argument == "--limit" && TryReadPositiveInt(
if ((argument == "--showcount" || argument == "--limit") &&
TryReadPositiveInt(
arguments,
ref index,
out limit))
@@ -0,0 +1,59 @@
// -----------------------------------------------------------------------------
// file="TargetRegistryCli"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using StgSharp.GenerateGL.Registry;
namespace StgSharp.GenerateGL
{
internal static class TargetRegistryCli
{
private const int SuccessExitCode = 0;
private const int UsageErrorExitCode = 2;
public static int Execute(
GlRegistryProjection projection,
IReadOnlyList<string> arguments
)
{
ArgumentNullException.ThrowIfNull(projection);
ArgumentNullException.ThrowIfNull(arguments);
if (arguments.Count > 1 || arguments.Count == 1 && !string.Equals(
arguments[0],
"summary",
StringComparison.OrdinalIgnoreCase))
{
Console.Error.WriteLine("error: target accepts only the 'summary' command.");
return UsageErrorExitCode;
}
Console.WriteLine("Registry target projection");
WriteProperty("api", projection.Api);
WriteProperty("profile", projection.Profile);
WriteProperty("maximum version", projection.MaximumVersion);
WriteProperty("features", projection.Features.Count);
WriteProperty("commands", projection.Commands.Count);
WriteProperty("enums", projection.Enums.Count);
WriteProperty("extensions", 0);
WriteProperty("source commands", projection.Source.Commands.Count);
WriteProperty("source extensions", projection.Source.Extensions.Count);
return SuccessExitCode;
}
private static void WriteProperty(
string name,
object value
)
{
Console.WriteLine($" {name}: {value}");
}
}
}
+65 -25
View File
@@ -14,6 +14,7 @@ using System.Text;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using StgSharp.GenerateGL.Analysis;
using StgSharp.GenerateGL.Generation;
using StgSharp.GenerateGL.Registry;
using StgSharp.GenerateGL.Tree;
@@ -26,10 +27,9 @@ namespace StgSharp.GenerateGL
internal const int LoadErrorExitCode = 3;
private const int DefaultDepth = 2;
private const int DefaultLimit = 20;
private const int DefaultSearchLimit = 5;
private const int ShowAllResults = int.MaxValue;
private const int ReadableDepth = 6;
private const int SearchReadableChildLimit = 8;
private const int SearchContextParentChildThreshold = 20;
private const int SearchReadableDepth = 4;
private const int QueryErrorExitCode = 1;
private const int SuccessExitCode = 0;
@@ -85,6 +85,12 @@ namespace StgSharp.GenerateGL
command,
arguments),
"GENERATE" or "GEN" => QueryGenerate(session, arguments),
"TARGET" => TargetRegistryCli.Execute(
session.TargetRegistry,
arguments),
"FAMILY" or "FAMILIES" => FunctionFamilyCli.Execute(
session.FunctionFamilies,
arguments),
"PREVIEW" => GenerateCli.Preview(
session.GeneratedFiles,
arguments),
@@ -113,7 +119,7 @@ namespace StgSharp.GenerateGL
)
{
int result = GenerateCli.Generate(
session.Registry,
session.TargetRegistry,
arguments,
out GeneratedFileSet? generatedFiles);
if (generatedFiles is not null)
@@ -192,7 +198,7 @@ namespace StgSharp.GenerateGL
context,
0,
SearchReadableDepth,
SearchReadableChildLimit);
ShowAllResults);
}
WriteTruncation(matches.Length, displayedCount);
@@ -229,7 +235,7 @@ namespace StgSharp.GenerateGL
}
Console.WriteLine($"[{index + 1}] {GetElementPath(element)}");
WriteReadableElement(element, 0, ReadableDepth, DefaultLimit);
WriteReadableElement(element, 0, ReadableDepth, ShowAllResults);
}
WriteTruncation(matches.Length, displayedCount);
@@ -610,8 +616,11 @@ namespace StgSharp.GenerateGL
break;
}
if (parentLevels is null && parent.Elements().Take(DefaultLimit + 1).Count() >
DefaultLimit)
if (parentLevels is null && parent.Elements()
.Take(
SearchContextParentChildThreshold + 1)
.Count() >
SearchContextParentChildThreshold)
{
break;
}
@@ -1115,7 +1124,7 @@ namespace StgSharp.GenerateGL
{
string xpath = "/*";
int depth = DefaultDepth;
int limit = DefaultLimit;
int limit = ShowAllResults;
bool includeWhitespace = false;
int index = 0;
if (arguments.Count != 0 && !arguments[0].StartsWith("--", StringComparison.Ordinal))
@@ -1141,7 +1150,8 @@ namespace StgSharp.GenerateGL
continue;
}
if (argument == "--limit" && TryReadPositiveInt(
if ((argument == "--showcount" || argument == "--limit") &&
TryReadPositiveInt(
arguments,
ref index,
out limit))
@@ -1173,7 +1183,7 @@ namespace StgSharp.GenerateGL
}
string text = arguments[0];
int limit = DefaultSearchLimit;
int limit = ShowAllResults;
int? parentLevels = null;
bool exact = false;
int index = 1;
@@ -1186,7 +1196,8 @@ namespace StgSharp.GenerateGL
continue;
}
if (argument == "--limit" && TryReadPositiveInt(
if ((argument == "--showcount" || argument == "--limit") &&
TryReadPositiveInt(
arguments,
ref index,
out limit))
@@ -1228,12 +1239,13 @@ namespace StgSharp.GenerateGL
}
string xpath = arguments[0];
int limit = DefaultLimit;
int limit = ShowAllResults;
int index = 1;
while (index < arguments.Count)
{
string argument = arguments[index++];
if (argument == "--limit" && TryReadPositiveInt(
if ((argument == "--showcount" || argument == "--limit") &&
TryReadPositiveInt(
arguments,
ref index,
out limit))
@@ -1391,9 +1403,24 @@ namespace StgSharp.GenerateGL
return;
}
if (arguments is { Length: 1 } && (
string.Equals(
arguments[0],
"family",
StringComparison.OrdinalIgnoreCase) ||
string.Equals(
arguments[0],
"families",
StringComparison.OrdinalIgnoreCase)))
{
FunctionFamilyCli.WriteHelp();
return;
}
if (arguments is { Length: > 0 })
{
Console.Error.WriteLine("error: help accepts only the 'generate' topic.");
Console.Error.WriteLine(
"error: help accepts only the 'generate' or 'families' topic.");
return;
}
@@ -1404,12 +1431,15 @@ namespace StgSharp.GenerateGL
Console.WriteLine(" StgSharp.GenerateGL [--xml <path>] shell");
Console.WriteLine(" StgSharp.GenerateGL [--xml <path>] summary");
Console.WriteLine(" StgSharp.GenerateGL [--xml <path>] list <category> " +
"[filter] [--limit <n>]");
"[filter] [--showcount <n>]");
Console.WriteLine(" StgSharp.GenerateGL [--xml <path>] find <text> " +
"[--exact] [--limit <n>]");
"[--exact] [--showcount <n>]");
Console.WriteLine(" StgSharp.GenerateGL [--xml <path>] show <category> <name> " +
"[--limit <n>]");
Console.WriteLine(" StgSharp.GenerateGL [--xml <path>] generate");
"[--showcount <n>]");
Console.WriteLine(
" StgSharp.GenerateGL [--xml <path>] generate [output-directory]");
Console.WriteLine(" StgSharp.GenerateGL [--xml <path>] target summary");
Console.WriteLine(" StgSharp.GenerateGL [--xml <path>] families <command>");
Console.WriteLine(" StgSharp.GenerateGL [--xml <path>] list files");
Console.WriteLine(" StgSharp.GenerateGL [--xml <path>] preview <filename>");
Console.WriteLine(" StgSharp.GenerateGL [--xml <path>] xml <command> [...]");
@@ -1424,7 +1454,11 @@ namespace StgSharp.GenerateGL
Console.WriteLine(" StgSharp.GenerateGL find glBindBuffer");
Console.WriteLine(" StgSharp.GenerateGL show command glBindBuffer");
Console.WriteLine(" StgSharp.GenerateGL show extension GL_KHR_debug");
Console.WriteLine(" StgSharp.GenerateGL target summary");
Console.WriteLine(" StgSharp.GenerateGL families show VertexAttribP");
Console.WriteLine(" StgSharp.GenerateGL generate");
Console.WriteLine(
" StgSharp.GenerateGL generate src/StgSharp.Graphics/OpenGL/Generated");
Console.WriteLine(" StgSharp.GenerateGL list files");
Console.WriteLine(" StgSharp.GenerateGL preview glconst.cs");
Console.WriteLine(" StgSharp.GenerateGL xml tree --depth 1");
@@ -1443,13 +1477,13 @@ namespace StgSharp.GenerateGL
Console.WriteLine(" xml summary");
Console.WriteLine(" xml raw");
Console.WriteLine(
" xml tree [xpath] [--depth <n>] [--limit <n>] [--whitespace]");
" xml tree [xpath] [--depth <n>] [--showcount <n>] [--whitespace]");
Console.WriteLine(
" xml find <text> [--exact] [--up <n>] [--limit <n>]");
Console.WriteLine(" xml show <xpath> [--limit <n>]");
Console.WriteLine(" xml select <xpath> [--limit <n>]");
Console.WriteLine(" xml text <xpath> [--limit <n>]");
Console.WriteLine(" xml attributes <xpath> [--limit <n>]");
" xml find <text> [--exact] [--up <n>] [--showcount <n>]");
Console.WriteLine(" xml show <xpath> [--showcount <n>]");
Console.WriteLine(" xml select <xpath> [--showcount <n>]");
Console.WriteLine(" xml text <xpath> [--showcount <n>]");
Console.WriteLine(" xml attributes <xpath> [--showcount <n>]");
}
private sealed class CliSession
@@ -1462,12 +1496,18 @@ namespace StgSharp.GenerateGL
{
Document = document;
Registry = registry;
TargetRegistry = DesktopGlCoreRegistryFilter.Apply(registry);
FunctionFamilies = GlFunctionFamilyAnalyzer.Analyze(TargetRegistry);
}
public XmlTreeDocument Document { get; }
public GlRegistryModel Registry { get; }
public GlRegistryProjection TargetRegistry { get; }
public GlFunctionFamilyAnalysis FunctionFamilies { get; }
public GeneratedFileSet GeneratedFiles { get; set; } = GeneratedFileSet.Empty;
}