generate glenum, link glenum, add source gen for text regex

This commit is contained in:
Youmu Liu
2026-08-31 18:12:44 +08:00
parent 667b8d8e43
commit e52d0ac6f3
54 changed files with 4555 additions and 1596 deletions
+25 -23
View File
@@ -7,6 +7,7 @@
using StgSharp.Mathematics.Numeric.Graphics;
using System;
using System.Numerics;
namespace StgSharp.Mathematics.Numeric.Graphics
{
@@ -22,13 +23,13 @@ namespace StgSharp.Mathematics.Numeric.Graphics
internal Radius _pitch;
internal Radius _row;
internal Radius _yaw;
internal Vec3 _target, up;
internal Vec3<float> _target, up;
public Camera()
{
cameraAtt = GraphicsMatrix.Unit;
_target = Vec3.Zero;
up = Vec3.Zero;
_target = Vec3<float>.Zero;
up = Vec3<float>.Zero;
_isLookAtAvailable = false;
_lookAt = GraphicsMatrix.Unit;
rotationAtt = GraphicsMatrix.Unit;
@@ -36,9 +37,9 @@ namespace StgSharp.Mathematics.Numeric.Graphics
}
public Camera(
Vec3 position,
Vec3 target,
Vec3 up
Vec3<float> position,
Vec3<float> target,
Vec3<float> up
)
: this()
{
@@ -60,7 +61,7 @@ namespace StgSharp.Mathematics.Numeric.Graphics
return _lookAt;
}
GraphicsMatrix move = GraphicsMatrix.Unit;
move.column[3].vec -= cameraAtt.column[3].vec;
move.column[3] -= cameraAtt.column[3];
_lookAt = rotationAtt.Transpose * move;
_isLookAtAvailable = true;
return _lookAt;
@@ -97,15 +98,15 @@ namespace StgSharp.Mathematics.Numeric.Graphics
}
public void SetViewDirection(
Vec3 position,
Vec3 target,
Vec3 up
Vec3<float> position,
Vec3<float> target,
Vec3<float> up
)
{
Vec3 direction = position - target;
if ((position.reg == cameraAtt.column[3].reg) &&
Vec3<float> direction = position - target;
if ((position == cameraAtt.column[3].XYZ) &&
(this.up == up) &&
(cameraAtt.column[3].reg == direction.reg)) {
(cameraAtt.column[3].XYZ == direction)) {
return;
}
if (direction.GetLength() == 0)
@@ -123,12 +124,12 @@ namespace StgSharp.Mathematics.Numeric.Graphics
direction.Orthogonalize(ref up);
Vec3 right = Linear.Orthogonalize(Linear.Cross(up, direction));
Vec3<float> right = Linear.Orthogonalize(Vec3.Cross(up, direction));
cameraAtt.column[0].reg = right.reg;
cameraAtt.column[1].reg = up.reg;
cameraAtt.column[2].reg = direction.reg;
cameraAtt.column[3].reg = position.reg;
cameraAtt.column[0].XYZ = right;
cameraAtt.column[1].XYZ = up;
cameraAtt.column[2].XYZ = direction;
cameraAtt.column[3].XYZ = position;
InternalPitch();
InternalRow();
@@ -137,8 +138,8 @@ namespace StgSharp.Mathematics.Numeric.Graphics
public void SetViewRange(
Radius fovRadius,
Vec2 size,
Vec2 offset,
Vec2<float> size,
Vec2<float> offset,
(float front, float back) depthRange
)
{
@@ -161,15 +162,16 @@ namespace StgSharp.Mathematics.Numeric.Graphics
}
public void Test(
params Vec4[] vec
params Vec4<float>[] vec
)
{
Console.WriteLine(View);
Console.WriteLine(Projection);
Console.WriteLine(Projection * View);
Console.WriteLine(View);
foreach (Vec4 item in vec) {
Console.Write($"{Projection * View * item};");
foreach (Vec4<float> item in vec)
{
// Console.Write($"{Projection * View * item};");
}
}
@@ -1,76 +0,0 @@
// -----------------------------------------------------------------------------
// file="OpenGLFunction.Context"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
private static readonly Dictionary<IntPtr, OpenGLFunction> contextToGLMap = [];
private static readonly ThreadLocal<OpenGLFunction> _currentGL = new();
private OpenglContext* _context;
private readonly Lazy<int> _attachmentColorRange;
private OpenGLFunction()
{
// textureUnitCountGetter = glConst.MAX_TEXTURE_IMAGE_UNITS;
// UnusedTextureImageUint = [];
_attachmentColorRange = new Lazy<int>(
() => GetMaskInteger(glConst.MAX_COLOR_ATTACHMENTS));
}
public int AttachmentColorRange => _attachmentColorRange.Value;
public static OpenGLFunction CurrentGL
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _currentGL.Value!;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal set => _currentGL.Value = value;
}
internal IntPtr ContextHandle => (IntPtr)_context;
protected ref OpenglContext Context
{
get
{
#if DEBUG
ArgumentNullException.ThrowIfNull(_context, nameof(_context));
#endif
return ref (*_context);
}
}
internal static OpenGLFunction BuildGlFunctionPackage(
IntPtr handle
)
{
if (contextToGLMap.TryGetValue(handle, out OpenGLFunction pack)) {
return pack;
}
pack = new OpenGLFunction
{
_context = (OpenglContext*)handle
};
contextToGLMap.Add(handle, pack);
return pack;
}
~OpenGLFunction()
{
_ = contextToGLMap.Remove(ContextHandle);
}
}
}
@@ -19,7 +19,7 @@ namespace StgSharp.Graphics.OpenGL
bool shouldReportWhenNormal
)
{
uint code = _context->glGetError();
uint code = __context->glGetError();
if (code != glConst.NO_ERROR) {
throw new GlExecutionException(code);
}
@@ -34,7 +34,7 @@ namespace StgSharp.Graphics.OpenGL
uint code = 0;
for (int i = 0; i < 1024; i++)
{
code = _context->glGetError();
code = __context->glGetError();
if (code == 0) {
return;
}
@@ -50,7 +50,7 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void ClearGraphicError()
{
while (_context->glGetError() != 0) { }
while (__context->glGetError() != 0) { }
}
public unsafe int GetMaskInteger(
@@ -58,14 +58,14 @@ namespace StgSharp.Graphics.OpenGL
)
{
int ret = 0;
_context->glGetIntegerv(statusCode, &ret);
__context->glGetIntegerv(statusCode, &ret);
return ret;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void WaitAccomplishment()
{
_context->glFinish();
__context->glFinish();
}
}
@@ -38,10 +38,10 @@ namespace StgSharp.Graphics.OpenGL
ShaderType type
)
{
GlHandle handle = CreateShader((uint)type);
GlHandle handle = GlHandle.Create(__context->glCreateShader((uint)type));
if (handle.Value == 0)
{
uint error = _context->glGetError();
uint error = __context->glGetError();
throw new InvalidOperationException($"Failed in creating shader: {error}");
}
return handle;
@@ -76,13 +76,13 @@ namespace StgSharp.Graphics.OpenGL
)
{
int status;
_context->glGetShaderiv(shader.Value, statusName, &status);
__context->glGetShaderiv(shader.Value, statusName, &status);
if (status != 0) {
return string.Empty;
}
int logLength;
_context->glGetShaderiv(shader.Value, glConst.INFO_LOG_LENGTH, &logLength);
__context->glGetShaderiv(shader.Value, glConst.INFO_LOG_LENGTH, &logLength);
if (logLength <= 1) {
return string.Empty;
}
@@ -91,75 +91,11 @@ namespace StgSharp.Graphics.OpenGL
fixed (byte* logPtr = log)
{
int written;
_context->glGetShaderInfoLog(shader.Value, log.Length, &written, logPtr);
__context->glGetShaderInfoLog(shader.Value, log.Length, &written, logPtr);
return Encoding.UTF8.GetString(log, 0, Math.Clamp(written, 0, log.Length));
}
}
public GlHandle GetUniformLocation(
GlHandle program,
string name
)
{
ArgumentNullException.ThrowIfNull(name);
int byteCount = Encoding.UTF8.GetByteCount(name);
Span<byte> utf8Name = byteCount < 256
? stackalloc byte[byteCount + 1]
: new byte[byteCount + 1];
int written = Encoding.UTF8.GetBytes(name.AsSpan(), utf8Name);
utf8Name[written] = 0;
int location;
fixed (byte* namePtr = utf8Name) {
location = _context->glGetUniformLocation(program.Value, namePtr);
}
#if DEBUG
if (location == -1) {
throw new UniformEmptyReferenceException(nameof(program), name);
}
#endif
return GlHandle.CreateSigned(location);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Uniform<T> GetUniform<T>(
GlHandle program,
string name
) where T : unmanaged
{
return new Uniform<T>(GetUniformLocation(program, name));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Uniform<T, U> GetUniform<T, U>(
GlHandle program,
string name
) where T : unmanaged where U : struct
{
return new Uniform<T, U>(GetUniformLocation(program, name));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Uniform<T, U, V> GetUniform<T, U, V>(
GlHandle program,
string name
) where T : unmanaged where U : struct where V : struct
{
return new Uniform<T, U, V>(GetUniformLocation(program, name));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Uniform<T, U, V, W> GetUniform<T, U, V, W>(
GlHandle program,
string name
) where T : unmanaged where U : struct where V : struct where W : struct
{
return new Uniform<T, U, V, W>(GetUniformLocation(program, name));
}
public void ShaderSource(
GlHandle shader,
ReadOnlySpan<byte> source
@@ -170,10 +106,23 @@ namespace StgSharp.Graphics.OpenGL
{
byte emptySource = 0;
byte* sourceAddress = sourcePtr == null ? &emptySource : sourcePtr;
_context->glShaderSource(shader.Value, 1, &sourceAddress, &length);
__context->glShaderSource(shader.Value, 1, &sourceAddress, &length);
}
}
public void ShaderSource(
GlHandle shader,
ReadOnlySpan<char> source
)
{
int byteCount = Encoding.UTF8.GetByteCount(source);
Span<byte> utf8Source = byteCount < 1024 ?
stackalloc byte[byteCount] :
new byte[byteCount];
int written = Encoding.UTF8.GetBytes(source, utf8Source);
ShaderSource(shader, utf8Source[..written]);
}
public void ShaderSource(
GlHandle shader,
string source
@@ -182,9 +131,9 @@ namespace StgSharp.Graphics.OpenGL
ArgumentNullException.ThrowIfNull(source);
int byteCount = Encoding.UTF8.GetByteCount(source);
Span<byte> utf8Source = byteCount < 1024
? stackalloc byte[byteCount]
: new byte[byteCount];
Span<byte> utf8Source = byteCount < 1024 ?
stackalloc byte[byteCount] :
new byte[byteCount];
int written = Encoding.UTF8.GetBytes(source.AsSpan(), utf8Source);
ShaderSource(shader, utf8Source[..written]);
}
@@ -7,19 +7,6 @@
namespace StgSharp.Graphics.OpenGL
{
#pragma warning disable CA1008
#pragma warning disable CA1028
public enum FrameBufferTarget : uint
#pragma warning restore CA1028
#pragma warning restore CA1008
{
Read = glConst.READ_FRAMEBUFFER,
All = glConst.FRAMEBUFFER,
Draw = glConst.DRAW_FRAMEBUFFER,
}
/// <summary>A set of OpenGL framebuffer handles.</summary>
public sealed record class FrameBuffer(
GlHandle[] Handles
@@ -40,30 +40,6 @@ namespace StgSharp.Graphics.OpenGL
}
#pragma warning disable CA1008
public enum TextureUnit
#pragma warning restore CA1008
{
Unit0 = glConst.TEXTURE0,
Unit1 = glConst.TEXTURE1,
Unit2 = glConst.TEXTURE2,
Unit3 = glConst.TEXTURE3,
Unit4 = glConst.TEXTURE4,
Unit5 = glConst.TEXTURE5,
Unit6 = glConst.TEXTURE6,
Unit7 = glConst.TEXTURE7,
Unit8 = glConst.TEXTURE8,
Unit9 = glConst.TEXTURE9,
Unit10 = glConst.TEXTURE10,
Unit11 = glConst.TEXTURE11,
Unit12 = glConst.TEXTURE12,
Unit13 = glConst.TEXTURE13,
Unit14 = glConst.TEXTURE14,
Unit15 = glConst.TEXTURE15,
}
#pragma warning disable CA1008
public enum TextureWrap
#pragma warning restore CA1008
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,3 +1,10 @@
// -----------------------------------------------------------------------------
// file="OpenGLFunction.v3_3"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 3.3 core-profile forwarding methods.
@@ -91,9 +98,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glSamplerParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SamplerParameter(GlHandle sampler, uint pName, int param)
public void SamplerParameter(GlHandle sampler, SamplerParameterI pName, int param)
{
__context->glSamplerParameteri(sampler.Value, pName, param);
__context->glSamplerParameteri(sampler.Value, (uint)pName, param);
}
/// <summary>
@@ -102,9 +109,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glSamplerParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SamplerParameter(GlHandle sampler, uint pName, int* param)
public void SamplerParameter(GlHandle sampler, SamplerParameterI pName, int* param)
{
__context->glSamplerParameteriv(sampler.Value, pName, param);
__context->glSamplerParameteriv(sampler.Value, (uint)pName, param);
}
/// <summary>
@@ -113,9 +120,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glSamplerParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SamplerParameter(GlHandle sampler, uint pName, float param)
public void SamplerParameter(GlHandle sampler, SamplerParameterF pName, float param)
{
__context->glSamplerParameterf(sampler.Value, pName, param);
__context->glSamplerParameterf(sampler.Value, (uint)pName, param);
}
/// <summary>
@@ -124,9 +131,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glSamplerParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SamplerParameter(GlHandle sampler, uint pName, float* param)
public void SamplerParameter(GlHandle sampler, SamplerParameterF pName, float* param)
{
__context->glSamplerParameterfv(sampler.Value, pName, param);
__context->glSamplerParameterfv(sampler.Value, (uint)pName, param);
}
/// <summary>
@@ -135,9 +142,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glSamplerParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SamplerParameterInteger(GlHandle sampler, uint pName, int* param)
public void SamplerParameterInteger(GlHandle sampler, SamplerParameterI pName, int* param)
{
__context->glSamplerParameterIiv(sampler.Value, pName, param);
__context->glSamplerParameterIiv(sampler.Value, (uint)pName, param);
}
/// <summary>
@@ -146,9 +153,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glSamplerParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SamplerParameterInteger(GlHandle sampler, uint pName, uint* param)
public void SamplerParameterInteger(GlHandle sampler, SamplerParameterI pName, uint* param)
{
__context->glSamplerParameterIuiv(sampler.Value, pName, param);
__context->glSamplerParameterIuiv(sampler.Value, (uint)pName, param);
}
/// <summary>
@@ -157,9 +164,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetSamplerParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetSamplerParameter(GlHandle sampler, uint pName, int* @params)
public void GetSamplerParameter(GlHandle sampler, SamplerParameterI pName, int* @params)
{
__context->glGetSamplerParameteriv(sampler.Value, pName, @params);
__context->glGetSamplerParameteriv(sampler.Value, (uint)pName, @params);
}
/// <summary>
@@ -168,9 +175,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetSamplerParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetSamplerParameterInteger(GlHandle sampler, uint pName, int* @params)
public void GetSamplerParameterInteger(GlHandle sampler, SamplerParameterI pName, int* @params)
{
__context->glGetSamplerParameterIiv(sampler.Value, pName, @params);
__context->glGetSamplerParameterIiv(sampler.Value, (uint)pName, @params);
}
/// <summary>
@@ -179,9 +186,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetSamplerParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetSamplerParameter(GlHandle sampler, uint pName, float* @params)
public void GetSamplerParameter(GlHandle sampler, SamplerParameterF pName, float* @params)
{
__context->glGetSamplerParameterfv(sampler.Value, pName, @params);
__context->glGetSamplerParameterfv(sampler.Value, (uint)pName, @params);
}
/// <summary>
@@ -190,9 +197,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetSamplerParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetSamplerParameterInteger(GlHandle sampler, uint pName, uint* @params)
public void GetSamplerParameterInteger(GlHandle sampler, SamplerParameterI pName, uint* @params)
{
__context->glGetSamplerParameterIuiv(sampler.Value, pName, @params);
__context->glGetSamplerParameterIuiv(sampler.Value, (uint)pName, @params);
}
/// <summary>
@@ -201,9 +208,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glQueryCounter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void QueryCounter(GlHandle id, uint target)
public void QueryCounter(GlHandle id, QueryCounterTarget target)
{
__context->glQueryCounter(id.Value, target);
__context->glQueryCounter(id.Value, (uint)target);
}
/// <summary>
@@ -212,9 +219,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetQueryObject">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryObject(GlHandle id, uint pName, long* @params)
public void GetQueryObject(GlHandle id, QueryObjectParameterName pName, long* @params)
{
__context->glGetQueryObjecti64v(id.Value, pName, @params);
__context->glGetQueryObjecti64v(id.Value, (uint)pName, @params);
}
/// <summary>
@@ -223,9 +230,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetQueryObject">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryObject(GlHandle id, uint pName, ulong* @params)
public void GetQueryObject(GlHandle id, QueryObjectParameterName pName, ulong* @params)
{
__context->glGetQueryObjectui64v(id.Value, pName, @params);
__context->glGetQueryObjectui64v(id.Value, (uint)pName, @params);
}
/// <summary>
@@ -245,9 +252,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glVertexAttrib">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributePacked1(uint index, uint type, byte normalized, uint value)
public void VertexAttributePacked1(uint index, VertexAttributePointerType type, byte normalized, uint value)
{
__context->glVertexAttribP1ui(index, type, normalized, value);
__context->glVertexAttribP1ui(index, (uint)type, normalized, value);
}
/// <summary>
@@ -256,9 +263,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glVertexAttrib">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributePacked2(uint index, uint type, byte normalized, uint value)
public void VertexAttributePacked2(uint index, VertexAttributePointerType type, byte normalized, uint value)
{
__context->glVertexAttribP2ui(index, type, normalized, value);
__context->glVertexAttribP2ui(index, (uint)type, normalized, value);
}
/// <summary>
@@ -267,9 +274,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glVertexAttrib">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributePacked3(uint index, uint type, byte normalized, uint value)
public void VertexAttributePacked3(uint index, VertexAttributePointerType type, byte normalized, uint value)
{
__context->glVertexAttribP3ui(index, type, normalized, value);
__context->glVertexAttribP3ui(index, (uint)type, normalized, value);
}
/// <summary>
@@ -278,9 +285,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glVertexAttrib">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributePacked4(uint index, uint type, byte normalized, uint value)
public void VertexAttributePacked4(uint index, VertexAttributePointerType type, byte normalized, uint value)
{
__context->glVertexAttribP4ui(index, type, normalized, value);
__context->glVertexAttribP4ui(index, (uint)type, normalized, value);
}
}
@@ -1,10 +1,17 @@
// -----------------------------------------------------------------------------
// file="OpenGLFunction.v4_0"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 4.0 core-profile forwarding methods.
// </auto-generated>
using StgSharp.Mathematics.Numeric.Graphics;
using StgSharp.Mathematics.Numeric.Graphics;
using System;
using System.Runtime.CompilerServices;
@@ -30,9 +37,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glBlendEquationi">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendEquationi(uint buf, uint mode)
public void BlendEquationi(uint buf, BlendEquationMode mode)
{
__context->glBlendEquationi(buf, mode);
__context->glBlendEquationi(buf, (uint)mode);
}
/// <summary>
@@ -41,9 +48,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glBlendEquationSeparatei">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendEquationSeparatei(uint buf, uint modeRGB, uint modeAlpha)
public void BlendEquationSeparatei(uint buf, BlendEquationMode modeRGB, BlendEquationMode modeAlpha)
{
__context->glBlendEquationSeparatei(buf, modeRGB, modeAlpha);
__context->glBlendEquationSeparatei(buf, (uint)modeRGB, (uint)modeAlpha);
}
/// <summary>
@@ -52,9 +59,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glBlendFunci">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendFunci(uint buf, uint src, uint dst)
public void BlendFunci(uint buf, BlendingFactor src, BlendingFactor dst)
{
__context->glBlendFunci(buf, src, dst);
__context->glBlendFunci(buf, (uint)src, (uint)dst);
}
/// <summary>
@@ -63,9 +70,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glBlendFuncSeparatei">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendFuncSeparatei(uint buf, uint srcRGB, uint dstRGB, uint srcAlpha, uint dstAlpha)
public void BlendFuncSeparatei(uint buf, BlendingFactor srcRGB, BlendingFactor dstRGB, BlendingFactor srcAlpha, BlendingFactor dstAlpha)
{
__context->glBlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
__context->glBlendFuncSeparatei(buf, (uint)srcRGB, (uint)dstRGB, (uint)srcAlpha, (uint)dstAlpha);
}
/// <summary>
@@ -74,9 +81,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glDrawArraysIndirect">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawArraysIndirect(uint mode, void* indirect)
public void DrawArraysIndirect(PrimitiveType mode, void* indirect)
{
__context->glDrawArraysIndirect(mode, indirect);
__context->glDrawArraysIndirect((uint)mode, indirect);
}
/// <summary>
@@ -85,9 +92,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glDrawElementsIndirect">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawElementsIndirect(uint mode, uint type, void* indirect)
public void DrawElementsIndirect(PrimitiveType mode, DrawElementsType type, void* indirect)
{
__context->glDrawElementsIndirect(mode, type, indirect);
__context->glDrawElementsIndirect((uint)mode, (uint)type, indirect);
}
/// <summary>
@@ -212,9 +219,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetSubroutineUniformLocation">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetSubroutineUniformLocation(GlHandle program, uint shadertype, byte* name)
public int GetSubroutineUniformLocation(GlHandle program, ShaderType shadertype, byte* name)
{
return __context->glGetSubroutineUniformLocation(program.Value, shadertype, name);
return __context->glGetSubroutineUniformLocation(program.Value, (uint)shadertype, name);
}
/// <summary>
@@ -223,9 +230,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetSubroutineIndex">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetSubroutineIndex(GlHandle program, uint shadertype, byte* name)
public uint GetSubroutineIndex(GlHandle program, ShaderType shadertype, byte* name)
{
return __context->glGetSubroutineIndex(program.Value, shadertype, name);
return __context->glGetSubroutineIndex(program.Value, (uint)shadertype, name);
}
/// <summary>
@@ -234,9 +241,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetActiveSubroutineUniformiv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveSubroutineUniformiv(GlHandle program, uint shadertype, uint index, uint pName, int* values)
public void GetActiveSubroutineUniformiv(GlHandle program, ShaderType shadertype, uint index, SubroutineParameterName pName, int* values)
{
__context->glGetActiveSubroutineUniformiv(program.Value, shadertype, index, pName, values);
__context->glGetActiveSubroutineUniformiv(program.Value, (uint)shadertype, index, (uint)pName, values);
}
/// <summary>
@@ -245,9 +252,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetActiveSubroutineUniformName">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveSubroutineUniformName(GlHandle program, uint shadertype, uint index, int bufSize, int* length, byte* name)
public void GetActiveSubroutineUniformName(GlHandle program, ShaderType shadertype, uint index, int bufSize, int* length, byte* name)
{
__context->glGetActiveSubroutineUniformName(program.Value, shadertype, index, bufSize, length, name);
__context->glGetActiveSubroutineUniformName(program.Value, (uint)shadertype, index, bufSize, length, name);
}
/// <summary>
@@ -256,9 +263,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetActiveSubroutineName">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveSubroutineName(GlHandle program, uint shadertype, uint index, int bufSize, int* length, byte* name)
public void GetActiveSubroutineName(GlHandle program, ShaderType shadertype, uint index, int bufSize, int* length, byte* name)
{
__context->glGetActiveSubroutineName(program.Value, shadertype, index, bufSize, length, name);
__context->glGetActiveSubroutineName(program.Value, (uint)shadertype, index, bufSize, length, name);
}
/// <summary>
@@ -267,9 +274,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glUniformSubroutinesuiv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UniformSubroutinesuiv(uint shadertype, int count, uint* indices)
public void UniformSubroutinesuiv(ShaderType shadertype, int count, uint* indices)
{
__context->glUniformSubroutinesuiv(shadertype, count, indices);
__context->glUniformSubroutinesuiv((uint)shadertype, count, indices);
}
/// <summary>
@@ -278,9 +285,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetUniformSubroutineuiv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetUniformSubroutineuiv(uint shadertype, int location, uint* @params)
public void GetUniformSubroutineuiv(ShaderType shadertype, int location, uint* @params)
{
__context->glGetUniformSubroutineuiv(shadertype, location, @params);
__context->glGetUniformSubroutineuiv((uint)shadertype, location, @params);
}
/// <summary>
@@ -289,9 +296,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetProgramStageiv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramStageiv(GlHandle program, uint shadertype, uint pName, int* values)
public void GetProgramStageiv(GlHandle program, ShaderType shadertype, ProgramStagePName pName, int* values)
{
__context->glGetProgramStageiv(program.Value, shadertype, pName, values);
__context->glGetProgramStageiv(program.Value, (uint)shadertype, (uint)pName, values);
}
/// <summary>
@@ -300,9 +307,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glPatchParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PatchParameter(uint pName, int value)
public void PatchParameter(PatchParameterName pName, int value)
{
__context->glPatchParameteri(pName, value);
__context->glPatchParameteri((uint)pName, value);
}
/// <summary>
@@ -311,9 +318,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glPatchParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PatchParameter(uint pName, float* values)
public void PatchParameter(PatchParameterName pName, float* values)
{
__context->glPatchParameterfv(pName, values);
__context->glPatchParameterfv((uint)pName, values);
}
/// <summary>
@@ -322,9 +329,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glBindTransformFeedback">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindTransformFeedback(uint target, GlHandle id)
public void BindTransformFeedback(BindTransformFeedbackTarget target, GlHandle id)
{
__context->glBindTransformFeedback(target, id.Value);
__context->glBindTransformFeedback((uint)target, id.Value);
}
/// <summary>
@@ -394,9 +401,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glDrawTransformFeedback">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedback(uint mode, GlHandle id)
public void DrawTransformFeedback(PrimitiveType mode, GlHandle id)
{
__context->glDrawTransformFeedback(mode, id.Value);
__context->glDrawTransformFeedback((uint)mode, id.Value);
}
/// <summary>
@@ -405,9 +412,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glDrawTransformFeedbackStream">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedbackStream(uint mode, GlHandle id, uint stream)
public void DrawTransformFeedbackStream(PrimitiveType mode, GlHandle id, uint stream)
{
__context->glDrawTransformFeedbackStream(mode, id.Value, stream);
__context->glDrawTransformFeedbackStream((uint)mode, id.Value, stream);
}
/// <summary>
@@ -416,9 +423,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glBeginQueryIndexed">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BeginQueryIndexed(uint target, uint index, GlHandle id)
public void BeginQueryIndexed(QueryTarget target, uint index, GlHandle id)
{
__context->glBeginQueryIndexed(target, index, id.Value);
__context->glBeginQueryIndexed((uint)target, index, id.Value);
}
/// <summary>
@@ -427,9 +434,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glEndQueryIndexed">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void EndQueryIndexed(uint target, uint index)
public void EndQueryIndexed(QueryTarget target, uint index)
{
__context->glEndQueryIndexed(target, index);
__context->glEndQueryIndexed((uint)target, index);
}
/// <summary>
@@ -438,9 +445,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetQueryIndexediv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryIndexediv(uint target, uint index, uint pName, int* @params)
public void GetQueryIndexediv(QueryTarget target, uint index, QueryParameterName pName, int* @params)
{
__context->glGetQueryIndexediv(target, index, pName, @params);
__context->glGetQueryIndexediv((uint)target, index, (uint)pName, @params);
}
}
@@ -1,10 +1,17 @@
// -----------------------------------------------------------------------------
// file="OpenGLFunction.v4_1"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 4.1 core-profile forwarding methods.
// </auto-generated>
using StgSharp.Mathematics.Numeric.Graphics;
using StgSharp.Mathematics.Numeric.Graphics;
using System;
using System.Runtime.CompilerServices;
@@ -30,11 +37,11 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glShaderBinary">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ShaderBinary(ReadOnlySpan<GlHandle> shaders, uint binaryFormat, void* binary, int length)
public void ShaderBinary(ReadOnlySpan<GlHandle> shaders, ShaderBinaryFormat binaryFormat, void* binary, int length)
{
fixed (GlHandle* __shaders = shaders)
{
__context->glShaderBinary(shaders.Length, (uint*)__shaders, binaryFormat, binary, length);
__context->glShaderBinary(shaders.Length, (uint*)__shaders, (uint)binaryFormat, binary, length);
}
}
@@ -44,9 +51,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetShaderPrecisionFormat">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetShaderPrecisionFormat(uint shadertype, uint precisiontype, int* range, int* precision)
public void GetShaderPrecisionFormat(ShaderType shadertype, PrecisionType precisiontype, int* range, int* precision)
{
__context->glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
__context->glGetShaderPrecisionFormat((uint)shadertype, (uint)precisiontype, range, precision);
}
/// <summary>
@@ -99,9 +106,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glProgramParameteri">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProgramParameteri(GlHandle program, uint pName, int value)
public void ProgramParameteri(GlHandle program, ProgramParameterPName pName, int value)
{
__context->glProgramParameteri(program.Value, pName, value);
__context->glProgramParameteri(program.Value, (uint)pName, value);
}
/// <summary>
@@ -110,9 +117,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glUseProgramStages">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UseProgramStages(GlHandle pipeline, uint stages, GlHandle program)
public void UseProgramStages(GlHandle pipeline, UseProgramStageMask stages, GlHandle program)
{
__context->glUseProgramStages(pipeline.Value, stages, program.Value);
__context->glUseProgramStages(pipeline.Value, (uint)stages, program.Value);
}
/// <summary>
@@ -132,9 +139,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glCreateShaderProgramv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public GlHandle CreateShaderProgramv(uint type, int count, byte** strings)
public GlHandle CreateShaderProgramv(ShaderType type, int count, byte** strings)
{
return GlHandle.Create(__context->glCreateShaderProgramv(type, count, strings));
return GlHandle.Create(__context->glCreateShaderProgramv((uint)type, count, strings));
}
/// <summary>
@@ -193,9 +200,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetProgramPipelineiv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramPipelineiv(GlHandle pipeline, uint pName, int* @params)
public void GetProgramPipelineiv(GlHandle pipeline, PipelineParameterName pName, int* @params)
{
__context->glGetProgramPipelineiv(pipeline.Value, pName, @params);
__context->glGetProgramPipelineiv(pipeline.Value, (uint)pName, @params);
}
/// <summary>
@@ -715,9 +722,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glVertexAttribPointer">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeDoublePointer(uint index, int size, uint type, int stride, void* pointer)
public void VertexAttributeDoublePointer(uint index, int size, VertexAttributeLType type, int stride, void* pointer)
{
__context->glVertexAttribLPointer(index, size, type, stride, pointer);
__context->glVertexAttribLPointer(index, size, (uint)type, stride, pointer);
}
/// <summary>
@@ -726,9 +733,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetVertexAttrib">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetVertexAttributeDouble(uint index, uint pName, double* @params)
public void GetVertexAttributeDouble(uint index, VertexAttributeEnum pName, double* @params)
{
__context->glGetVertexAttribLdv(index, pName, @params);
__context->glGetVertexAttribLdv(index, (uint)pName, @params);
}
/// <summary>
@@ -825,11 +832,11 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGet">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetValue(uint target, uint index, Span<float> values)
public void GetValue(GetPName target, uint index, Span<float> values)
{
fixed (float* __value = values)
{
__context->glGetFloati_v(target, index, __value);
__context->glGetFloati_v((uint)target, index, __value);
}
}
@@ -839,11 +846,11 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGet">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetValue(uint target, uint index, Span<double> values)
public void GetValue(GetPName target, uint index, Span<double> values)
{
fixed (double* __value = values)
{
__context->glGetDoublei_v(target, index, __value);
__context->glGetDoublei_v((uint)target, index, __value);
}
}
@@ -1,3 +1,10 @@
// -----------------------------------------------------------------------------
// file="OpenGLFunction.v4_2"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 4.2 core-profile forwarding methods.
@@ -19,9 +26,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glDrawArraysInstancedBaseInstance">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawArraysInstancedBaseInstance(uint mode, int first, int count, int instancecount, uint baseinstance)
public void DrawArraysInstancedBaseInstance(PrimitiveType mode, int first, int count, int instancecount, uint baseinstance)
{
__context->glDrawArraysInstancedBaseInstance(mode, first, count, instancecount, baseinstance);
__context->glDrawArraysInstancedBaseInstance((uint)mode, first, count, instancecount, baseinstance);
}
/// <summary>
@@ -30,9 +37,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glDrawElementsInstancedBaseInstance">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawElementsInstancedBaseInstance(uint mode, int count, uint type, void* indices, int instancecount, uint baseinstance)
public void DrawElementsInstancedBaseInstance(PrimitiveType mode, int count, DrawElementsType type, void* indices, int instancecount, uint baseinstance)
{
__context->glDrawElementsInstancedBaseInstance(mode, count, type, indices, instancecount, baseinstance);
__context->glDrawElementsInstancedBaseInstance((uint)mode, count, (uint)type, indices, instancecount, baseinstance);
}
/// <summary>
@@ -41,9 +48,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glDrawElementsInstancedBaseVertexBaseInstance">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawElementsInstancedBaseVertexBaseInstance(uint mode, int count, uint type, void* indices, int instancecount, int basevertex, uint baseinstance)
public void DrawElementsInstancedBaseVertexBaseInstance(PrimitiveType mode, int count, DrawElementsType type, void* indices, int instancecount, int basevertex, uint baseinstance)
{
__context->glDrawElementsInstancedBaseVertexBaseInstance(mode, count, type, indices, instancecount, basevertex, baseinstance);
__context->glDrawElementsInstancedBaseVertexBaseInstance((uint)mode, count, (uint)type, indices, instancecount, basevertex, baseinstance);
}
/// <summary>
@@ -52,9 +59,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetInternalformat">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetInternalFormat(uint target, uint internalFormat, uint pName, int count, int* @params)
public void GetInternalFormat(TextureTarget target, InternalFormat internalFormat, InternalFormatPName pName, int count, int* @params)
{
__context->glGetInternalformativ(target, internalFormat, pName, count, @params);
__context->glGetInternalformativ((uint)target, (uint)internalFormat, (uint)pName, count, @params);
}
/// <summary>
@@ -63,9 +70,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetActiveAtomicCounterBufferiv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveAtomicCounterBufferiv(GlHandle program, uint bufferIndex, uint pName, int* @params)
public void GetActiveAtomicCounterBufferiv(GlHandle program, uint bufferIndex, AtomicCounterBufferPName pName, int* @params)
{
__context->glGetActiveAtomicCounterBufferiv(program.Value, bufferIndex, pName, @params);
__context->glGetActiveAtomicCounterBufferiv(program.Value, bufferIndex, (uint)pName, @params);
}
/// <summary>
@@ -74,9 +81,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glBindImageTexture">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindImageTexture(uint unit, GlHandle texture, int level, byte layered, int layer, uint access, uint format)
public void BindImageTexture(uint unit, GlHandle texture, int level, byte layered, int layer, BufferAccess access, InternalFormat format)
{
__context->glBindImageTexture(unit, texture.Value, level, layered, layer, access, format);
__context->glBindImageTexture(unit, texture.Value, level, layered, layer, (uint)access, (uint)format);
}
/// <summary>
@@ -85,9 +92,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glMemoryBarrier">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MemoryBarrier(uint barriers)
public void MemoryBarrier(MemoryBarrierMask barriers)
{
__context->glMemoryBarrier(barriers);
__context->glMemoryBarrier((uint)barriers);
}
/// <summary>
@@ -96,9 +103,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTexStorage1D">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage1D(uint target, int levels, uint internalFormat, int width)
public void TexStorage1D(TextureTarget target, int levels, SizedInternalFormat internalFormat, int width)
{
__context->glTexStorage1D(target, levels, internalFormat, width);
__context->glTexStorage1D((uint)target, levels, (uint)internalFormat, width);
}
/// <summary>
@@ -107,9 +114,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTexStorage2D">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage2D(uint target, int levels, uint internalFormat, int width, int height)
public void TexStorage2D(TextureTarget target, int levels, SizedInternalFormat internalFormat, int width, int height)
{
__context->glTexStorage2D(target, levels, internalFormat, width, height);
__context->glTexStorage2D((uint)target, levels, (uint)internalFormat, width, height);
}
/// <summary>
@@ -118,9 +125,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTexStorage3D">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage3D(uint target, int levels, uint internalFormat, int width, int height, int depth)
public void TexStorage3D(TextureTarget target, int levels, SizedInternalFormat internalFormat, int width, int height, int depth)
{
__context->glTexStorage3D(target, levels, internalFormat, width, height, depth);
__context->glTexStorage3D((uint)target, levels, (uint)internalFormat, width, height, depth);
}
/// <summary>
@@ -129,9 +136,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glDrawTransformFeedbackInstanced">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedbackInstanced(uint mode, GlHandle id, int instancecount)
public void DrawTransformFeedbackInstanced(PrimitiveType mode, GlHandle id, int instancecount)
{
__context->glDrawTransformFeedbackInstanced(mode, id.Value, instancecount);
__context->glDrawTransformFeedbackInstanced((uint)mode, id.Value, instancecount);
}
/// <summary>
@@ -140,9 +147,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glDrawTransformFeedbackStreamInstanced">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedbackStreamInstanced(uint mode, GlHandle id, uint stream, int instancecount)
public void DrawTransformFeedbackStreamInstanced(PrimitiveType mode, GlHandle id, uint stream, int instancecount)
{
__context->glDrawTransformFeedbackStreamInstanced(mode, id.Value, stream, instancecount);
__context->glDrawTransformFeedbackStreamInstanced((uint)mode, id.Value, stream, instancecount);
}
}
@@ -1,3 +1,10 @@
// -----------------------------------------------------------------------------
// file="OpenGLFunction.v4_3"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 4.3 core-profile forwarding methods.
@@ -19,9 +26,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glClearBufferData">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearBufferData(uint target, uint internalFormat, uint format, uint type, void* data)
public void ClearBufferData(BufferStorageTarget target, SizedInternalFormat internalFormat, PixelFormat format, PixelType type, void* data)
{
__context->glClearBufferData(target, internalFormat, format, type, data);
__context->glClearBufferData((uint)target, (uint)internalFormat, (uint)format, (uint)type, data);
}
/// <summary>
@@ -30,9 +37,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glClearBufferSubData">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearBufferSubData(uint target, uint internalFormat, nint offset, nint size, uint format, uint type, void* data)
public void ClearBufferSubData(BufferTarget target, SizedInternalFormat internalFormat, nint offset, nint size, PixelFormat format, PixelType type, void* data)
{
__context->glClearBufferSubData(target, internalFormat, offset, size, format, type, data);
__context->glClearBufferSubData((uint)target, (uint)internalFormat, offset, size, (uint)format, (uint)type, data);
}
/// <summary>
@@ -63,9 +70,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glCopyImageSubData">docs.gl</see>.</para>
/// </summary>
[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)
public void CopyImageSubData(uint srcName, CopyImageSubDataTarget srcTarget, int srcLevel, int srcX, int srcY, int srcZ, uint dstName, CopyImageSubDataTarget 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);
__context->glCopyImageSubData(srcName, (uint)srcTarget, srcLevel, srcX, srcY, srcZ, dstName, (uint)dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth);
}
/// <summary>
@@ -74,9 +81,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glFramebufferParameteri">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FrameBufferParameteri(uint target, uint pName, int param)
public void FrameBufferParameteri(FrameBufferTarget target, FrameBufferParameterName pName, int param)
{
__context->glFramebufferParameteri(target, pName, param);
__context->glFramebufferParameteri((uint)target, (uint)pName, param);
}
/// <summary>
@@ -85,9 +92,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetFramebufferParameteriv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetFrameBufferParameteriv(uint target, uint pName, int* @params)
public void GetFrameBufferParameteriv(FrameBufferTarget target, FrameBufferAttachmentParameterName pName, int* @params)
{
__context->glGetFramebufferParameteriv(target, pName, @params);
__context->glGetFramebufferParameteriv((uint)target, (uint)pName, @params);
}
/// <summary>
@@ -96,9 +103,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetInternalformat">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetInternalFormat(uint target, uint internalFormat, uint pName, int count, long* @params)
public void GetInternalFormat(TextureTarget target, InternalFormat internalFormat, InternalFormatPName pName, int count, long* @params)
{
__context->glGetInternalformati64v(target, internalFormat, pName, count, @params);
__context->glGetInternalformati64v((uint)target, (uint)internalFormat, (uint)pName, count, @params);
}
/// <summary>
@@ -151,9 +158,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glInvalidateFramebuffer">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateFrameBuffer(uint target, int numAttachments, uint* attachments)
public void InvalidateFrameBuffer(FrameBufferTarget target, int numAttachments, InvalidateFrameBufferAttachment* attachments)
{
__context->glInvalidateFramebuffer(target, numAttachments, attachments);
__context->glInvalidateFramebuffer((uint)target, numAttachments, (uint*)attachments);
}
/// <summary>
@@ -162,9 +169,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glInvalidateSubFramebuffer">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateSubFrameBuffer(uint target, int numAttachments, uint* attachments, int x, int y, int width, int height)
public void InvalidateSubFrameBuffer(FrameBufferTarget target, int numAttachments, InvalidateFrameBufferAttachment* attachments, int x, int y, int width, int height)
{
__context->glInvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
__context->glInvalidateSubFramebuffer((uint)target, numAttachments, (uint*)attachments, x, y, width, height);
}
/// <summary>
@@ -173,9 +180,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glMultiDrawArraysIndirect">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawArraysIndirect(uint mode, void* indirect, int drawcount, int stride)
public void MultiDrawArraysIndirect(PrimitiveType mode, void* indirect, int drawcount, int stride)
{
__context->glMultiDrawArraysIndirect(mode, indirect, drawcount, stride);
__context->glMultiDrawArraysIndirect((uint)mode, indirect, drawcount, stride);
}
/// <summary>
@@ -184,9 +191,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glMultiDrawElementsIndirect">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawElementsIndirect(uint mode, uint type, void* indirect, int drawcount, int stride)
public void MultiDrawElementsIndirect(PrimitiveType mode, DrawElementsType type, void* indirect, int drawcount, int stride)
{
__context->glMultiDrawElementsIndirect(mode, type, indirect, drawcount, stride);
__context->glMultiDrawElementsIndirect((uint)mode, (uint)type, indirect, drawcount, stride);
}
/// <summary>
@@ -195,9 +202,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetProgramInterfaceiv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramInterfaceiv(GlHandle program, uint programInterface, uint pName, int* @params)
public void GetProgramInterfaceiv(GlHandle program, ProgramInterface programInterface, ProgramInterfacePName pName, int* @params)
{
__context->glGetProgramInterfaceiv(program.Value, programInterface, pName, @params);
__context->glGetProgramInterfaceiv(program.Value, (uint)programInterface, (uint)pName, @params);
}
/// <summary>
@@ -206,9 +213,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetProgramResourceIndex">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetProgramResourceIndex(GlHandle program, uint programInterface, byte* name)
public uint GetProgramResourceIndex(GlHandle program, ProgramInterface programInterface, byte* name)
{
return __context->glGetProgramResourceIndex(program.Value, programInterface, name);
return __context->glGetProgramResourceIndex(program.Value, (uint)programInterface, name);
}
/// <summary>
@@ -217,9 +224,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetProgramResourceName">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramResourceName(GlHandle program, uint programInterface, uint index, int bufSize, int* length, byte* name)
public void GetProgramResourceName(GlHandle program, ProgramInterface programInterface, uint index, int bufSize, int* length, byte* name)
{
__context->glGetProgramResourceName(program.Value, programInterface, index, bufSize, length, name);
__context->glGetProgramResourceName(program.Value, (uint)programInterface, index, bufSize, length, name);
}
/// <summary>
@@ -228,9 +235,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetProgramResourceiv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramResourceiv(GlHandle program, uint programInterface, uint index, int propCount, uint* props, int count, int* length, int* @params)
public void GetProgramResourceiv(GlHandle program, ProgramInterface programInterface, uint index, int propCount, ProgramResourceProperty* props, int count, int* length, int* @params)
{
__context->glGetProgramResourceiv(program.Value, programInterface, index, propCount, props, count, length, @params);
__context->glGetProgramResourceiv(program.Value, (uint)programInterface, index, propCount, (uint*)props, count, length, @params);
}
/// <summary>
@@ -239,9 +246,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetProgramResourceLocation">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetProgramResourceLocation(GlHandle program, uint programInterface, byte* name)
public int GetProgramResourceLocation(GlHandle program, ProgramInterface programInterface, byte* name)
{
return __context->glGetProgramResourceLocation(program.Value, programInterface, name);
return __context->glGetProgramResourceLocation(program.Value, (uint)programInterface, name);
}
/// <summary>
@@ -250,9 +257,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetProgramResourceLocationIndex">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetProgramResourceLocationIndex(GlHandle program, uint programInterface, byte* name)
public int GetProgramResourceLocationIndex(GlHandle program, ProgramInterface programInterface, byte* name)
{
return __context->glGetProgramResourceLocationIndex(program.Value, programInterface, name);
return __context->glGetProgramResourceLocationIndex(program.Value, (uint)programInterface, name);
}
/// <summary>
@@ -272,9 +279,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTexBufferRange">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexBufferRange(uint target, uint internalFormat, GlHandle buffer, nint offset, nint size)
public void TexBufferRange(TextureTarget target, SizedInternalFormat internalFormat, GlHandle buffer, nint offset, nint size)
{
__context->glTexBufferRange(target, internalFormat, buffer.Value, offset, size);
__context->glTexBufferRange((uint)target, (uint)internalFormat, buffer.Value, offset, size);
}
/// <summary>
@@ -283,9 +290,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTexStorage2DMultisample">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage2DMultisample(uint target, int samples, uint internalFormat, int width, int height, byte fixedsamplelocations)
public void TexStorage2DMultisample(TextureTarget target, int samples, SizedInternalFormat internalFormat, int width, int height, byte fixedsamplelocations)
{
__context->glTexStorage2DMultisample(target, samples, internalFormat, width, height, fixedsamplelocations);
__context->glTexStorage2DMultisample((uint)target, samples, (uint)internalFormat, width, height, fixedsamplelocations);
}
/// <summary>
@@ -294,9 +301,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTexStorage3DMultisample">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage3DMultisample(uint target, int samples, uint internalFormat, int width, int height, int depth, byte fixedsamplelocations)
public void TexStorage3DMultisample(TextureTarget target, int samples, SizedInternalFormat internalFormat, int width, int height, int depth, byte fixedsamplelocations)
{
__context->glTexStorage3DMultisample(target, samples, internalFormat, width, height, depth, fixedsamplelocations);
__context->glTexStorage3DMultisample((uint)target, samples, (uint)internalFormat, width, height, depth, fixedsamplelocations);
}
/// <summary>
@@ -305,9 +312,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureView">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureView(GlHandle texture, uint target, GlHandle origtexture, uint internalFormat, uint minlevel, uint numlevels, uint minlayer, uint numlayers)
public void TextureView(GlHandle texture, TextureTarget target, GlHandle origtexture, SizedInternalFormat internalFormat, uint minlevel, uint numlevels, uint minlayer, uint numlayers)
{
__context->glTextureView(texture.Value, target, origtexture.Value, internalFormat, minlevel, numlevels, minlayer, numlayers);
__context->glTextureView(texture.Value, (uint)target, origtexture.Value, (uint)internalFormat, minlevel, numlevels, minlayer, numlayers);
}
/// <summary>
@@ -327,9 +334,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glVertexAttribFormat">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeFormat(uint attributeIndex, int size, uint type, byte normalized, uint relativeOffset)
public void VertexAttributeFormat(uint attributeIndex, int size, VertexAttributeType type, byte normalized, uint relativeOffset)
{
__context->glVertexAttribFormat(attributeIndex, size, type, normalized, relativeOffset);
__context->glVertexAttribFormat(attributeIndex, size, (uint)type, normalized, relativeOffset);
}
/// <summary>
@@ -338,9 +345,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glVertexAttribFormat">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeIntegerFormat(uint attributeIndex, int size, uint type, uint relativeOffset)
public void VertexAttributeIntegerFormat(uint attributeIndex, int size, VertexAttributeIType type, uint relativeOffset)
{
__context->glVertexAttribIFormat(attributeIndex, size, type, relativeOffset);
__context->glVertexAttribIFormat(attributeIndex, size, (uint)type, relativeOffset);
}
/// <summary>
@@ -349,9 +356,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glVertexAttribFormat">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeDoubleFormat(uint attributeIndex, int size, uint type, uint relativeOffset)
public void VertexAttributeDoubleFormat(uint attributeIndex, int size, VertexAttributeLType type, uint relativeOffset)
{
__context->glVertexAttribLFormat(attributeIndex, size, type, relativeOffset);
__context->glVertexAttribLFormat(attributeIndex, size, (uint)type, relativeOffset);
}
/// <summary>
@@ -382,9 +389,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glDebugMessageControl">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DebugMessageControl(uint source, uint type, uint severity, int count, uint* ids, byte enabled)
public void DebugMessageControl(DebugSource source, DebugType type, DebugSeverity severity, int count, uint* ids, byte enabled)
{
__context->glDebugMessageControl(source, type, severity, count, ids, enabled);
__context->glDebugMessageControl((uint)source, (uint)type, (uint)severity, count, ids, enabled);
}
/// <summary>
@@ -393,9 +400,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glDebugMessageInsert">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DebugMessageInsert(uint source, uint type, uint id, uint severity, int length, byte* buf)
public void DebugMessageInsert(DebugSource source, DebugType type, uint id, DebugSeverity severity, int length, byte* buf)
{
__context->glDebugMessageInsert(source, type, id, severity, length, buf);
__context->glDebugMessageInsert((uint)source, (uint)type, id, (uint)severity, length, buf);
}
/// <summary>
@@ -415,9 +422,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetDebugMessageLog">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetDebugMessageLog(uint count, int bufSize, uint* sources, uint* types, uint* ids, uint* severities, int* lengths, byte* messageLog)
public uint GetDebugMessageLog(uint count, int bufSize, DebugSource* sources, DebugType* types, uint* ids, DebugSeverity* severities, int* lengths, byte* messageLog)
{
return __context->glGetDebugMessageLog(count, bufSize, sources, types, ids, severities, lengths, messageLog);
return __context->glGetDebugMessageLog(count, bufSize, (uint*)sources, (uint*)types, ids, (uint*)severities, lengths, messageLog);
}
/// <summary>
@@ -426,9 +433,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glPushDebugGroup">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PushDebugGroup(uint source, uint id, int length, byte* message)
public void PushDebugGroup(DebugSource source, uint id, int length, byte* message)
{
__context->glPushDebugGroup(source, id, length, message);
__context->glPushDebugGroup((uint)source, id, length, message);
}
/// <summary>
@@ -448,9 +455,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glObjectLabel">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ObjectLabel(uint identifier, uint name, int length, byte* label)
public void ObjectLabel(ObjectIdentifier identifier, uint name, int length, byte* label)
{
__context->glObjectLabel(identifier, name, length, label);
__context->glObjectLabel((uint)identifier, name, length, label);
}
/// <summary>
@@ -459,9 +466,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetObjectLabel">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetObjectLabel(uint identifier, uint name, int bufSize, int* length, byte* label)
public void GetObjectLabel(ObjectIdentifier identifier, uint name, int bufSize, int* length, byte* label)
{
__context->glGetObjectLabel(identifier, name, bufSize, length, label);
__context->glGetObjectLabel((uint)identifier, name, bufSize, length, label);
}
/// <summary>
@@ -1,3 +1,10 @@
// -----------------------------------------------------------------------------
// file="OpenGLFunction.v4_4"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 4.4 core-profile forwarding methods.
@@ -19,9 +26,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glBufferStorage">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BufferStorage(uint target, nint size, void* data, uint flags)
public void BufferStorage(BufferStorageTarget target, nint size, void* data, BufferStorageMask flags)
{
__context->glBufferStorage(target, size, data, flags);
__context->glBufferStorage((uint)target, size, data, (uint)flags);
}
/// <summary>
@@ -30,9 +37,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glClearTexImage">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearTexImage(GlHandle texture, int level, uint format, uint type, void* data)
public void ClearTexImage(GlHandle texture, int level, PixelFormat format, PixelType type, void* data)
{
__context->glClearTexImage(texture.Value, level, format, type, data);
__context->glClearTexImage(texture.Value, level, (uint)format, (uint)type, data);
}
/// <summary>
@@ -41,9 +48,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glClearTexSubImage">docs.gl</see>.</para>
/// </summary>
[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)
public void ClearTexSubImage(GlHandle texture, int level, int xOffset, int yOffset, int zOffset, int width, int height, int depth, PixelFormat format, PixelType type, void* data)
{
__context->glClearTexSubImage(texture.Value, level, xOffset, yOffset, zOffset, width, height, depth, format, type, data);
__context->glClearTexSubImage(texture.Value, level, xOffset, yOffset, zOffset, width, height, depth, (uint)format, (uint)type, data);
}
/// <summary>
@@ -52,11 +59,11 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glBindBuffersBase">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindBuffersBase(uint target, uint first, ReadOnlySpan<GlHandle> buffers)
public void BindBuffersBase(BufferTarget target, uint first, ReadOnlySpan<GlHandle> buffers)
{
fixed (GlHandle* __buffers = buffers)
{
__context->glBindBuffersBase(target, first, buffers.Length, (uint*)__buffers);
__context->glBindBuffersBase((uint)target, first, buffers.Length, (uint*)__buffers);
}
}
@@ -66,11 +73,11 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glBindBuffersRange">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindBuffersRange(uint target, uint first, ReadOnlySpan<GlHandle> buffers, nint* offsets, nint* sizes)
public void BindBuffersRange(BufferTarget target, uint first, ReadOnlySpan<GlHandle> buffers, nint* offsets, nint* sizes)
{
fixed (GlHandle* __buffers = buffers)
{
__context->glBindBuffersRange(target, first, buffers.Length, (uint*)__buffers, offsets, sizes);
__context->glBindBuffersRange((uint)target, first, buffers.Length, (uint*)__buffers, offsets, sizes);
}
}
@@ -1,3 +1,10 @@
// -----------------------------------------------------------------------------
// file="OpenGLFunction.v4_5"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 4.5 core-profile forwarding methods.
@@ -19,9 +26,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glClipControl">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClipControl(uint origin, uint depth)
public void ClipControl(ClipControlOrigin origin, ClipControlDepth depth)
{
__context->glClipControl(origin, depth);
__context->glClipControl((uint)origin, (uint)depth);
}
/// <summary>
@@ -66,9 +73,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetTransformFeedbackiv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTransformFeedbackiv(GlHandle xfb, uint pName, int* param)
public void GetTransformFeedbackiv(GlHandle xfb, TransformFeedbackPName pName, int* param)
{
__context->glGetTransformFeedbackiv(xfb.Value, pName, param);
__context->glGetTransformFeedbackiv(xfb.Value, (uint)pName, param);
}
/// <summary>
@@ -77,9 +84,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetTransformFeedbacki_v">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTransformFeedbacki_v(GlHandle xfb, uint pName, uint index, int* param)
public void GetTransformFeedbacki_v(GlHandle xfb, TransformFeedbackPName pName, uint index, int* param)
{
__context->glGetTransformFeedbacki_v(xfb.Value, pName, index, param);
__context->glGetTransformFeedbacki_v(xfb.Value, (uint)pName, index, param);
}
/// <summary>
@@ -88,9 +95,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetTransformFeedbacki64_v">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTransformFeedbacki64_v(GlHandle xfb, uint pName, uint index, long* param)
public void GetTransformFeedbacki64_v(GlHandle xfb, TransformFeedbackPName pName, uint index, long* param)
{
__context->glGetTransformFeedbacki64_v(xfb.Value, pName, index, param);
__context->glGetTransformFeedbacki64_v(xfb.Value, (uint)pName, index, param);
}
/// <summary>
@@ -113,9 +120,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glNamedBufferStorage">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedBufferStorage(GlHandle buffer, nint size, void* data, uint flags)
public void NamedBufferStorage(GlHandle buffer, nint size, void* data, BufferStorageMask flags)
{
__context->glNamedBufferStorage(buffer.Value, size, data, flags);
__context->glNamedBufferStorage(buffer.Value, size, data, (uint)flags);
}
/// <summary>
@@ -124,9 +131,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glNamedBufferData">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedBufferData(GlHandle buffer, nint size, void* data, uint usage)
public void NamedBufferData(GlHandle buffer, nint size, void* data, BufferUsage usage)
{
__context->glNamedBufferData(buffer.Value, size, data, usage);
__context->glNamedBufferData(buffer.Value, size, data, (uint)usage);
}
/// <summary>
@@ -157,9 +164,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glClearNamedBufferData">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedBufferData(GlHandle buffer, uint internalFormat, uint format, uint type, void* data)
public void ClearNamedBufferData(GlHandle buffer, SizedInternalFormat internalFormat, PixelFormat format, PixelType type, void* data)
{
__context->glClearNamedBufferData(buffer.Value, internalFormat, format, type, data);
__context->glClearNamedBufferData(buffer.Value, (uint)internalFormat, (uint)format, (uint)type, data);
}
/// <summary>
@@ -168,9 +175,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glClearNamedBufferSubData">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedBufferSubData(GlHandle buffer, uint internalFormat, nint offset, nint size, uint format, uint type, void* data)
public void ClearNamedBufferSubData(GlHandle buffer, SizedInternalFormat internalFormat, nint offset, nint size, PixelFormat format, PixelType type, void* data)
{
__context->glClearNamedBufferSubData(buffer.Value, internalFormat, offset, size, format, type, data);
__context->glClearNamedBufferSubData(buffer.Value, (uint)internalFormat, offset, size, (uint)format, (uint)type, data);
}
/// <summary>
@@ -179,9 +186,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glMapNamedBuffer">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void* MapNamedBuffer(GlHandle buffer, uint access)
public void* MapNamedBuffer(GlHandle buffer, BufferAccess access)
{
return __context->glMapNamedBuffer(buffer.Value, access);
return __context->glMapNamedBuffer(buffer.Value, (uint)access);
}
/// <summary>
@@ -190,9 +197,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glMapNamedBufferRange">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void* MapNamedBufferRange(GlHandle buffer, nint offset, nint length, uint access)
public void* MapNamedBufferRange(GlHandle buffer, nint offset, nint length, MapBufferAccessMask access)
{
return __context->glMapNamedBufferRange(buffer.Value, offset, length, access);
return __context->glMapNamedBufferRange(buffer.Value, offset, length, (uint)access);
}
/// <summary>
@@ -223,9 +230,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetNamedBufferParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedBufferParameter(GlHandle buffer, uint pName, int* @params)
public void GetNamedBufferParameter(GlHandle buffer, BufferPName pName, int* @params)
{
__context->glGetNamedBufferParameteriv(buffer.Value, pName, @params);
__context->glGetNamedBufferParameteriv(buffer.Value, (uint)pName, @params);
}
/// <summary>
@@ -234,9 +241,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetNamedBufferParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedBufferParameter(GlHandle buffer, uint pName, long* @params)
public void GetNamedBufferParameter(GlHandle buffer, BufferPName pName, long* @params)
{
__context->glGetNamedBufferParameteri64v(buffer.Value, pName, @params);
__context->glGetNamedBufferParameteri64v(buffer.Value, (uint)pName, @params);
}
/// <summary>
@@ -245,9 +252,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetNamedBufferPointerv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedBufferPointerv(GlHandle buffer, uint pName, void** @params)
public void GetNamedBufferPointerv(GlHandle buffer, BufferPointerName pName, void** @params)
{
__context->glGetNamedBufferPointerv(buffer.Value, pName, @params);
__context->glGetNamedBufferPointerv(buffer.Value, (uint)pName, @params);
}
/// <summary>
@@ -281,9 +288,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glNamedFramebufferRenderbuffer">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFrameBufferRenderBuffer(GlHandle frameBuffer, uint attachment, uint renderBuffertarget, GlHandle renderBuffer)
public void NamedFrameBufferRenderBuffer(GlHandle frameBuffer, FrameBufferAttachment attachment, RenderBufferTarget renderBuffertarget, GlHandle renderBuffer)
{
__context->glNamedFramebufferRenderbuffer(frameBuffer.Value, attachment, renderBuffertarget, renderBuffer.Value);
__context->glNamedFramebufferRenderbuffer(frameBuffer.Value, (uint)attachment, (uint)renderBuffertarget, renderBuffer.Value);
}
/// <summary>
@@ -292,9 +299,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glNamedFramebufferParameteri">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFrameBufferParameteri(GlHandle frameBuffer, uint pName, int param)
public void NamedFrameBufferParameteri(GlHandle frameBuffer, FrameBufferParameterName pName, int param)
{
__context->glNamedFramebufferParameteri(frameBuffer.Value, pName, param);
__context->glNamedFramebufferParameteri(frameBuffer.Value, (uint)pName, param);
}
/// <summary>
@@ -303,9 +310,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glNamedFramebufferTexture">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFrameBufferTexture(GlHandle frameBuffer, uint attachment, GlHandle texture, int level)
public void NamedFrameBufferTexture(GlHandle frameBuffer, FrameBufferAttachment attachment, GlHandle texture, int level)
{
__context->glNamedFramebufferTexture(frameBuffer.Value, attachment, texture.Value, level);
__context->glNamedFramebufferTexture(frameBuffer.Value, (uint)attachment, texture.Value, level);
}
/// <summary>
@@ -314,9 +321,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glNamedFramebufferTextureLayer">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFrameBufferTextureLayer(GlHandle frameBuffer, uint attachment, GlHandle texture, int level, int layer)
public void NamedFrameBufferTextureLayer(GlHandle frameBuffer, FrameBufferAttachment attachment, GlHandle texture, int level, int layer)
{
__context->glNamedFramebufferTextureLayer(frameBuffer.Value, attachment, texture.Value, level, layer);
__context->glNamedFramebufferTextureLayer(frameBuffer.Value, (uint)attachment, texture.Value, level, layer);
}
/// <summary>
@@ -325,9 +332,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glNamedFramebufferDrawBuffer">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFrameBufferDrawBuffer(GlHandle frameBuffer, uint buf)
public void NamedFrameBufferDrawBuffer(GlHandle frameBuffer, ColorBuffer buf)
{
__context->glNamedFramebufferDrawBuffer(frameBuffer.Value, buf);
__context->glNamedFramebufferDrawBuffer(frameBuffer.Value, (uint)buf);
}
/// <summary>
@@ -336,9 +343,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glNamedFramebufferDrawBuffers">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFrameBufferDrawBuffers(GlHandle frameBuffer, int n, uint* bufs)
public void NamedFrameBufferDrawBuffers(GlHandle frameBuffer, int n, ColorBuffer* bufs)
{
__context->glNamedFramebufferDrawBuffers(frameBuffer.Value, n, bufs);
__context->glNamedFramebufferDrawBuffers(frameBuffer.Value, n, (uint*)bufs);
}
/// <summary>
@@ -347,9 +354,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glNamedFramebufferReadBuffer">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedFrameBufferReadBuffer(GlHandle frameBuffer, uint src)
public void NamedFrameBufferReadBuffer(GlHandle frameBuffer, ColorBuffer src)
{
__context->glNamedFramebufferReadBuffer(frameBuffer.Value, src);
__context->glNamedFramebufferReadBuffer(frameBuffer.Value, (uint)src);
}
/// <summary>
@@ -358,9 +365,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glInvalidateNamedFramebufferData">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateNamedFrameBufferData(GlHandle frameBuffer, int numAttachments, uint* attachments)
public void InvalidateNamedFrameBufferData(GlHandle frameBuffer, int numAttachments, FrameBufferAttachment* attachments)
{
__context->glInvalidateNamedFramebufferData(frameBuffer.Value, numAttachments, attachments);
__context->glInvalidateNamedFramebufferData(frameBuffer.Value, numAttachments, (uint*)attachments);
}
/// <summary>
@@ -369,9 +376,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glInvalidateNamedFramebufferSubData">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateNamedFrameBufferSubData(GlHandle frameBuffer, int numAttachments, uint* attachments, int x, int y, int width, int height)
public void InvalidateNamedFrameBufferSubData(GlHandle frameBuffer, int numAttachments, FrameBufferAttachment* attachments, int x, int y, int width, int height)
{
__context->glInvalidateNamedFramebufferSubData(frameBuffer.Value, numAttachments, attachments, x, y, width, height);
__context->glInvalidateNamedFramebufferSubData(frameBuffer.Value, numAttachments, (uint*)attachments, x, y, width, height);
}
/// <summary>
@@ -380,9 +387,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glClearNamedFramebuffer">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedFrameBuffer(GlHandle frameBuffer, uint buffer, int drawbuffer, int* value)
public void ClearNamedFrameBuffer(GlHandle frameBuffer, ClearBuffer buffer, int drawbuffer, int* value)
{
__context->glClearNamedFramebufferiv(frameBuffer.Value, buffer, drawbuffer, value);
__context->glClearNamedFramebufferiv(frameBuffer.Value, (uint)buffer, drawbuffer, value);
}
/// <summary>
@@ -391,9 +398,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glClearNamedFramebuffer">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedFrameBuffer(GlHandle frameBuffer, uint buffer, int drawbuffer, uint* value)
public void ClearNamedFrameBuffer(GlHandle frameBuffer, ClearBuffer buffer, int drawbuffer, uint* value)
{
__context->glClearNamedFramebufferuiv(frameBuffer.Value, buffer, drawbuffer, value);
__context->glClearNamedFramebufferuiv(frameBuffer.Value, (uint)buffer, drawbuffer, value);
}
/// <summary>
@@ -402,9 +409,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glClearNamedFramebuffer">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedFrameBuffer(GlHandle frameBuffer, uint buffer, int drawbuffer, float* value)
public void ClearNamedFrameBuffer(GlHandle frameBuffer, ClearBuffer buffer, int drawbuffer, float* value)
{
__context->glClearNamedFramebufferfv(frameBuffer.Value, buffer, drawbuffer, value);
__context->glClearNamedFramebufferfv(frameBuffer.Value, (uint)buffer, drawbuffer, value);
}
/// <summary>
@@ -413,9 +420,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glClearNamedFramebuffer">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearNamedFrameBuffer(GlHandle frameBuffer, uint buffer, int drawbuffer, float depth, int stencil)
public void ClearNamedFrameBuffer(GlHandle frameBuffer, ClearBuffer buffer, int drawbuffer, float depth, int stencil)
{
__context->glClearNamedFramebufferfi(frameBuffer.Value, buffer, drawbuffer, depth, stencil);
__context->glClearNamedFramebufferfi(frameBuffer.Value, (uint)buffer, drawbuffer, depth, stencil);
}
/// <summary>
@@ -424,9 +431,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glBlitNamedFramebuffer">docs.gl</see>.</para>
/// </summary>
[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)
public void BlitNamedFrameBuffer(GlHandle readFrameBuffer, GlHandle drawFrameBuffer, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, ClearBufferMask mask, BlitFrameBufferFilter filter)
{
__context->glBlitNamedFramebuffer(readFrameBuffer.Value, drawFrameBuffer.Value, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
__context->glBlitNamedFramebuffer(readFrameBuffer.Value, drawFrameBuffer.Value, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, (uint)mask, (uint)filter);
}
/// <summary>
@@ -435,9 +442,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glCheckNamedFramebufferStatus">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint CheckNamedFrameBufferStatus(GlHandle frameBuffer, uint target)
public FrameBufferStatus CheckNamedFrameBufferStatus(GlHandle frameBuffer, FrameBufferTarget target)
{
return __context->glCheckNamedFramebufferStatus(frameBuffer.Value, target);
return (FrameBufferStatus)__context->glCheckNamedFramebufferStatus(frameBuffer.Value, (uint)target);
}
/// <summary>
@@ -446,9 +453,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetNamedFramebufferParameteriv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedFrameBufferParameteriv(GlHandle frameBuffer, uint pName, int* param)
public void GetNamedFrameBufferParameteriv(GlHandle frameBuffer, GetFrameBufferParameter pName, int* param)
{
__context->glGetNamedFramebufferParameteriv(frameBuffer.Value, pName, param);
__context->glGetNamedFramebufferParameteriv(frameBuffer.Value, (uint)pName, param);
}
/// <summary>
@@ -457,9 +464,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetNamedFramebufferAttachmentParameteriv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedFrameBufferAttachmentParameteriv(GlHandle frameBuffer, uint attachment, uint pName, int* @params)
public void GetNamedFrameBufferAttachmentParameteriv(GlHandle frameBuffer, FrameBufferAttachment attachment, FrameBufferAttachmentParameterName pName, int* @params)
{
__context->glGetNamedFramebufferAttachmentParameteriv(frameBuffer.Value, attachment, pName, @params);
__context->glGetNamedFramebufferAttachmentParameteriv(frameBuffer.Value, (uint)attachment, (uint)pName, @params);
}
/// <summary>
@@ -482,9 +489,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glNamedRenderbufferStorage">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedRenderBufferStorage(GlHandle renderBuffer, uint internalFormat, int width, int height)
public void NamedRenderBufferStorage(GlHandle renderBuffer, InternalFormat internalFormat, int width, int height)
{
__context->glNamedRenderbufferStorage(renderBuffer.Value, internalFormat, width, height);
__context->glNamedRenderbufferStorage(renderBuffer.Value, (uint)internalFormat, width, height);
}
/// <summary>
@@ -493,9 +500,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glNamedRenderbufferStorageMultisample">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedRenderBufferStorageMultisample(GlHandle renderBuffer, int samples, uint internalFormat, int width, int height)
public void NamedRenderBufferStorageMultisample(GlHandle renderBuffer, int samples, InternalFormat internalFormat, int width, int height)
{
__context->glNamedRenderbufferStorageMultisample(renderBuffer.Value, samples, internalFormat, width, height);
__context->glNamedRenderbufferStorageMultisample(renderBuffer.Value, samples, (uint)internalFormat, width, height);
}
/// <summary>
@@ -504,9 +511,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetNamedRenderbufferParameteriv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedRenderBufferParameteriv(GlHandle renderBuffer, uint pName, int* @params)
public void GetNamedRenderBufferParameteriv(GlHandle renderBuffer, RenderBufferParameterName pName, int* @params)
{
__context->glGetNamedRenderbufferParameteriv(renderBuffer.Value, pName, @params);
__context->glGetNamedRenderbufferParameteriv(renderBuffer.Value, (uint)pName, @params);
}
/// <summary>
@@ -515,11 +522,11 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glCreateTextures">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateTextures(uint target, Span<GlHandle> textures)
public void CreateTextures(TextureTarget target, Span<GlHandle> textures)
{
fixed (GlHandle* __textures = textures)
{
__context->glCreateTextures(target, textures.Length, (uint*)__textures);
__context->glCreateTextures((uint)target, textures.Length, (uint*)__textures);
}
}
@@ -529,9 +536,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureBuffer">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureBuffer(GlHandle texture, uint internalFormat, GlHandle buffer)
public void TextureBuffer(GlHandle texture, SizedInternalFormat internalFormat, GlHandle buffer)
{
__context->glTextureBuffer(texture.Value, internalFormat, buffer.Value);
__context->glTextureBuffer(texture.Value, (uint)internalFormat, buffer.Value);
}
/// <summary>
@@ -540,9 +547,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureBufferRange">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureBufferRange(GlHandle texture, uint internalFormat, GlHandle buffer, nint offset, nint size)
public void TextureBufferRange(GlHandle texture, SizedInternalFormat internalFormat, GlHandle buffer, nint offset, nint size)
{
__context->glTextureBufferRange(texture.Value, internalFormat, buffer.Value, offset, size);
__context->glTextureBufferRange(texture.Value, (uint)internalFormat, buffer.Value, offset, size);
}
/// <summary>
@@ -551,9 +558,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureStorage1D">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage1D(GlHandle texture, int levels, uint internalFormat, int width)
public void TextureStorage1D(GlHandle texture, int levels, SizedInternalFormat internalFormat, int width)
{
__context->glTextureStorage1D(texture.Value, levels, internalFormat, width);
__context->glTextureStorage1D(texture.Value, levels, (uint)internalFormat, width);
}
/// <summary>
@@ -562,9 +569,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureStorage2D">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage2D(GlHandle texture, int levels, uint internalFormat, int width, int height)
public void TextureStorage2D(GlHandle texture, int levels, SizedInternalFormat internalFormat, int width, int height)
{
__context->glTextureStorage2D(texture.Value, levels, internalFormat, width, height);
__context->glTextureStorage2D(texture.Value, levels, (uint)internalFormat, width, height);
}
/// <summary>
@@ -573,9 +580,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureStorage3D">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage3D(GlHandle texture, int levels, uint internalFormat, int width, int height, int depth)
public void TextureStorage3D(GlHandle texture, int levels, SizedInternalFormat internalFormat, int width, int height, int depth)
{
__context->glTextureStorage3D(texture.Value, levels, internalFormat, width, height, depth);
__context->glTextureStorage3D(texture.Value, levels, (uint)internalFormat, width, height, depth);
}
/// <summary>
@@ -584,9 +591,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureStorage2DMultisample">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage2DMultisample(GlHandle texture, int samples, uint internalFormat, int width, int height, byte fixedsamplelocations)
public void TextureStorage2DMultisample(GlHandle texture, int samples, SizedInternalFormat internalFormat, int width, int height, byte fixedsamplelocations)
{
__context->glTextureStorage2DMultisample(texture.Value, samples, internalFormat, width, height, fixedsamplelocations);
__context->glTextureStorage2DMultisample(texture.Value, samples, (uint)internalFormat, width, height, fixedsamplelocations);
}
/// <summary>
@@ -595,9 +602,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureStorage3DMultisample">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureStorage3DMultisample(GlHandle texture, int samples, uint internalFormat, int width, int height, int depth, byte fixedsamplelocations)
public void TextureStorage3DMultisample(GlHandle texture, int samples, SizedInternalFormat internalFormat, int width, int height, int depth, byte fixedsamplelocations)
{
__context->glTextureStorage3DMultisample(texture.Value, samples, internalFormat, width, height, depth, fixedsamplelocations);
__context->glTextureStorage3DMultisample(texture.Value, samples, (uint)internalFormat, width, height, depth, fixedsamplelocations);
}
/// <summary>
@@ -606,9 +613,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureSubImage1D">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureSubImage1D(GlHandle texture, int level, int xOffset, int width, uint format, uint type, void* pixels)
public void TextureSubImage1D(GlHandle texture, int level, int xOffset, int width, PixelFormat format, PixelType type, void* pixels)
{
__context->glTextureSubImage1D(texture.Value, level, xOffset, width, format, type, pixels);
__context->glTextureSubImage1D(texture.Value, level, xOffset, width, (uint)format, (uint)type, pixels);
}
/// <summary>
@@ -617,9 +624,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureSubImage2D">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureSubImage2D(GlHandle texture, int level, int xOffset, int yOffset, int width, int height, uint format, uint type, void* pixels)
public void TextureSubImage2D(GlHandle texture, int level, int xOffset, int yOffset, int width, int height, PixelFormat format, PixelType type, void* pixels)
{
__context->glTextureSubImage2D(texture.Value, level, xOffset, yOffset, width, height, format, type, pixels);
__context->glTextureSubImage2D(texture.Value, level, xOffset, yOffset, width, height, (uint)format, (uint)type, pixels);
}
/// <summary>
@@ -628,9 +635,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureSubImage3D">docs.gl</see>.</para>
/// </summary>
[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)
public void TextureSubImage3D(GlHandle texture, int level, int xOffset, int yOffset, int zOffset, int width, int height, int depth, PixelFormat format, PixelType type, void* pixels)
{
__context->glTextureSubImage3D(texture.Value, level, xOffset, yOffset, zOffset, width, height, depth, format, type, pixels);
__context->glTextureSubImage3D(texture.Value, level, xOffset, yOffset, zOffset, width, height, depth, (uint)format, (uint)type, pixels);
}
/// <summary>
@@ -639,9 +646,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glCompressedTextureSubImage1D">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CompressedTextureSubImage1D(GlHandle texture, int level, int xOffset, int width, uint format, int imageSize, void* data)
public void CompressedTextureSubImage1D(GlHandle texture, int level, int xOffset, int width, InternalFormat format, int imageSize, void* data)
{
__context->glCompressedTextureSubImage1D(texture.Value, level, xOffset, width, format, imageSize, data);
__context->glCompressedTextureSubImage1D(texture.Value, level, xOffset, width, (uint)format, imageSize, data);
}
/// <summary>
@@ -650,9 +657,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glCompressedTextureSubImage2D">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CompressedTextureSubImage2D(GlHandle texture, int level, int xOffset, int yOffset, int width, int height, uint format, int imageSize, void* data)
public void CompressedTextureSubImage2D(GlHandle texture, int level, int xOffset, int yOffset, int width, int height, InternalFormat format, int imageSize, void* data)
{
__context->glCompressedTextureSubImage2D(texture.Value, level, xOffset, yOffset, width, height, format, imageSize, data);
__context->glCompressedTextureSubImage2D(texture.Value, level, xOffset, yOffset, width, height, (uint)format, imageSize, data);
}
/// <summary>
@@ -661,9 +668,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glCompressedTextureSubImage3D">docs.gl</see>.</para>
/// </summary>
[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)
public void CompressedTextureSubImage3D(GlHandle texture, int level, int xOffset, int yOffset, int zOffset, int width, int height, int depth, InternalFormat format, int imageSize, void* data)
{
__context->glCompressedTextureSubImage3D(texture.Value, level, xOffset, yOffset, zOffset, width, height, depth, format, imageSize, data);
__context->glCompressedTextureSubImage3D(texture.Value, level, xOffset, yOffset, zOffset, width, height, depth, (uint)format, imageSize, data);
}
/// <summary>
@@ -705,9 +712,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedTextureParameter(GlHandle texture, uint pName, float param)
public void NamedTextureParameter(GlHandle texture, TextureParameterName pName, float param)
{
__context->glTextureParameterf(texture.Value, pName, param);
__context->glTextureParameterf(texture.Value, (uint)pName, param);
}
/// <summary>
@@ -716,9 +723,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedTextureParameter(GlHandle texture, uint pName, float* param)
public void NamedTextureParameter(GlHandle texture, TextureParameterName pName, float* param)
{
__context->glTextureParameterfv(texture.Value, pName, param);
__context->glTextureParameterfv(texture.Value, (uint)pName, param);
}
/// <summary>
@@ -727,9 +734,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedTextureParameter(GlHandle texture, uint pName, int param)
public void NamedTextureParameter(GlHandle texture, TextureParameterName pName, int param)
{
__context->glTextureParameteri(texture.Value, pName, param);
__context->glTextureParameteri(texture.Value, (uint)pName, param);
}
/// <summary>
@@ -738,9 +745,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedTextureParameterInteger(GlHandle texture, uint pName, int* @params)
public void NamedTextureParameterInteger(GlHandle texture, TextureParameterName pName, int* @params)
{
__context->glTextureParameterIiv(texture.Value, pName, @params);
__context->glTextureParameterIiv(texture.Value, (uint)pName, @params);
}
/// <summary>
@@ -749,9 +756,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedTextureParameterInteger(GlHandle texture, uint pName, uint* @params)
public void NamedTextureParameterInteger(GlHandle texture, TextureParameterName pName, uint* @params)
{
__context->glTextureParameterIuiv(texture.Value, pName, @params);
__context->glTextureParameterIuiv(texture.Value, (uint)pName, @params);
}
/// <summary>
@@ -760,9 +767,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glTextureParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void NamedTextureParameter(GlHandle texture, uint pName, int* param)
public void NamedTextureParameter(GlHandle texture, TextureParameterName pName, int* param)
{
__context->glTextureParameteriv(texture.Value, pName, param);
__context->glTextureParameteriv(texture.Value, (uint)pName, param);
}
/// <summary>
@@ -793,9 +800,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetTextureImage">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTextureImage(GlHandle texture, int level, uint format, uint type, int bufSize, void* pixels)
public void GetTextureImage(GlHandle texture, int level, PixelFormat format, PixelType type, int bufSize, void* pixels)
{
__context->glGetTextureImage(texture.Value, level, format, type, bufSize, pixels);
__context->glGetTextureImage(texture.Value, level, (uint)format, (uint)type, bufSize, pixels);
}
/// <summary>
@@ -815,9 +822,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetTextureLevelParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedTextureLevelParameter(GlHandle texture, int level, uint pName, float* @params)
public void GetNamedTextureLevelParameter(GlHandle texture, int level, GetTextureParameter pName, float* @params)
{
__context->glGetTextureLevelParameterfv(texture.Value, level, pName, @params);
__context->glGetTextureLevelParameterfv(texture.Value, level, (uint)pName, @params);
}
/// <summary>
@@ -826,9 +833,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetTextureLevelParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedTextureLevelParameter(GlHandle texture, int level, uint pName, int* @params)
public void GetNamedTextureLevelParameter(GlHandle texture, int level, GetTextureParameter pName, int* @params)
{
__context->glGetTextureLevelParameteriv(texture.Value, level, pName, @params);
__context->glGetTextureLevelParameteriv(texture.Value, level, (uint)pName, @params);
}
/// <summary>
@@ -837,9 +844,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetTextureParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedTextureParameter(GlHandle texture, uint pName, float* @params)
public void GetNamedTextureParameter(GlHandle texture, GetTextureParameter pName, float* @params)
{
__context->glGetTextureParameterfv(texture.Value, pName, @params);
__context->glGetTextureParameterfv(texture.Value, (uint)pName, @params);
}
/// <summary>
@@ -848,9 +855,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetTextureParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedTextureParameterInteger(GlHandle texture, uint pName, int* @params)
public void GetNamedTextureParameterInteger(GlHandle texture, GetTextureParameter pName, int* @params)
{
__context->glGetTextureParameterIiv(texture.Value, pName, @params);
__context->glGetTextureParameterIiv(texture.Value, (uint)pName, @params);
}
/// <summary>
@@ -859,9 +866,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetTextureParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedTextureParameterInteger(GlHandle texture, uint pName, uint* @params)
public void GetNamedTextureParameterInteger(GlHandle texture, GetTextureParameter pName, uint* @params)
{
__context->glGetTextureParameterIuiv(texture.Value, pName, @params);
__context->glGetTextureParameterIuiv(texture.Value, (uint)pName, @params);
}
/// <summary>
@@ -870,9 +877,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetTextureParameter">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetNamedTextureParameter(GlHandle texture, uint pName, int* @params)
public void GetNamedTextureParameter(GlHandle texture, GetTextureParameter pName, int* @params)
{
__context->glGetTextureParameteriv(texture.Value, pName, @params);
__context->glGetTextureParameteriv(texture.Value, (uint)pName, @params);
}
/// <summary>
@@ -964,9 +971,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glVertexAttribFormat">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayAttributeFormat(GlHandle vertexArray, uint attributeIndex, int size, uint type, byte normalized, uint relativeOffset)
public void VertexArrayAttributeFormat(GlHandle vertexArray, uint attributeIndex, int size, VertexAttributeType type, byte normalized, uint relativeOffset)
{
__context->glVertexArrayAttribFormat(vertexArray.Value, attributeIndex, size, type, normalized, relativeOffset);
__context->glVertexArrayAttribFormat(vertexArray.Value, attributeIndex, size, (uint)type, normalized, relativeOffset);
}
/// <summary>
@@ -975,9 +982,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glVertexAttribFormat">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayAttributeIntegerFormat(GlHandle vertexArray, uint attributeIndex, int size, uint type, uint relativeOffset)
public void VertexArrayAttributeIntegerFormat(GlHandle vertexArray, uint attributeIndex, int size, VertexAttributeIType type, uint relativeOffset)
{
__context->glVertexArrayAttribIFormat(vertexArray.Value, attributeIndex, size, type, relativeOffset);
__context->glVertexArrayAttribIFormat(vertexArray.Value, attributeIndex, size, (uint)type, relativeOffset);
}
/// <summary>
@@ -986,9 +993,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glVertexAttribFormat">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexArrayAttributeDoubleFormat(GlHandle vertexArray, uint attributeIndex, int size, uint type, uint relativeOffset)
public void VertexArrayAttributeDoubleFormat(GlHandle vertexArray, uint attributeIndex, int size, VertexAttributeLType type, uint relativeOffset)
{
__context->glVertexArrayAttribLFormat(vertexArray.Value, attributeIndex, size, type, relativeOffset);
__context->glVertexArrayAttribLFormat(vertexArray.Value, attributeIndex, size, (uint)type, relativeOffset);
}
/// <summary>
@@ -1008,9 +1015,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetVertexArrayiv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetVertexArrayiv(GlHandle vertexArray, uint pName, int* param)
public void GetVertexArrayiv(GlHandle vertexArray, VertexArrayPName pName, int* param)
{
__context->glGetVertexArrayiv(vertexArray.Value, pName, param);
__context->glGetVertexArrayiv(vertexArray.Value, (uint)pName, param);
}
/// <summary>
@@ -1019,9 +1026,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetVertexArrayIndexediv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetVertexArrayIndexediv(GlHandle vertexArray, uint index, uint pName, int* param)
public void GetVertexArrayIndexediv(GlHandle vertexArray, uint index, VertexArrayPName pName, int* param)
{
__context->glGetVertexArrayIndexediv(vertexArray.Value, index, pName, param);
__context->glGetVertexArrayIndexediv(vertexArray.Value, index, (uint)pName, param);
}
/// <summary>
@@ -1030,9 +1037,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetVertexArrayIndexed64iv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetVertexArrayIndexed64iv(GlHandle vertexArray, uint index, uint pName, long* param)
public void GetVertexArrayIndexed64iv(GlHandle vertexArray, uint index, VertexArrayPName pName, long* param)
{
__context->glGetVertexArrayIndexed64iv(vertexArray.Value, index, pName, param);
__context->glGetVertexArrayIndexed64iv(vertexArray.Value, index, (uint)pName, param);
}
/// <summary>
@@ -1069,11 +1076,11 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glCreateQueries">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CreateQueries(uint target, Span<GlHandle> ids)
public void CreateQueries(QueryTarget target, Span<GlHandle> ids)
{
fixed (GlHandle* __ids = ids)
{
__context->glCreateQueries(target, ids.Length, (uint*)__ids);
__context->glCreateQueries((uint)target, ids.Length, (uint*)__ids);
}
}
@@ -1083,9 +1090,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetQueryBufferObjecti64v">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryBufferObjecti64v(GlHandle id, GlHandle buffer, uint pName, nint offset)
public void GetQueryBufferObjecti64v(GlHandle id, GlHandle buffer, QueryObjectParameterName pName, nint offset)
{
__context->glGetQueryBufferObjecti64v(id.Value, buffer.Value, pName, offset);
__context->glGetQueryBufferObjecti64v(id.Value, buffer.Value, (uint)pName, offset);
}
/// <summary>
@@ -1094,9 +1101,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetQueryBufferObjectiv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryBufferObjectiv(GlHandle id, GlHandle buffer, uint pName, nint offset)
public void GetQueryBufferObjectiv(GlHandle id, GlHandle buffer, QueryObjectParameterName pName, nint offset)
{
__context->glGetQueryBufferObjectiv(id.Value, buffer.Value, pName, offset);
__context->glGetQueryBufferObjectiv(id.Value, buffer.Value, (uint)pName, offset);
}
/// <summary>
@@ -1105,9 +1112,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetQueryBufferObjectui64v">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryBufferObjectui64v(GlHandle id, GlHandle buffer, uint pName, nint offset)
public void GetQueryBufferObjectui64v(GlHandle id, GlHandle buffer, QueryObjectParameterName pName, nint offset)
{
__context->glGetQueryBufferObjectui64v(id.Value, buffer.Value, pName, offset);
__context->glGetQueryBufferObjectui64v(id.Value, buffer.Value, (uint)pName, offset);
}
/// <summary>
@@ -1116,9 +1123,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetQueryBufferObjectuiv">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryBufferObjectuiv(GlHandle id, GlHandle buffer, uint pName, nint offset)
public void GetQueryBufferObjectuiv(GlHandle id, GlHandle buffer, QueryObjectParameterName pName, nint offset)
{
__context->glGetQueryBufferObjectuiv(id.Value, buffer.Value, pName, offset);
__context->glGetQueryBufferObjectuiv(id.Value, buffer.Value, (uint)pName, offset);
}
/// <summary>
@@ -1127,9 +1134,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glMemoryBarrierByRegion">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MemoryBarrierByRegion(uint barriers)
public void MemoryBarrierByRegion(MemoryBarrierMask barriers)
{
__context->glMemoryBarrierByRegion(barriers);
__context->glMemoryBarrierByRegion((uint)barriers);
}
/// <summary>
@@ -1138,9 +1145,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetTextureSubImage">docs.gl</see>.</para>
/// </summary>
[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)
public void GetTextureSubImage(GlHandle texture, int level, int xOffset, int yOffset, int zOffset, int width, int height, int depth, PixelFormat format, PixelType type, int bufSize, void* pixels)
{
__context->glGetTextureSubImage(texture.Value, level, xOffset, yOffset, zOffset, width, height, depth, format, type, bufSize, pixels);
__context->glGetTextureSubImage(texture.Value, level, xOffset, yOffset, zOffset, width, height, depth, (uint)format, (uint)type, bufSize, pixels);
}
/// <summary>
@@ -1160,9 +1167,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetGraphicsResetStatus">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetGraphicsResetStatus()
public GraphicsResetStatus GetGraphicsResetStatus()
{
return __context->glGetGraphicsResetStatus();
return (GraphicsResetStatus)__context->glGetGraphicsResetStatus();
}
/// <summary>
@@ -1171,9 +1178,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetnCompressedTexImage">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetnCompressedTexImage(uint target, int lod, int bufSize, void* pixels)
public void GetnCompressedTexImage(TextureTarget target, int lod, int bufSize, void* pixels)
{
__context->glGetnCompressedTexImage(target, lod, bufSize, pixels);
__context->glGetnCompressedTexImage((uint)target, lod, bufSize, pixels);
}
/// <summary>
@@ -1182,9 +1189,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glGetnTexImage">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetnTexImage(uint target, int level, uint format, uint type, int bufSize, void* pixels)
public void GetnTexImage(TextureTarget target, int level, PixelFormat format, PixelType type, int bufSize, void* pixels)
{
__context->glGetnTexImage(target, level, format, type, bufSize, pixels);
__context->glGetnTexImage((uint)target, level, (uint)format, (uint)type, bufSize, pixels);
}
/// <summary>
@@ -1237,9 +1244,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glReadnPixels">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReadnPixels(int x, int y, int width, int height, uint format, uint type, int bufSize, void* data)
public void ReadnPixels(int x, int y, int width, int height, PixelFormat format, PixelType type, int bufSize, void* data)
{
__context->glReadnPixels(x, y, width, height, format, type, bufSize, data);
__context->glReadnPixels(x, y, width, height, (uint)format, (uint)type, bufSize, data);
}
/// <summary>
@@ -1,3 +1,10 @@
// -----------------------------------------------------------------------------
// file="OpenGLFunction.v4_6"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL 4.6 core-profile forwarding methods.
@@ -30,9 +37,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glMultiDrawArraysIndirectCount">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawArraysIndirectCount(uint mode, void* indirect, nint drawcount, int maxdrawcount, int stride)
public void MultiDrawArraysIndirectCount(PrimitiveType mode, void* indirect, nint drawcount, int maxdrawcount, int stride)
{
__context->glMultiDrawArraysIndirectCount(mode, indirect, drawcount, maxdrawcount, stride);
__context->glMultiDrawArraysIndirectCount((uint)mode, indirect, drawcount, maxdrawcount, stride);
}
/// <summary>
@@ -41,9 +48,9 @@ namespace StgSharp.Graphics.OpenGL
/// <para>See <see href="https://docs.gl/gl4/glMultiDrawElementsIndirectCount">docs.gl</see>.</para>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawElementsIndirectCount(uint mode, uint type, void* indirect, nint drawcount, int maxdrawcount, int stride)
public void MultiDrawElementsIndirectCount(PrimitiveType mode, DrawElementsType type, void* indirect, nint drawcount, int maxdrawcount, int stride)
{
__context->glMultiDrawElementsIndirectCount(mode, type, indirect, drawcount, maxdrawcount, stride);
__context->glMultiDrawElementsIndirectCount((uint)mode, (uint)type, indirect, drawcount, maxdrawcount, stride);
}
/// <summary>
@@ -1,3 +1,10 @@
// -----------------------------------------------------------------------------
// file="OpenglContext"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL core function pointer table.
@@ -1,3 +1,10 @@
// -----------------------------------------------------------------------------
// file="glContextShadow"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Native-address shadow of the OpenGL function pointer table.
@@ -1,3 +1,10 @@
// -----------------------------------------------------------------------------
// file="glconst"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
// <auto-generated>
// Generated by StgSharp.GenerateGL.
// Desktop OpenGL constants.
@@ -12,27 +12,30 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// A set of OpenGL shader handles with their common stage type.
/// </summary>
public sealed record Shader
public sealed class Shader
{
private readonly GlHandle[] _handles;
public Shader(
GlHandle[] handles,
ReadOnlySpan<GlHandle> handles,
ShaderType type
)
{
ArgumentNullException.ThrowIfNull(handles);
Handles = handles;
_handles = handles.ToArray();
Type = type;
}
public int Count => Handles.Length;
public GlHandle this[
int index
] => _handles[index];
public GlHandle[] Handles { get; }
public int Count => _handles.Length;
public ReadOnlySpan<GlHandle> Handles => _handles;
public ShaderType Type { get; }
public GlHandle this[int index] => Handles[index];
}
public enum ShaderStatus : int
@@ -45,5 +48,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// An OpenGL shader-program handle.
/// </summary>
public readonly record struct ShaderProgram(GlHandle Handle);
public readonly record struct ShaderProgram(
GlHandle Handle
);
}
@@ -1,68 +0,0 @@
// -----------------------------------------------------------------------------
// file="Uniform"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
namespace StgSharp.Graphics.OpenGL
{
public abstract class Uniform
{
internal readonly GlHandle id;
protected Uniform(
GlHandle handle
)
{
id = handle;
}
public GlHandle Handle => id;
}
public sealed class Uniform<T> : Uniform where T : unmanaged
{
public Uniform(
GlHandle handle
)
: base(handle) { }
}
public sealed class Uniform<T, U> : Uniform where T : unmanaged where U : struct
{
public Uniform(
GlHandle handle
)
: base(handle) { }
}
public sealed class Uniform<T, U, V> : Uniform where T : unmanaged where U : struct
where V : struct
{
public Uniform(
GlHandle handle
)
: base(handle) { }
}
public sealed class Uniform<T, U, V, W> : Uniform where T : unmanaged where U : struct
where V : struct
where W : struct
{
public Uniform(
GlHandle handle
)
: base(handle) { }
}
}
+2 -2
View File
@@ -57,13 +57,13 @@ namespace StgSharp.Graphics.OpenGL
return;
}
delegate*<ReadOnlySpan<byte>, IntPtr> loader = &GraphicFramework.glfwGetProcAddress;
delegate* <ReadOnlySpan<byte>, IntPtr> loader = &GraphicFramework.glfwGetProcAddress;
IntPtr getString = GraphicFramework.glfwGetProcAddress("glGetString"u8);
if (getString == IntPtr.Zero) {
throw new NotSupportedException("Cannot load glGetString from the current context.");
}
context->glGetString = (delegate*<uint, byte*>)getString;
context->glGetString = (delegate* unmanaged[Cdecl]<uint, byte*>)getString;
byte* versionPointer = context->glGetString(GlVersion);
if (versionPointer == null) {
throw new NotSupportedException("The current context did not report an OpenGL version.");
-204
View File
@@ -1,204 +0,0 @@
// -----------------------------------------------------------------------------
// file="glEnum"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics.OpenGL
{
public enum PixelChannelLayout
{
UByte = glConst.UNSIGNED_BYTE,
Byte = glConst.BYTE,
UShort = glConst.UNSIGNED_SHORT,
Short = glConst.SHORT,
UInt = glConst.UNSIGNED_INT,
Int = glConst.INT,
Float = glConst.FLOAT,
UByte332 = glConst.UNSIGNED_BYTE_3_3_2,
UByte233Rev = glConst.UNSIGNED_BYTE_2_3_3_REV,
UShort565 = glConst.UNSIGNED_SHORT_5_6_5,
UShort565Rev = glConst.UNSIGNED_SHORT_5_6_5_REV,
UShort4444 = glConst.UNSIGNED_SHORT_4_4_4_4,
UShort4444Rev = glConst.UNSIGNED_SHORT_4_4_4_4_REV,
UShort5551 = glConst.UNSIGNED_SHORT_5_5_5_1,
UShort1555Rev = glConst.UNSIGNED_SHORT_1_5_5_5_REV,
UInt8888 = glConst.UNSIGNED_INT_8_8_8_8,
UInt8888Rev = glConst.UNSIGNED_INT_8_8_8_8_REV,
UInt1010102 = glConst.UNSIGNED_INT_10_10_10_2,
UInt2101010Rev = glConst.UNSIGNED_INT_2_10_10_10_REV
}
public enum FaceMode
{
Point = glConst.POINT,
Line = glConst.LINE,
Fill = glConst.FILL
}
public enum FrameBufferStatus
{
Complete = glConst.FRAMEBUFFER_COMPLETE, // GL_FRAMEBUFFER_COMPLETE
IncompleteAttachment = glConst.FRAMEBUFFER_INCOMPLETE_ATTACHMENT, // GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
IncompleteMissingAttachment = glConst.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, // GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
IncompleteDrawBuffer = glConst.FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER, // GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER
IncompleteReadBuffer = glConst.FRAMEBUFFER_INCOMPLETE_READ_BUFFER, // GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER
Unsupported = glConst.FRAMEBUFFER_UNSUPPORTED, // GL_FRAMEBUFFER_UNSUPPORTED
IncompleteMultiSample = glConst.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE, // GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE
IncompleteLayerTargets = glConst.FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS // GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS
}
public enum FrameBufferChannel
{
STENCIL_INDEX = glConst.STENCIL_INDEX,
DEPTH_COMPONENT = glConst.DEPTH_COMPONENT,
DEPTH_STENCIL = glConst.DEPTH_STENCIL,
RED = glConst.RED,
GREEN = glConst.GREEN,
BLUE = glConst.BLUE,
RGB = glConst.RGB,
BGR = glConst.BGR,
RGBA = glConst.RGBA,
BGRA = glConst.BGRA
}
public enum FrameBufferAttachment
{
Color = glConst.COLOR_ATTACHMENT0,
Depth = glConst.DEPTH_ATTACHMENT,
Stencil = glConst.STENCIL_ATTACHMENT,
DepthAndStencil = glConst.DEPTH_STENCIL_ATTACHMENT,
}
public enum Texture2DTarget
{
Texture2D = glConst.TEXTURE_2D,
ProxyTexture2D = glConst.PROXY_TEXTURE_2D,
Texture1DArray = glConst.TEXTURE_1D_ARRAY,
ProxyTexture1DArray = glConst.PROXY_TEXTURE_1D_ARRAY,
TextureRectangle = glConst.TEXTURE_RECTANGLE,
ProxyTextureRectangle = glConst.PROXY_TEXTURE_RECTANGLE,
TextureCubeMapPositiveX = glConst.TEXTURE_CUBE_MAP_POSITIVE_X,
TextureCubeMapNegativeX = glConst.TEXTURE_CUBE_MAP_NEGATIVE_X,
TextureCubeMapPositiveY = glConst.TEXTURE_CUBE_MAP_POSITIVE_Y,
TextureCubeMapNegativeY = glConst.TEXTURE_CUBE_MAP_NEGATIVE_Y,
TextureCubeMapPositiveZ = glConst.TEXTURE_CUBE_MAP_POSITIVE_Z,
TextureCubeMapNegativeZ = glConst.TEXTURE_CUBE_MAP_NEGATIVE_Z,
ProxyTextureCubeMap = glConst.PROXY_TEXTURE_CUBE_MAP
}
public enum RenderBufferInternalFormat : uint
{
RGBA8 = glConst.RGBA8,
Depth24_Stencil8 = glConst.DEPTH24_STENCIL8,
}
public enum glOperation : uint
{
StencilTest = glConst.STENCIL_TEST,
DepthTest = glConst.DEPTH_TEST,
PolygonOffsetFill = glConst.POLYGON_OFFSET_FILL,
PolygonOffsetLine = glConst.POLYGON_OFFSET_LINE,
PolygonOffsetPoint = glConst.POLYGON_OFFSET_POINT,
}
#pragma warning disable CA1008
public enum ShaderType : int
#pragma warning restore CA1008
{
Fragment = glConst.FRAGMENT_SHADER,
Vertex = glConst.VERTEX_SHADER,
Compute = glConst.COMPUTE_SHADER,
Geometry = glConst.GEOMETRY_SHADER,
}
#pragma warning disable CA1008
public enum BufferType : int
#pragma warning restore CA1008
{
ArrayBuffer = glConst.ARRAY_BUFFER,
ElementArrayBuffer = glConst.ELEMENT_ARRAY_BUFFER,
AtomicCounterBuffer = glConst.ATOMIC_COUNTER_BUFFER,
CopyHeadBuffer = glConst.COPY_READ_BUFFER,
COPY_WRITE_BUFFER = glConst.COPY_WRITE_BUFFER,
DISPATCH_INDIRECT_BUFFER = glConst.DISPATCH_INDIRECT_BUFFER,
DRAW_INDIRECT_BUFFER = glConst.DRAW_INDIRECT_BUFFER,
PIXEL_PACK_BUFFER = glConst.PIXEL_PACK_BUFFER,
PIXEL_UNPACK_BUFFER = glConst.PIXEL_UNPACK_BUFFER,
QUERY_BUFFER = glConst.QUERY_BUFFER,
ShaderStorageBuffer = glConst.SHADER_STORAGE_BUFFER,
TEXTURE_BUFFER = glConst.TEXTURE_BUFFER,
TRANSFORM_FEEDBACK_BUFFER = glConst.TRANSFORM_FEEDBACK_BUFFER,
UNIFORM_BUFFER = glConst.UNIFORM_BUFFER,
}
#pragma warning disable CA1008
public enum BufferUsage : int
#pragma warning restore CA1008
{
StreamDraw = 0x88E0,
StreamRead = 0x88E1,
StreamCopy = 0x88E2,
StaticDraw = 0x88E4,
StaticRead = 0x88E5,
StaticCopy = 0x88E6,
DynamicDraw = 0x88E8,
DynamicRead = 0x88E9,
DynamicCopy = 0x88EA
}
public enum MaskBufferBit
{
COLOR = glConst.COLOR_BUFFER_BIT,
DEPTH = glConst.DEPTH_BUFFER_BIT,
STENCIL = glConst.STENCIL_BUFFER_BIT,
}
public enum GeometryType : uint
{
POINTS = 0x0000,
LINES = 0x0001,
LINE_LOOP = 0x0002,
LINE_STRIP = 0x0003,
TRIANGLES = 0x0004,
TRIANGLE_STRIP = 0x0005,
TRIANGLE_FAN = 0x0006
}
public enum TextureFiltering
{
Nearest = 0x2600,
Linear = 0x2601
}
}
+1 -14
View File
@@ -23,13 +23,11 @@ namespace StgSharp.Graphics.OpenGL
public struct GlHandle
{
[FieldOffset(0)] internal int SignedValue;
[FieldOffset(0)] internal uint Value;
public GlHandle()
{
Unsafe.SkipInit(out Value);
Unsafe.SkipInit(out SignedValue);
Unsafe.SkipInit(out this);
}
@@ -49,16 +47,5 @@ namespace StgSharp.Graphics.OpenGL
};
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static GlHandle CreateSigned(
int value
)
{
return new GlHandle
{
SignedValue = value
};
}
}
}
}
+10 -29
View File
@@ -8,35 +8,17 @@
using StgSharp.Geometries;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Numeric.Graphics;
using StgSharp.Mathematics.Numeric.Graphics;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Graphics
{
public class PlainGeometryMesh
{
private PlainGeometry _shape;
private TextureProvider _texture;
public PlainGeometryMesh(
[NotNull] PlainGeometry shape,
[NotNull] TextureProvider texture
)
{
if (shape.VertexCount > texture.TextureCoordinate.Length) {
throw new ArgumentException(
paramName:nameof(texture),
message:"Amount of texture coordination is too less");
}
_texture = texture;
_shape = shape;
}
private readonly PlainGeometry _shape;
private readonly Vec2[] _textureCoordinates;
private readonly Image<Rgba8> _textureImage;
public PlainGeometryMesh(
PlainGeometry shape,
@@ -45,6 +27,7 @@ namespace StgSharp.Graphics
)
{
ArgumentNullException.ThrowIfNull(shape);
ArgumentNullException.ThrowIfNull(texture);
ArgumentNullException.ThrowIfNull(texCoord);
if (shape.VertexCount > texCoord.Length) {
@@ -52,27 +35,25 @@ namespace StgSharp.Graphics
paramName:nameof(texCoord),
message:"Amount of texture coordination is too less");
}
_texture = new TextureProvider(texture, texCoord);
_shape = shape;
_textureImage = texture;
_textureCoordinates = texCoord;
}
public Vec4[] VertexArray => _shape.VertexStream;
public Image<Rgba8> TextureImage
{
get => _texture.Image;
internal set => _texture.Image = value;
}
public Image<Rgba8> TextureImage => _textureImage;
public ReadOnlySpan<int> MeshIndices => _shape.VertexIndices;
public ReadOnlySpan<Vec4> TextureCoord => MemoryMarshal.Cast<Vec2, Vec4>(
_texture.TextureCoordinate);
_textureCoordinates);
public PlainGeometryMesh Resize(
PlainGeometry newShape
)
{
return new PlainGeometryMesh(newShape, _texture);
return new PlainGeometryMesh(newShape, _textureImage, _textureCoordinates);
}
}
+3 -3
View File
@@ -27,7 +27,7 @@ namespace StgSharp.Graphics
private Camera nativeCamera;
private protected ViewPort primeArgs;
private protected ViewSurface primeArgs;
internal TimeSpanProvider _timeProvider;
public (int width, int height) Size => (Width, Height);
@@ -46,7 +46,7 @@ namespace StgSharp.Graphics
public string Name => primeArgs.Name;
public ViewPort BindedViewPortContext
public ViewSurface BindedViewPortContext
{
get => primeArgs;
internal set => primeArgs = value;
@@ -138,7 +138,7 @@ namespace StgSharp.Graphics
#region internal operation
public void Initialize(
ViewPort v,
ViewSurface v,
TimeSpanProvider timeProvider
)
{
-53
View File
@@ -1,53 +0,0 @@
// -----------------------------------------------------------------------------
// file="TextureProvider"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using StgSharp.Mathematics.Numeric.Graphics;
using System;
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics
{
public class TextureProvider
{
private Vec2[] _texCoord;
private Image<Rgba8> _image;
public TextureProvider(
Image<Rgba8> image,
Vec2[] coord
)
{
ArgumentNullException.ThrowIfNull(image);
ArgumentNullException.ThrowIfNull(coord);
_image = image;
_texCoord = coord;
}
public ref Vec2 this[
int index
]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => ref _texCoord[index];
}
public Image<Rgba8> Image
{
get => _image;
set
{
ArgumentNullException.ThrowIfNull(value);
_image = value;
}
}
public Span<Vec2> TextureCoordinate => new Span<Vec2>(_texCoord);
}
}
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------------
// file="ViewPort"
// file="ViewSurface"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
@@ -15,13 +15,13 @@ using System.Threading;
namespace StgSharp.Graphics
{
public class ViewPort
public class ViewSurface
{
private static readonly ConcurrentDictionary<IntPtr, ViewPort> _handleToViewPortIndex = [];
private static readonly ConcurrentDictionary<IntPtr, ViewSurface> _handleToViewPortIndex = [];
private int _width, _height, _newWidth, _newHeight;
internal unsafe ViewPort()
internal unsafe ViewSurface()
{
_newHeight = 600;
_newWidth = 800;
@@ -38,7 +38,7 @@ namespace StgSharp.Graphics
_ = _handleToViewPortIndex.TryAdd(ViewPortHandle, this);
}
public unsafe ViewPort(
public unsafe ViewSurface(
int width,
int height,
string name,
@@ -87,7 +87,7 @@ namespace StgSharp.Graphics
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool GetExistedViewPort(
IntPtr handle,
out ViewPort port
out ViewSurface port
)
{
return _handleToViewPortIndex.TryGetValue(handle, out port);
@@ -1,60 +0,0 @@
// -----------------------------------------------------------------------------
// file="frameworkSyncContext"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.Threading
{
public class FrameworkSyncContext : SynchronizationContext
{
private readonly BlockingCollection<SendOrPostCallback> _syncContexts = [];
private readonly Thread _mainThread = Thread.CurrentThread;
public FrameworkSyncContext()
{
_mainThread = Thread.CurrentThread;
}
public static FrameworkSyncContext MainThreadContext
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
} = new FrameworkSyncContext();
public override void Post(
SendOrPostCallback d,
object state
)
{
_syncContexts.Add(d);
}
public override void Send(
SendOrPostCallback d,
object state
)
{
if (Thread.CurrentThread == _mainThread)
{
d(state);
} else
{
Post(d, state);
}
}
}
}
@@ -14,9 +14,9 @@ using System.Runtime.InteropServices;
namespace StgSharp.Geometries
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate Vec3 GeometryMotionDelegate(
TimeSpanProvider timeSource,
out float rotation
public delegate Vec3<float> GeometryMotionDelegate(
TimeSpanProvider timeSource,
out float rotation
);
public class GeometryMotion
@@ -38,7 +38,7 @@ namespace StgSharp.Geometries
time = timeSource;
if (motionDelegate == null)
{
handle = (IntPtr)(delegate*<TimeSpanProvider, out float, Vec3>)&defaultMotion;
handle = (IntPtr)(delegate*<TimeSpanProvider, out float, Vec3<float>>)&defaultMotion;
movement = defaultMotion;
} else if (motionDelegate.Method.IsStatic)
{
@@ -58,15 +58,15 @@ namespace StgSharp.Geometries
public static GeometryMotion DefaultMotion => new GeometryMotion(true, null, null);
public unsafe void RunMotion(
ref Vec3 coord,
ref Vec3<float> coord,
ref float rotation
)
{
float rot;
Vec3 vec;
Vec3<float> vec;
if (sourceIsStatic)
{
vec = ((delegate* unmanaged[Cdecl]<TimeSpanProvider, out float, Vec3>)handle)(
vec = ((delegate* unmanaged[Cdecl]<TimeSpanProvider, out float, Vec3<float>>)handle)(
time, out rot);
} else
{
@@ -84,13 +84,13 @@ namespace StgSharp.Geometries
}
}
private static Vec3 defaultMotion(
TimeSpanProvider provider,
out float rotation
private static Vec3<float> defaultMotion(
TimeSpanProvider provider,
out float rotation
)
{
rotation = 0;
return Vec3.Zero;
return Vec3<float>.Zero;
}
}//------------------------------- End of Class -------------------------------
@@ -21,14 +21,14 @@ namespace StgSharp.Geometries
public interface IInstancing
{
public float Rotation { get => GlobalBuffer.CoordAndRotationList[BufferId].W; set
{
Vec4 temp = GlobalBuffer.CoordAndRotationList[
BufferId];
temp.W = value;
GlobalBuffer.CoordAndRotationList[
BufferId] = temp;
} }
public float Rotation //
{ get => GlobalBuffer.CoordAndRotationList[BufferId].W; //
set
{
Vec4<float> temp = GlobalBuffer.CoordAndRotationList[BufferId];
temp.W = value;
GlobalBuffer.CoordAndRotationList[BufferId] = temp;
} }
public float Scale { get => GlobalBuffer.ScalingList[BufferId]; set => GlobalBuffer.ScalingList[BufferId] =
value; }
@@ -39,14 +39,14 @@ namespace StgSharp.Geometries
public int BufferId { get; internal set; }
public Vec3 CenterPositionGlobal { get; internal set; }
public Vec3<float> CenterPositionGlobal { get; internal set; }
public Vec3 Coord { get => GlobalBuffer.CoordAndRotationList[BufferId].XYZ; set => GlobalBuffer.CoordAndRotationList[BufferId] =
new Vec4(value.reg); }
public Vec3<float> Coord { get => GlobalBuffer.CoordAndRotationList[BufferId].XYZ; set => GlobalBuffer.CoordAndRotationList[BufferId] =
new Vec4<float>(value.reg); }
public void Move()
{
(Vec3 coord, float rotation) = (Coord, Rotation);
(Vec3<float> coord, float rotation) = (Coord, Rotation);
Motion.RunMotion(ref coord, ref rotation);
(Coord, Rotation) = (coord, rotation);
}
@@ -17,7 +17,7 @@ namespace StgSharp.Geometries
public interface IInstancingBuffer
{
public Span<Vec4> CoordAndRotationSpan { get; }
public Span<Vec4<float>> CoordAndRotationSpan { get; }
public Span<float> ScalingSpan { get; }
@@ -25,7 +25,7 @@ namespace StgSharp.Geometries
internal List<IInstancing> InstanceList { get; }
internal List<Vec4> CoordAndRotationList { get; }
internal List<Vec4<float>> CoordAndRotationList { get; }
internal List<float> ScalingList { get; }
@@ -252,7 +252,7 @@ namespace StgSharp.Mathematics.Numeric.Graphics
internal struct Column
{
private Vec4 value;
private Vec4<float> value;
}
@@ -17,15 +17,19 @@ namespace StgSharp.Mathematics.Numeric.Graphics
/// A four-dimensional numeric vector.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 16)]
public struct Vec4<T> : IUnmanagedVector<Vec4<T>> where T: unmanaged, INumber<T>
public struct Vec4<T> : IUnmanagedVector<Vec4<T>> where T : unmanaged, INumber<T>
{
public T W;
public T X;
public T Y;
public T Z;
public T W;
public Vec4(Vec3<T> v3, T w)
public Vec4(
Vec3<T> v3,
T w
)
{
X = v3.X;
Y = v3.Y;
@@ -33,7 +37,12 @@ namespace StgSharp.Mathematics.Numeric.Graphics
W = w;
}
public Vec4(T x, T y, T z, T w)
public Vec4(
T x,
T y,
T z,
T w
)
{
X = x;
Y = y;
@@ -43,7 +52,7 @@ namespace StgSharp.Mathematics.Numeric.Graphics
public Vec2<T> XY
{
readonly get => new(X, Y);
get => Unsafe.As<T, Vec2<T>>(ref X);
set
{
X = value.X;
@@ -53,7 +62,7 @@ namespace StgSharp.Mathematics.Numeric.Graphics
public Vec3<T> XYZ
{
readonly get => new(X, Y, Z);
get => Unsafe.As<T, Vec3<T>>(ref X);
set
{
T w = W;
@@ -67,13 +76,23 @@ namespace StgSharp.Mathematics.Numeric.Graphics
public static Vec4<T> Zero => new(T.Zero, T.Zero, T.Zero, T.Zero);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec4<T> Add(Vec4<T> left, Vec4<T> right)
public static Vec4<T> Add(
Vec4<T> left,
Vec4<T> right
)
{
return left + right;
}
public ReadOnlySpan<T> AsSpan()
{
return MemoryMarshal.CreateReadOnlySpan(ref X, 4);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly T Dot(Vec4<T> right)
public readonly T Dot(
Vec4<T> right
)
{
if (Unsafe.SizeOf<T>() == 4)
{
@@ -88,17 +107,16 @@ namespace StgSharp.Mathematics.Numeric.Graphics
throw GraphicVector.ThrowUnsupportedTypeException<T>();
}
public ReadOnlySpan<T> AsSpan()
{
return MemoryMarshal.CreateReadOnlySpan(ref X, 4);
}
public override bool Equals(object? obj)
public override bool Equals(
object? obj
)
{
return (obj is Vec4<T> v) && (v == this);
}
public static Vec4<T> FromSpan(ReadOnlySpan<T> span)
public static Vec4<T> FromSpan(
ReadOnlySpan<T> span
)
{
if (span.Length < 4) {
throw new ArgumentException("Span length must be at least 4.", nameof(span));
@@ -122,7 +140,10 @@ namespace StgSharp.Mathematics.Numeric.Graphics
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec4<T> operator -(Vec4<T> left, Vec4<T> right)
public static Vec4<T> operator -(
Vec4<T> left,
Vec4<T> right
)
{
if (Unsafe.SizeOf<T>() == 4) {
return Vec4.FromVector128Unsafe(left.AsVector128Unsafe() - right.AsVector128Unsafe());
@@ -133,13 +154,19 @@ namespace StgSharp.Mathematics.Numeric.Graphics
throw GraphicVector.ThrowUnsupportedTypeException<T>();
}
public static bool operator !=(Vec4<T> left, Vec4<T> right)
public static bool operator !=(
Vec4<T> left,
Vec4<T> right
)
{
return !(left == right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec4<T> operator *(Vec4<T> vector, T scalar)
public static Vec4<T> operator *(
Vec4<T> vector,
T scalar
)
{
if (Unsafe.SizeOf<T>() == 4) {
return Vec4.FromVector128Unsafe(vector.AsVector128Unsafe() * Vector128.Create(scalar));
@@ -151,19 +178,28 @@ namespace StgSharp.Mathematics.Numeric.Graphics
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec4<T> operator *(T scalar, Vec4<T> vector)
public static Vec4<T> operator *(
T scalar,
Vec4<T> vector
)
{
return vector * scalar;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T operator *(Vec4<T> left, Vec4<T> right)
public static T operator *(
Vec4<T> left,
Vec4<T> right
)
{
return left.Dot(right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec4<T> operator /(Vec4<T> vector, T scalar)
public static Vec4<T> operator /(
Vec4<T> vector,
T scalar
)
{
if (Unsafe.SizeOf<T>() == 4) {
return Vec4.FromVector128Unsafe(vector.AsVector128Unsafe() / Vector128.Create(scalar));
@@ -175,7 +211,10 @@ namespace StgSharp.Mathematics.Numeric.Graphics
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec4<T> operator +(Vec4<T> left, Vec4<T> right)
public static Vec4<T> operator +(
Vec4<T> left,
Vec4<T> right
)
{
if (Unsafe.SizeOf<T>() == 4) {
return Vec4.FromVector128Unsafe(left.AsVector128Unsafe() + right.AsVector128Unsafe());
@@ -186,7 +225,10 @@ namespace StgSharp.Mathematics.Numeric.Graphics
throw GraphicVector.ThrowUnsupportedTypeException<T>();
}
public static bool operator ==(Vec4<T> left, Vec4<T> right)
public static bool operator ==(
Vec4<T> left,
Vec4<T> right
)
{
if (Unsafe.SizeOf<T>() == 4) {
return left.AsVector128Unsafe() == right.AsVector128Unsafe();
@@ -5,13 +5,14 @@
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using StgSharp.Mathematics.Numeric.Graphics;
using System.Runtime.CompilerServices;
namespace StgSharp.Mathematics.Numeric.Graphics
{
public static unsafe partial class Linear
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T GetLength<T>(
this Vec3<T> vec
) where T : unmanaged, INumber<T>, IRootFunctions<T>
@@ -19,6 +20,7 @@ namespace StgSharp.Mathematics.Numeric.Graphics
return T.Sqrt(vec.Dot(vec));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T GetLength<T>(
this Vec2<T> vec
) where T : unmanaged, INumber<T>, IRootFunctions<T>
@@ -26,6 +28,7 @@ namespace StgSharp.Mathematics.Numeric.Graphics
return T.Sqrt(vec.Dot(vec));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T GetLength<T>(
this Vec4<T> vec
) where T : unmanaged, INumber<T>, IRootFunctions<T>
@@ -33,29 +36,101 @@ namespace StgSharp.Mathematics.Numeric.Graphics
return T.Sqrt(vec.Dot(vec));
}
public static float GetLength(this Vec2<int> vec) => Vec2.ConvertToSingle(vec).GetLength();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float GetLength(
this Vec2<int> vec
)
{
return Vec2.ConvertToSingle(vec).GetLength();
}
public static float GetLength(this Vec2<uint> vec) => Vec2.ConvertToSingle(vec).GetLength();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float GetLength(
this Vec2<uint> vec
)
{
return Vec2.ConvertToSingle(vec).GetLength();
}
public static double GetLength(this Vec2<long> vec) => Vec2.ConvertToDouble(vec).GetLength();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double GetLength(
this Vec2<long> vec
)
{
return Vec2.ConvertToDouble(vec).GetLength();
}
public static double GetLength(this Vec2<ulong> vec) => Vec2.ConvertToDouble(vec).GetLength();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double GetLength(
this Vec2<ulong> vec
)
{
return Vec2.ConvertToDouble(vec).GetLength();
}
public static float GetLength(this Vec3<int> vec) => Vec3.ConvertToSingle(vec).GetLength();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float GetLength(
this Vec3<int> vec
)
{
return Vec3.ConvertToSingle(vec).GetLength();
}
public static float GetLength(this Vec3<uint> vec) => Vec3.ConvertToSingle(vec).GetLength();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float GetLength(
this Vec3<uint> vec
)
{
return Vec3.ConvertToSingle(vec).GetLength();
}
public static double GetLength(this Vec3<long> vec) => Vec3.ConvertToDouble(vec).GetLength();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double GetLength(
this Vec3<long> vec
)
{
return Vec3.ConvertToDouble(vec).GetLength();
}
public static double GetLength(this Vec3<ulong> vec) => Vec3.ConvertToDouble(vec).GetLength();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double GetLength(
this Vec3<ulong> vec
)
{
return Vec3.ConvertToDouble(vec).GetLength();
}
public static float GetLength(this Vec4<int> vec) => Vec4.ConvertToSingle(vec).GetLength();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float GetLength(
this Vec4<int> vec
)
{
return Vec4.ConvertToSingle(vec).GetLength();
}
public static float GetLength(this Vec4<uint> vec) => Vec4.ConvertToSingle(vec).GetLength();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float GetLength(
this Vec4<uint> vec
)
{
return Vec4.ConvertToSingle(vec).GetLength();
}
public static double GetLength(this Vec4<long> vec) => Vec4.ConvertToDouble(vec).GetLength();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double GetLength(
this Vec4<long> vec
)
{
return Vec4.ConvertToDouble(vec).GetLength();
}
public static double GetLength(this Vec4<ulong> vec) => Vec4.ConvertToDouble(vec).GetLength();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static double GetLength(
this Vec4<ulong> vec
)
{
return Vec4.ConvertToDouble(vec).GetLength();
}
}
}
@@ -14,46 +14,112 @@ namespace StgSharp.Mathematics.Numeric.Graphics
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec2<T> Normalize<T>(this Vec2<T> vec) where T: unmanaged, INumber<T>, IRootFunctions<T>
public static Vec2<T> Normalize<T>(
this Vec2<T> vec
) where T : unmanaged, INumber<T>, IRootFunctions<T>
{
return vec / T.Sqrt(vec.Dot(vec));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec3<T> Normalize<T>(this Vec3<T> vec) where T: unmanaged, INumber<T>, IRootFunctions<T>
public static Vec3<T> Normalize<T>(
this Vec3<T> vec
) where T : unmanaged, INumber<T>, IRootFunctions<T>
{
return vec / T.Sqrt(vec.Dot(vec));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec4<T> Normalize<T>(this Vec4<T> vec) where T: unmanaged, INumber<T>, IRootFunctions<T>
public static Vec4<T> Normalize<T>(
this Vec4<T> vec
) where T : unmanaged, INumber<T>, IRootFunctions<T>
{
return vec / T.Sqrt(vec.Dot(vec));
}
public static Vec2<float> Normalize(this Vec2<int> vec) => Vec2.ConvertToSingle(vec).Normalize();
public static Vec2<float> Normalize(
this Vec2<int> vec
)
{
return Vec2.ConvertToSingle(vec).Normalize();
}
public static Vec2<float> Normalize(this Vec2<uint> vec) => Vec2.ConvertToSingle(vec).Normalize();
public static Vec2<float> Normalize(
this Vec2<uint> vec
)
{
return Vec2.ConvertToSingle(vec).Normalize();
}
public static Vec2<double> Normalize(this Vec2<long> vec) => Vec2.ConvertToDouble(vec).Normalize();
public static Vec2<double> Normalize(
this Vec2<long> vec
)
{
return Vec2.ConvertToDouble(vec).Normalize();
}
public static Vec2<double> Normalize(this Vec2<ulong> vec) => Vec2.ConvertToDouble(vec).Normalize();
public static Vec2<double> Normalize(
this Vec2<ulong> vec
)
{
return Vec2.ConvertToDouble(vec).Normalize();
}
public static Vec3<float> Normalize(this Vec3<int> vec) => Vec3.ConvertToSingle(vec).Normalize();
public static Vec3<float> Normalize(
this Vec3<int> vec
)
{
return Vec3.ConvertToSingle(vec).Normalize();
}
public static Vec3<float> Normalize(this Vec3<uint> vec) => Vec3.ConvertToSingle(vec).Normalize();
public static Vec3<float> Normalize(
this Vec3<uint> vec
)
{
return Vec3.ConvertToSingle(vec).Normalize();
}
public static Vec3<double> Normalize(this Vec3<long> vec) => Vec3.ConvertToDouble(vec).Normalize();
public static Vec3<double> Normalize(
this Vec3<long> vec
)
{
return Vec3.ConvertToDouble(vec).Normalize();
}
public static Vec3<double> Normalize(this Vec3<ulong> vec) => Vec3.ConvertToDouble(vec).Normalize();
public static Vec3<double> Normalize(
this Vec3<ulong> vec
)
{
return Vec3.ConvertToDouble(vec).Normalize();
}
public static Vec4<float> Normalize(this Vec4<int> vec) => Vec4.ConvertToSingle(vec).Normalize();
public static Vec4<float> Normalize(
this Vec4<int> vec
)
{
return Vec4.ConvertToSingle(vec).Normalize();
}
public static Vec4<float> Normalize(this Vec4<uint> vec) => Vec4.ConvertToSingle(vec).Normalize();
public static Vec4<float> Normalize(
this Vec4<uint> vec
)
{
return Vec4.ConvertToSingle(vec).Normalize();
}
public static Vec4<double> Normalize(this Vec4<long> vec) => Vec4.ConvertToDouble(vec).Normalize();
public static Vec4<double> Normalize(
this Vec4<long> vec
)
{
return Vec4.ConvertToDouble(vec).Normalize();
}
public static Vec4<double> Normalize(this Vec4<ulong> vec) => Vec4.ConvertToDouble(vec).Normalize();
public static Vec4<double> Normalize(
this Vec4<ulong> vec
)
{
return Vec4.ConvertToDouble(vec).Normalize();
}
}
}
@@ -5,77 +5,58 @@
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using StgSharp.Mathematics.Numeric.Graphics;
using System.Numerics;
using System.Runtime.CompilerServices;
namespace StgSharp.Mathematics.Numeric.Graphics
{
public static partial class Linear
{
public static Vec4 Orthogonalize(
this Vec4 vec
)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec4<T> Orthogonalize<T>(
this Vec4<T> vec
) where T : unmanaged, INumber<T>, IRootFunctions<T>
{
return new Vec4
{
vec = Vector4.Normalize(vec.vec)
};
return vec.Normalize();
}
public static Vec3 Orthogonalize(
Vec3 vec
)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec3<T> Orthogonalize<T>(
this Vec3<T> vec
) where T : unmanaged, INumber<T>, IRootFunctions<T>
{
return new Vec3
{
v = Vector3.Normalize(vec.v)
};
}
public static unsafe void Orthogonalize(
this Vec4 source,
ref Vec4 target
)
{
Vector4 s = source.vec;
Vector4 t = target.vec;
s = Vector4.Normalize(s);
Vector4 projection = Vector4.Multiply(s, t);
t -= projection;
source.vec = s;
target.vec = t;
return vec.Normalize();
}
/// <summary>
/// Orthogonalize two <see cref="Vec3" />s, let their length be 1 and perpendicular to
/// each other.
/// Normalizes two vectors and makes <paramref name="target" /> perpendicular to <paramref
/// name="source" />.
/// </summary>
/// <param _label="source">
///
/// </param>
/// <param _label="target">
///
/// </param>
public static unsafe void Orthogonalize(
this Vec3 source,
ref Vec3 target
)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Orthogonalize<T>(
this ref Vec4<T> source,
ref Vec4<T> target
) where T : unmanaged, INumber<T>, IRootFunctions<T>
{
Vector3 s = source.v;
Vector3 t = target.v;
source = source.Normalize();
target -= source * target.Dot(source);
target = target.Normalize();
}
s = Vector3.Normalize(s);
Vector3 projection = Vector3.Dot(t, s) / Vector3.Dot(s, s) * s;
t -= projection;
t = Vector3.Normalize(t);
source.v = s;
target.v = t;
/// <summary>
/// Normalizes two vectors and makes <paramref name="target" /> perpendicular to <paramref
/// name="source" />.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Orthogonalize<T>(
this ref Vec3<T> source,
ref Vec3<T> target
) where T : unmanaged, INumber<T>, IRootFunctions<T>
{
source = source.Normalize();
target -= source * target.Dot(source);
target = target.Normalize();
}
}
@@ -0,0 +1,169 @@
# NGRA `COUNT(UNIT)` 生成说明
本文记录 `TextRegexSourceGen.GenerateCount` 中单字符重复分支的当前设计,方便后续继续实现。
相关代码:[`Text/TextRegexSourceGen.GenClass.cs`](Text/TextRegexSourceGen.GenClass.cs)。
## 目标
对于 `a{min,max}`,不要把必需的 `min` 次匹配生成成逐字符循环。生成器先把字符重复 `min` 次,形成一个字符串字面量,并使用一次 `StartsWith` 验证下界:
```csharp
if (__remain.StartsWith("aaa"))
{
// 已经确认至少存在 min 个 a。
}
else
{
// 当前工作 region 失败。
}
```
匹配成功后一次性消费这个前缀,再只处理区间中可选的部分:
```text
必需前缀:min 次
可选尾部:max - min 次
```
`max < 0` 表示尾部没有上限。
## AST 数据归属
`COUNT` 配置属于操作符节点,重复的字符属于其子节点:
```csharp
RegexCountPayload payload = node.PayloadAs<RegexCountPayload>();
RegexAstNode value = RegexAstNode.IsNullOrEmpty(node.Left)
? node.Right
: node.Left;
char expected = value.Value[0];
```
不要从 `value` 读取 `RegexCountPayload`。`value` 携带的是 `RegexLiteralPayload` 或其他被重复元素的 payload。
字符应从 `value.Value` 读取,因为它是解码后的值。使用 `value.Source.Source[0]` 会把 `\t` 等转义序列错误地识别成 `'\\'`。
## 量词语义
| 量词 | `min` | `max` | 尾部处理 |
| --- | ---: | ---: | --- |
| `a{n}` | `n` | `n` | 无可选尾部 |
| `a{m,n}` | `m` | `n` | 最多再消费 `n - m` 次 |
| `a*` | `0` | `-1` | 无上限 |
| `a+` | `1` | `-1` | 验证一次后无上限 |
| `a?` | `0` | `1` | 最多消费一次 |
| `a{m,}` | `m` | `-1` | 验证 `m` 次后无上限 |
有限上限可以生成:
```csharp
__remain = __remain.Slice(min);
for (int i = 0;
i < max - min &&
!__remain.IsEmpty &&
__remain[0] == expected;
i++)
{
__remain = __remain.Slice(1);
}
```
无上限不能计算 `max - min`,否则结果为负数、循环不会执行。应单独生成:
```csharp
__remain = __remain.Slice(min);
while (!__remain.IsEmpty && __remain[0] == expected)
{
__remain = __remain.Slice(1);
}
```
`!__remain.IsEmpty` 必须位于 `__remain[0]` 之前。输入恰好在必需前缀后耗尽时,直接索引会抛出 `IndexOutOfRangeException`。
## 贪婪与惰性
贪婪量词可以先消费尽可能多的可选尾部,再尝试后续 continuation。如果后续失败,需要逐次回退消费数量并重试。
惰性量词只应先消费 `min`,立即尝试后续 continuation;后续失败时,才逐次多消费一个匹配字符。
因此 `is_greedy` 不能只改变扫描循环,它最终需要与后续节点的 continuation 和回溯状态一起实现。若 COUNT 位于匹配末尾,贪婪模式可直接扫描至上限,惰性模式保留在 `min` 即可。
## 失败工作 region
当前试点使用 `do { } while (false)`,使局部失败可以写成 `break`:
```csharp
bool regionSucceeded = false;
ReadOnlySpan<char> checkpoint = __remain;
do
{
if (!__remain.StartsWith(requiredPrefix))
{
break;
}
__remain = __remain.Slice(min);
// 匹配可选尾部和后续节点。
regionSucceeded = true;
}
while (false);
if (!regionSucceeded)
{
__remain = checkpoint;
// 向父 region 传播失败,或者在顶层返回失败结果。
}
```
只有 COUNT 自己被 `do/while(false)` 包裹时,`break` 结束后仍会执行下一个 CONCAT 节点,不能真正表达匹配失败。最终 region 应由以下之一持有:
- 包含后续 continuation 的 `CONCAT`;
- 一条完整的 ALT 候选路径;
- 顶层匹配方法。
父 region 负责保存 cursor 和 capture checkpoint。子节点失败后退出父 region,由父 region 统一恢复状态。ALT 和贪婪/惰性 COUNT 还需要保存多个可重试位置,不能只依赖一次 `break`。
## 摊平阈值
不要无条件执行:
```csharp
Span<char> required = stackalloc char[min];
```
量词来自用户输入,`a{1000000}` 会让源生成器尝试进行巨大的栈分配,并生成巨型字符串字面量。建议设置较小阈值,例如 32 或 64:
- `min <= threshold`:摊平为字面量并调用 `StartsWith`;
- `min > threshold`:生成有界字符循环,或在前期分析中选择专用 IR;
- 非法或超过生成器限制的数量:报告 Roslyn diagnostic,而不是让生成器崩溃。
## 后续实现顺序
1. 从 `node` 读取 `RegexCountPayload`,并用 Empty sentinel 安全选择子节点。
2. 改用 `value.Value[0]` 获取解码字符。
3. 为所有尾部循环加入 `!__remain.IsEmpty`。
4. 分开生成有限上限和 `max < 0` 两种循环。
5. 增加摊平阈值,避免巨大 `stackalloc` 和生成源膨胀。
6. 将工作 region 上移到 CONCAT/候选路径,完成失败传播和 checkpoint 恢复。
7. 接入 greedy/lazy continuation 回溯。
8. 最后处理 capture 状态的保存与恢复。
## 最小测试矩阵
至少覆盖以下模式和输入:
- `a{0}`:空输入、`a`;
- `a{3}`:`aa`、`aaa`、`aaaa`;
- `a{2,4}`:长度 1 到 5;
- `a*`、`a+`、`a?`、`a{2,}`;
- `\t{2}`:确认使用解码字符;
- `a{2,4}ab`:验证贪婪回退;
- `a{2,4}?ab`:验证惰性扩展;
- COUNT 位于 CONCAT、ALT 和捕获 GROUP 内的失败恢复;
- 输入恰好在 `min` 处结束,确认不会索引空 span;
- 超大 `min`,确认不会导致生成器栈溢出或生成巨型源码。
@@ -51,6 +51,11 @@ namespace StgSharp.RegularAnalysis.Text
case RegexElementLabel.ALT:
GenerateAlt(root, sc, func_list, context);
break;
default:
// TODO(NGRA): Report an unsupported operator instead of silently emitting
// an incomplete matcher.
break;
}
} else
{
@@ -58,10 +63,23 @@ namespace StgSharp.RegularAnalysis.Text
switch (op)
{
case RegexElementLabel.UNIT:
// TODO(NGRA): Emit the remaining-span length guard, literal comparison,
// cursor advance, and failure transfer for one character.
break;
case RegexElementLabel.UNIT_SET:
// TODO(NGRA): Emit the remaining-span length guard, charset predicate,
// cursor advance, and failure transfer.
break;
case RegexElementLabel.UNIT_SPAN:
// TODO(NGRA): Emit StartsWith for the complete literal span and advance by
// the literal length; integrate is_find candidate retry semantics.
break;
default:
// TODO(NGRA): Diagnose malformed leaf nodes instead of generating no code.
break;
}
}
@@ -76,6 +94,13 @@ namespace StgSharp.RegularAnalysis.Text
return SyntaxFactory.Literal(value).Text;
}
private static string FormatStringLiteral(
ReadOnlySpan<char> value
)
{
return SyntaxFactory.Literal(value.ToString()).Text;
}
private static string FormatCharLiteral(
char value
)
@@ -109,6 +134,9 @@ namespace StgSharp.RegularAnalysis.Text
}
goto default;
default:
// TODO(NGRA): Unsupported/empty charset rules must become an analyzer
// diagnostic; returning an empty expression produces invalid generated C#.
return string.Empty;
}
}
@@ -127,7 +155,11 @@ namespace StgSharp.RegularAnalysis.Text
return false;
}
RegexAstNode group = node.Left;
if ((group.Label & RegexElementLabel.GROUP_BEGIN) == 0) {
// TODO(NGRA): Validate the normalized CONCAT/GROUP/COUNT shape with Empty sentinels
// before dereferencing children; this helper currently assumes every edge exists.
if ((group.Label & RegexElementLabel.GROUP_BEGIN) == 0)
{
return false;
}
RegexAstNode count = group.Right;
@@ -150,7 +182,10 @@ namespace StgSharp.RegularAnalysis.Text
)
{
RegexAstNode current = node.Right;
string exit_label = context.RequestExitAlt();
string exit_label = context.RequestExitLabel();
// TODO(NGRA): Walk every normalized ALT candidate exactly once. The final traversal
// shape and failure continuation are not wired yet.
while (RegexAstNode.IsNullOrEmpty(current))
{
RegexElementLabel op = current.Label & RegexElementLabel.SEQUENCE;
@@ -160,6 +195,8 @@ namespace StgSharp.RegularAnalysis.Text
switch (op)
{
case RegexElementLabel.UNIT:
// TODO(NGRA): Guard against an empty remaining span before indexing it.
_ = sc.AppendLine(@$"if({context.RemainSpan}[0] == {FormatCharLiteral(code[0])})")
.AppendLine("{")
.AppendLine($@"{context.RemainSpan} = {context.RemainSpan}.Slice(1);")
@@ -167,6 +204,9 @@ namespace StgSharp.RegularAnalysis.Text
.AppendLine("}");
break;
case RegexElementLabel.UNIT_SET:
// TODO(NGRA): Guard the remaining span, handle empty/Any sets, and
// validate negated-set composition before emitting this predicate.
RegexCharSetPayload payload = current.PayloadAs<RegexCharSetPayload>();
IReadOnlyList<RegexCharSet> split = payload.Set;
bool accept = payload.Accept;
@@ -185,6 +225,9 @@ namespace StgSharp.RegularAnalysis.Text
.AppendLine("}");
break;
case RegexElementLabel.UNIT_SPAN:
// TODO(NGRA): Advance by code.Length rather than one character and
// preserve the ALT rollback cursor on failure.
_ = sc.AppendLine(@$"if({context.RemainSpan}.{MemoryExtensions.StartsWith}({FormatStringLiteral(code)}))")
.AppendLine("{")
.AppendLine($@"{context.RemainSpan} = {context.RemainSpan}.Slice(1);")
@@ -193,14 +236,23 @@ namespace StgSharp.RegularAnalysis.Text
break;
default:
// TODO(NGRA): Route unsupported ALT candidates through the recursive
// matcher or report a source-generation diagnostic.
break;
}
// TODO(NGRA): Advance to the next ALT candidate after a scalar candidate
// misses; the current sequence branch does not update current.
} else
{
GenerateMethodSource(current, sc, func_list, context);
current = current.Next;
}
}
// TODO(NGRA): Emit the all-alternatives-failed continuation before the shared success
// label, including restoration of the entry cursor and capture state.
_ = sc.AppendLine($@"{exit_label}: {{ }}");
}
@@ -216,6 +268,8 @@ namespace StgSharp.RegularAnalysis.Text
RegexGroupPayload config = node.PayloadAs<RegexGroupPayload>();
// TODO(NGRA): Select the owned group body using Empty-sentinel checks, snapshot its
// start cursor, and restore it when the child matcher fails.
if (left is not null)
{
GenerateMethodSource(left, sc, func_list, context);
@@ -225,6 +279,9 @@ namespace StgSharp.RegularAnalysis.Text
}
string group_name = config.Name;
// TODO(NGRA): Allocate numeric/named capture slots and emit the successful capture
// span. Non-capturing groups still need a rollback scope but no stored capture.
throw new NotImplementedException();
}
@@ -246,17 +303,19 @@ namespace StgSharp.RegularAnalysis.Text
left.Right.Source.Source == "." &&
right is not null)
{
// TODO use find
// TODO(NGRA): Emit the unnamed FIND candidate loop and retry the right subtree
// until it succeeds or no anchor candidate remains.
GenerateMethodSource(right, sc, func_list, context, true);
} else if (IsNamedFind(node))
{
if (right is not null)
{
// TODO named find
// TODO(NGRA): Emit named FIND retry and capture the text preceding the
// successful anchor candidate.
GenerateMethodSource(right, sc, func_list, context, true);
} else
{
// TODO pack rest of string to group
// TODO(NGRA): Capture the remaining input for a terminal named dot-star.
}
} else
{
@@ -266,7 +325,11 @@ namespace StgSharp.RegularAnalysis.Text
}
}
}
if (right is not null) {
// TODO(NGRA): Normalize ownership so the right subtree is emitted exactly once. It is
// currently reachable both inside the ordinary CONCAT branch and here.
if (right is not null)
{
GenerateMethodSource(right, sc, func_list, context);
}
}
@@ -278,26 +341,83 @@ namespace StgSharp.RegularAnalysis.Text
in SourceGenContext context
)
{
// TODO(NGRA): Resolve the COUNT body using Empty-sentinel ownership and read the
// RegexCountPayload from the COUNT node rather than assuming a nullable child layout.
RegexAstNode value = node.Left ?? node.Right;
RegexCountPayload payload = node.PayloadAs<RegexCountPayload>();
int min = payload.Min;
int max = payload.Max;
bool is_greedy = payload.IsGreedy;
string exit_label = context.RequestExitLabel();
if ((value.Label & RegexElementLabel.SEQUENCE) == 0)
{
// TODO(NGRA): Emit min/max repetition, zero-width progress protection, greedy vs.
// lazy ordering, and per-attempt rollback for a complex COUNT body.
GenerateMethodSource(value, sc, func_list, context);
} else
{
RegexCountPayload payload = value.PayloadAs<RegexCountPayload>();
int min = payload.Min;
int max = payload.Max;
bool is_greedy = payload.IsGreedy;
switch (value.Label & RegexElementLabel.SEQUENCE)
{
case RegexElementLabel.UNIT:
Span<char> long_seq = stackalloc char[min];
long_seq.Fill(value.Source.Source[0]);
// TODO(NGRA): Move ownership of this work region to the enclosing CONCAT
// or match method once failure propagation is wired. A region local to
// COUNT is only a structural trial because break cannot skip later nodes.
_ = sc.AppendLine("do")
.AppendLine("{")
.AppendLine($"if({context.RemainSpan}.{nameof(MemoryExtensions.StartsWith)}({FormatStringLiteral(long_seq)}))")
.AppendLine(@"{")
/* TODO(NGRA): The flattened literal has already matched Min copies.
* Consume that prefix, then emit only the optional tail: at most
* Max - Min additional copies, or an unbounded tail when Max < 0.
* Greedy and lazy modes must order the continuation differently.
*/
.AppendLine($"int remained_count = {max} - {min};")
.AppendLine($@"{context.RemainSpan} = {context.RemainSpan}.Slice({min});")
.AppendLine($"for(int i = 0; i < remained_count && {context.RemainSpan}[0] == {FormatCharLiteral(value.Source.Source[0])}; i++)")
.AppendLine("{")
.AppendLine($@"{context.RemainSpan} = {context.RemainSpan}.Slice(1);")
.AppendLine("}")
.AppendLine(@"}")
.AppendLine("else")
.AppendLine("{")
/* StartsWith has not mutated the cursor, so this branch needs no
* local restoration. The enclosing work region must own its entry
* cursor/capture snapshot and interpret this break as failure.
*/
.AppendLine("break;")
.AppendLine("}")
.AppendLine("} while (false);");
break;
case RegexElementLabel.UNIT_SET:
// TODO(NGRA): Emit a bounded/unbounded charset counting loop, preferably
// using IndexOfAnyExcept where the charset shape permits it.
break;
case RegexElementLabel.UNIT_SPAN:
// TODO(NGRA): Emit repeated full-span matching with min/max enforcement and
// cursor rollback when the minimum cannot be satisfied.
string pattern = value.Source.Source;
if (pattern.Length > 32)
{
_ = sc.AppendLine("do").AppendLine("{").AppendLine("} while(false);");
} else { }
break;
default:
// TODO(NGRA): Diagnose malformed COUNT children instead of emitting an
// empty branch.
break;
}
}
// TODO(NGRA): Connect COUNT success/failure continuations to the surrounding rollback
// scope; the label is currently only a placeholder.
_ = sc.AppendLine($@"{exit_label}: {{ }}");
}
#endregion
@@ -51,7 +51,7 @@ namespace StgSharp.RegularAnalysis.Text
return sc.AppendLine($@"{ROS_char} {RemainSpan};");
}
public string RequestExitAlt()
public string RequestExitLabel()
{
string code = $@"_exit_alt_{_exit_alt_count}";
_exit_alt_count++;
@@ -52,8 +52,6 @@ namespace StgSharp
public Rectangle ButtonBounding { get; private set; }
public TextureProvider ButtonTextureProvider { get; private set; }
// render a controlling item
public void ButtonMain(
IEnumerable<PlainGeometryMesh> items
@@ -61,7 +59,7 @@ namespace StgSharp
{
// Console.WriteLine("Render Button Itself");
GL.BindFrameBuffer(FrameBufferTarget.All, GlHandle.Zero); /*GL.Assert(true);/**/
GL.BindFrameBuffer(FrameBufferTarget.FrameBuffer, GlHandle.Zero); /*GL.Assert(true);/**/
GL.ClearColor(0.4f, TimePassed % 1.0f, 0f, 1.0f); /*GL.Assert(true);/**/
GL.Clear(MaskBufferBit.COLOR /**/ | MaskBufferBit.DEPTH/**/); /*GL.Assert(true);/**/
@@ -69,7 +67,7 @@ namespace StgSharp
foreach (PlainGeometryMesh mesh in items)
{
GL.ActiveTextureUnit((uint)TextureUnit.Unit1);
GL.ActiveTextureUnit((uint)TextureUnit.Texture1);
GL.BindTexture(glConst.TEXTURE_2D, f_t[0]);
GL.TextureImage2d(Texture2DTarget.Texture2D, 0, glConst.RGBA8,
mesh.TextureImage.Width, mesh.TextureImage.Height,
@@ -98,11 +96,11 @@ namespace StgSharp
// Console.Clear();
buffer.UpdateAllParticles();
// Console.WriteLine(GL.CheckFrameBufferStatus(FrameBufferTarget.All));
// Console.WriteLine(GL.CheckFrameBufferStatus(FrameBufferTarget.FrameBuffer));
GL.BindFrameBuffer(FrameBufferTarget.All, fbo[0]); //GL.Assert(true);
GL.BindFrameBuffer(FrameBufferTarget.FrameBuffer, fbo[0]); //GL.Assert(true);
GL.BindVertexArray(vao[0]); //GL.Assert(true);
GL.ActiveTextureUnit((uint)TextureUnit.Unit0);
GL.ActiveTextureUnit((uint)TextureUnit.Texture0);
GL.BindTexture(glConst.TEXTURE_2D, t[0]); //GL.Assert(false);
GL.Viewport(0, 0, Width, Height);
@@ -114,13 +112,13 @@ namespace StgSharp
/**/
// GL.Assert(false);
// Console.WriteLine(GL.CheckFrameBufferStatus(FrameBufferTarget.All));
// Console.WriteLine(GL.CheckFrameBufferStatus(FrameBufferTarget.FrameBuffer));
GL.ClearColor((0.6f + TimePassed) % 1.0f, 0.1f, 0.3f, 1);
// GL.Assert( false );
// Console.WriteLine(GL.CheckFrameBufferStatus(FrameBufferTarget.All));
// Console.WriteLine(GL.CheckFrameBufferStatus(FrameBufferTarget.FrameBuffer));
GL.Clear(MaskBufferBit.COLOR /**/ | MaskBufferBit.DEPTH/**/);
@@ -149,7 +147,6 @@ namespace StgSharp
if (i.Size != (Width, Height))
{
i = new Image<Rgba8>(Width, Height);
ButtonTextureProvider.Image = i;
}
// GL.ClearError();
@@ -167,7 +164,7 @@ namespace StgSharp
// GL.Assert(true);
// i.Bytes.Fill(24);
GL.BindFrameBuffer(FrameBufferTarget.All, GlHandle.Zero);
GL.BindFrameBuffer(FrameBufferTarget.FrameBuffer, GlHandle.Zero);
// GL.Assert(true);
/**/
@@ -177,21 +174,11 @@ namespace StgSharp
{
GL.ClearError();
// GL.BindFrameBuffer(FrameBufferTarget.All, GlHandle.Zero);
// GL.BindFrameBuffer(FrameBufferTarget.FrameBuffer, GlHandle.Zero);
GL.ClearColor(0.5f, 0.2f, 0.3f, 1.0f);
GL.Assert(false);
}
/*
public void RenderButton(
ButtonStatus status,
float statusBegin,
in TextureProvider provider
)
{
provider.UpdateFromImage(i);
}
/**/
internal static Vec3 DefaultRotation(
TimeSpanProvider provider,
out float rotation
@@ -199,7 +186,7 @@ namespace StgSharp
{
rotation = 1.0f / 60;
float angle = (float)provider.CurrentSecond * 2;
return (new Vec3(MathF.Cos(angle), MathF.Sin(angle),
return (new Vec3<float>(MathF.Cos(angle), MathF.Sin(angle),
0)) * rotation;
}
@@ -214,8 +201,8 @@ namespace StgSharp
GL.DeleteBuffers(f_ebo.Handles);
GL.DeleteVertexArrays(vao.Handles);
GL.DeleteVertexArrays(f_vao.Handles);
GL.DeleteFramebuffers(fbo.Handles);
GL.DeleteRenderbuffers(rbo.Handles);
GL.DeleteFrameBuffers(fbo.Handles);
GL.DeleteRenderBuffers(rbo.Handles);
GL.DeleteTextures(t.Handles);
GL.DeleteTextures(f_t.Handles);
}
@@ -234,7 +221,7 @@ namespace StgSharp
float at = MathF.Abs(t - 5.0f);
ParticleOnPlain p = new ParticleOnPlain(buffer);
((IInstancing)p).Coord = new Vec3(
((IInstancing)p).Coord = new Vec3<float>(
(((-5) + i) * 0.2f) + 0.1f, (((-5) + t) * 0.2f) + 0.1f, 0);
((IInstancing)p).Scale =
float.Min(i, t) * 0.15f;
@@ -249,8 +236,8 @@ namespace StgSharp
s = new ShaderProgram(GL.CreateProgram());
frameMainShader = new ShaderProgram(GL.CreateProgram());
Shader pvs = CreateShaderSet(ShaderType.Vertex, 2);
Shader pfs = CreateShaderSet(ShaderType.Fragment, 2);
Shader pvs = CreateShaderSet(ShaderType.VertexShader, 2);
Shader pfs = CreateShaderSet(ShaderType.FragmentShader, 2);
// GL.Assert(true);
CompileShaderFromFile(pvs[0], Path.Combine("Shader", "particle.vert"));
@@ -288,12 +275,12 @@ namespace StgSharp
GL.BindBuffer(BufferType.ArrayBuffer, vbo[0]);
GL.SetBufferData(BufferType.ArrayBuffer, rec.VertexStream, BufferUsage.StaticDraw);
GL.BindBuffer(BufferType.ElementArrayBuffer, ebo[0]);
GL.SetBufferData(BufferType.ElementArrayBuffer, rec.VertexIndices,
GL.BufferData(BufferType.ElementArrayBuffer, rec.VertexIndices,
BufferUsage.StaticDraw);
GL.SetVertexAttribute(0, 3, TypeCode.Single, false, 4 * sizeof(float), 0);
GL.VertexAttribute(0, 3, TypeCode.Single, false, 4 * sizeof(float), 0);
GL.BindBuffer(BufferType.ArrayBuffer, vbo[1]);
GL.SetBufferData<Vec4>(BufferType.ArrayBuffer, buffer.CoordAndRotationSpan,
GL.SetBufferData<Vec4<float>>(BufferType.ArrayBuffer, buffer.CoordAndRotationSpan,
BufferUsage.StreamDraw);
GL.SetVertexAttribute(1, 3, TypeCode.Single, false, 4 * sizeof(float), 0);
GL.SetVertexAttribute(2, 1, TypeCode.Single, false, 4 * sizeof(float),
@@ -334,12 +321,12 @@ namespace StgSharp
GL.GenFrameBuffers(frameBufferHandles);
fbo = new FrameBuffer(frameBufferHandles);
rbo = new RenderBuffer(GL.GenRenderBuffer(1));
GL.BindFrameBuffer(FrameBufferTarget.All, fbo[0]);
GL.BindFrameBuffer(FrameBufferTarget.FrameBuffer, fbo[0]);
GL.BindRenderBuffer(rbo[0]);
// GL.Assert(true);
t = new TextureGL(GL.GenTextures(1));
GL.ActiveTextureUnit((uint)TextureUnit.Unit0);
GL.ActiveTextureUnit((uint)TextureUnit.Texture0);
GL.BindTexture(glConst.TEXTURE_2D, t[0]);
GL.TextureImage2d(Texture2DTarget.Texture2D, 0, glConst.RGBA8, Width, Height,
FrameBufferChannel.RGBA, PixelChannelLayout.UByte);
@@ -353,15 +340,15 @@ namespace StgSharp
(int)TextureFilter.Linear);
// GL.Assert(true);
GL.FrameBufferTexture2d(FrameBufferTarget.All, glAttachment.Color(0),
GL.FrameBufferTexture2d(FrameBufferTarget.FrameBuffer, glAttachment.Color(0),
Texture2DTarget.Texture2D, t[0], 0);
GL.SetRenderBufferStorage(RenderBufferInternalFormat.Depth24_Stencil8, this.Size);
GL.CombineFrameBufferRenderBuffer(FrameBufferAttachment.DepthAndStencil, rbo[0]);
GL.CombineFrameBufferRenderBuffer(FrameBufferAttachment.DepthStencilAttachment, rbo[0]);
Console.WriteLine(GL.CheckFrameBufferStatus(FrameBufferTarget.All));
Console.WriteLine(GL.CheckFrameBufferStatus(FrameBufferTarget.FrameBuffer));
GL.BindFrameBuffer(FrameBufferTarget.All, GlHandle.Zero);
GL.BindFrameBuffer(FrameBufferTarget.FrameBuffer, GlHandle.Zero);
// GL.Assert(true);
i = new Image<Rgba8>(this.Size);
@@ -377,9 +364,6 @@ namespace StgSharp
};
ButtonBounding = new Rectangle(-0.9f, 0.9f, 0.9f, 0.9f, 0.9f, -0.9f, -0.9f, -0.9f);
// GL.Assert(true);
ButtonTextureProvider = new TextureProvider(i, buttonTextureCoordArray);
f_vao = new VertexArray(GL.GenVertexArrays(1));
f_vbo = new VertexBuffer(GL.GenBuffers(2));
f_ebo = new ElementBuffer(GL.GenBuffers(1));
@@ -406,7 +390,7 @@ namespace StgSharp
// GL.Assert(true);
f_t = new TextureGL(GL.GenTextures(1));
GL.ActiveTextureUnit((uint)TextureUnit.Unit1);
GL.ActiveTextureUnit((uint)TextureUnit.Texture1);
GL.BindTexture(glConst.TEXTURE_2D, f_t[0]);
GL.TextureParameter(glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_S,
(int)TextureWrap.Repeat);
@@ -460,7 +444,7 @@ namespace StgSharp
{
GlHandle[] handles = new GlHandle[count];
for (int index = 0; index < handles.Length; index++) {
handles[index] = GL.CreateShader((uint)type);
handles[index] = GL.CreateShader(type);
}
return new Shader(handles, type);
}
+1 -1
View File
@@ -22,7 +22,7 @@ namespace StgSharp
{
World.GlobalSetting.VSyncActivated = false;
ViewPort vp = new ViewPort(800, 600, "Hello StgSharp!", IntPtr.Zero);
ViewSurface vp = new ViewSurface(800, 600, "Hello StgSharp!", IntPtr.Zero);
// throw new NotImplementedException();
/*
+1 -1
View File
@@ -11,7 +11,7 @@ This directory contains repository-maintenance and source-generation programs. T
`StgSharp.GenerateGL` has its own `README.md` with its pipeline, naming rules, and interactive commands. The common direct-generation command is:
```powershell
dotnet run --project tools/StgSharp.GenerateGL/StgSharp.GenerateGL.csproj -- generate src/StgSharp.Graphics/OpenGL/Generated
dotnet run --project tools/StgSharp.GenerateGL/StgSharp.GenerateGL.csproj -- generate all src/StgSharp.Graphics/OpenGL/Generated
```
Generated files begin with `// <auto-generated>` and should not be edited manually. Change the registry projection, analysis, naming, or generation code here and regenerate the destination instead.
+33 -8
View File
@@ -42,18 +42,20 @@ namespace StgSharp.GenerateGL
return SuccessExitCode;
}
if (arguments.Count > 1)
if (arguments.Count == 0 || arguments.Count > 2 ||
!TryReadTarget(arguments[0], out GlGenerationTarget target))
{
Console.Error.WriteLine("error: generate accepts at most one output directory.");
Console.Error.WriteLine(
"error: generate requires api, enum, or all and accepts one optional output directory.");
Console.Error.WriteLine("Run 'generate --help' for command information.");
return UsageErrorExitCode;
}
string? outputDirectory = arguments.Count == 1 ? arguments[0] : null;
string? outputDirectory = arguments.Count == 2 ? arguments[1] : null;
string? resolvedOutputDirectory = null;
try
{
generatedFiles = OpenGlGenerator.Generate(projection);
generatedFiles = OpenGlGenerator.Generate(projection, target);
if (outputDirectory is not null)
{
resolvedOutputDirectory = WriteGeneratedFiles(
@@ -103,6 +105,21 @@ namespace StgSharp.GenerateGL
return SuccessExitCode;
}
private static bool TryReadTarget(
string value,
out GlGenerationTarget target
)
{
target = value.ToUpperInvariant() switch
{
"API" => GlGenerationTarget.Api,
"ENUM" or "ENUMS" => GlGenerationTarget.Enum,
"ALL" => GlGenerationTarget.All,
_ => GlGenerationTarget.None,
};
return target != GlGenerationTarget.None;
}
private static string WriteGeneratedFiles(
GeneratedFileSet files,
string outputDirectory
@@ -217,7 +234,7 @@ namespace StgSharp.GenerateGL
if (files.Files.Count == 0)
{
Console.Error.WriteLine("No generated files are held in this session.");
Console.Error.WriteLine("Run 'generate' first.");
Console.Error.WriteLine("Run 'generate api', 'generate enum', or 'generate all' first.");
return QueryErrorExitCode;
}
@@ -251,7 +268,8 @@ namespace StgSharp.GenerateGL
$"No generated file named '{arguments[0]}' is held in this session.");
if (files.Files.Count == 0)
{
Console.Error.WriteLine("Run 'generate' first.");
Console.Error.WriteLine(
"Run 'generate api', 'generate enum', or 'generate all' first.");
}
else
{
@@ -271,12 +289,19 @@ namespace StgSharp.GenerateGL
Console.WriteLine("Generate C# bindings from the loaded OpenGL registry.");
Console.WriteLine();
Console.WriteLine("Usage:");
Console.WriteLine(" generate");
Console.WriteLine(" generate <output-directory>");
Console.WriteLine(" generate api [output-directory]");
Console.WriteLine(" generate enum [output-directory]");
Console.WriteLine(" generate all [output-directory]");
Console.WriteLine(" generate --help");
Console.WriteLine();
Console.WriteLine("Targets:");
Console.WriteLine(" api Generate function tables and managed forwarding APIs.");
Console.WriteLine(" enum Generate glConst and strongly typed enum groups.");
Console.WriteLine(" all Generate both API and enum files.");
Console.WriteLine();
Console.WriteLine("Output:");
Console.WriteLine(" Without a directory, output is retained in memory only.");
Console.WriteLine(" API output references enum output; use all for a clean directory.");
Console.WriteLine(" The output directory must already exist and be writable.");
Console.WriteLine(" Existing files are replaced only when marked as generated.");
Console.WriteLine();
@@ -0,0 +1,336 @@
// -----------------------------------------------------------------------------
// file="GlEnumProjector"
// 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;
using System.Text;
using StgSharp.GenerateGL.Naming;
using StgSharp.GenerateGL.Registry;
namespace StgSharp.GenerateGL.Generation
{
/// <summary>
/// Projects registry GLenum and GLbitfield parameter groups into C# enum types.
/// </summary>
internal static class GlEnumProjector
{
private static readonly string[] _coreExtensionSuffixes =
{
"ARB",
"EXT",
"KHR",
"NV",
};
private static readonly ReadOnlyDictionary<string, string> _managedTypeNameOverrides =
new ReadOnlyDictionary<string, string>(
new Dictionary<string, string>(StringComparer.Ordinal)
{
["Buffer"] = "ClearBuffer",
});
public static IReadOnlyList<ManagedEnumDefinition> Project(
GlRegistryProjection projection
)
{
ArgumentNullException.ThrowIfNull(projection);
Dictionary<string, bool> referencedGroups = ReadReferencedGroups(projection.Commands);
Dictionary<string, GlEnumDefinition> selectedEnums = projection.Enums
.Where(value => value.Value is not null)
.GroupBy(value => value.Name, StringComparer.Ordinal)
.ToDictionary(
value => value.Key,
value => value.First(),
StringComparer.Ordinal);
Dictionary<string, List<GlEnumDefinition>> membersByGroup =
new Dictionary<string, List<GlEnumDefinition>>(StringComparer.Ordinal);
foreach (GlEnumDefinition value in selectedEnums.Values)
{
foreach (string group in SplitGroups(value.Group))
{
if (!referencedGroups.ContainsKey(group))
{
continue;
}
if (!membersByGroup.TryGetValue(group, out List<GlEnumDefinition>? members))
{
members = new List<GlEnumDefinition>();
membersByGroup.Add(group, members);
}
members.Add(value);
}
}
Dictionary<string, EnumBuilder> enumsByManagedName =
new Dictionary<string, EnumBuilder>(StringComparer.Ordinal);
foreach ((string nativeGroup, bool isFlags) in referencedGroups.OrderBy(
value => value.Key,
StringComparer.Ordinal))
{
if (!membersByGroup.TryGetValue(nativeGroup, out List<GlEnumDefinition>? members) ||
members.Count == 0)
{
continue;
}
string managedName = ReadManagedTypeName(nativeGroup);
if (!enumsByManagedName.TryGetValue(managedName, out EnumBuilder? builder))
{
builder = new EnumBuilder(managedName);
enumsByManagedName.Add(managedName, builder);
}
builder.AddGroup(nativeGroup, isFlags, members);
}
return Array.AsReadOnly(
enumsByManagedName.Values
.OrderBy(value => value.Name, StringComparer.Ordinal)
.Select(value => value.Build())
.ToArray());
}
private static Dictionary<string, bool> ReadReferencedGroups(
IReadOnlyList<GlCommandDefinition> commands
)
{
Dictionary<string, bool> result = new Dictionary<string, bool>(
StringComparer.Ordinal);
foreach (GlCommandDefinition command in commands)
{
AddReferencedGroups(
result,
command.Return.Group,
command.Return.TypeName);
foreach (GlParameterDefinition parameter in command.Parameters)
{
AddReferencedGroups(result, parameter.Group, parameter.TypeName);
}
}
return result;
}
private static void AddReferencedGroups(
Dictionary<string, bool> result,
string? groupNames,
string? nativeType
)
{
if (groupNames is null || nativeType is not ("GLenum" or "GLbitfield"))
{
return;
}
bool isFlags = string.Equals(nativeType, "GLbitfield", StringComparison.Ordinal);
foreach (string group in SplitGroups(groupNames))
{
result[group] = result.TryGetValue(group, out bool previous)
? previous || isFlags
: isFlags;
}
}
private static IEnumerable<string> SplitGroups(
string? value
)
{
if (string.IsNullOrWhiteSpace(value))
{
yield break;
}
foreach (string item in value.Split(','))
{
string group = item.Trim();
if (group.Length != 0)
{
yield return group;
}
}
}
private static string ReadManagedTypeName(
string nativeGroup
)
{
if (_managedTypeNameOverrides.TryGetValue(nativeGroup, out string? overrideName))
{
return overrideName;
}
string value = nativeGroup;
foreach (string suffix in _coreExtensionSuffixes)
{
if (value.Length > suffix.Length && value.EndsWith(
suffix,
StringComparison.Ordinal))
{
value = value[..^suffix.Length];
break;
}
}
return CSharpIdentifierPolicy.NormalizeMemberName(SanitizeIdentifier(value));
}
private static string ReadManagedMemberName(
string nativeName
)
{
string value = nativeName.StartsWith("GL_", StringComparison.Ordinal)
? nativeName[3..]
: nativeName;
StringBuilder builder = new StringBuilder(value.Length);
foreach (string component in value.Split('_', StringSplitOptions.RemoveEmptyEntries))
{
if (component.Length == 0)
{
continue;
}
if (char.IsLetter(component[0]))
{
builder.Append(char.ToUpperInvariant(component[0]));
if (component.Length > 1)
{
foreach (char character in component.AsSpan(1))
{
builder.Append(ToAsciiLowerInvariant(character));
}
}
}
else
{
builder.Append(component);
}
}
string result = builder.Length == 0 ? "Value" : builder.ToString();
return CSharpIdentifierPolicy.NormalizeMemberName(SanitizeIdentifier(result));
}
private static char ToAsciiLowerInvariant(
char value
)
{
return value is >= 'A' and <= 'Z' ? (char)(value + ('a' - 'A')) : value;
}
private static string SanitizeIdentifier(
string value
)
{
StringBuilder builder = new StringBuilder(value.Length + 1);
if (value.Length == 0 || !char.IsLetter(value[0]) && value[0] != '_')
{
builder.Append('_');
}
foreach (char character in value)
{
builder.Append(char.IsLetterOrDigit(character) || character == '_'
? character
: '_');
}
return builder.ToString();
}
private sealed class EnumBuilder
{
private readonly Dictionary<string, ManagedEnumMemberDefinition> _members =
new Dictionary<string, ManagedEnumMemberDefinition>(StringComparer.Ordinal);
private readonly HashSet<string> _nativeGroups = new HashSet<string>(
StringComparer.Ordinal);
public EnumBuilder(
string name
)
{
Name = name;
}
public bool IsFlags { get; private set; }
public string Name { get; }
public void AddGroup(
string nativeGroup,
bool isFlags,
IEnumerable<GlEnumDefinition> members
)
{
_nativeGroups.Add(nativeGroup);
IsFlags |= isFlags;
foreach (GlEnumDefinition value in members)
{
string name = ReadManagedMemberName(value.Name);
if (string.Equals(name, Name, StringComparison.Ordinal))
{
name = $"{name}Value";
}
if (_members.TryGetValue(name, out ManagedEnumMemberDefinition? previous))
{
if (!string.Equals(
previous.NativeValue.Value,
value.Value,
StringComparison.Ordinal))
{
throw new InvalidDataException(
$"Enum member '{Name}.{name}' maps to conflicting native values " +
$"'{previous.NativeValue.Name}' and '{value.Name}'.");
}
continue;
}
_members.Add(name, new ManagedEnumMemberDefinition(name, value));
}
}
public ManagedEnumDefinition Build()
{
List<ManagedEnumMemberDefinition> members = _members.Values
.OrderBy(value => value.Name, StringComparer.Ordinal)
.ToList();
if (IsFlags && members.All(value => value.NativeValue.Value != "0" &&
value.NativeValue.Value != "0x0" &&
value.NativeValue.Value != "0x00000000"))
{
members.Insert(
0,
new ManagedEnumMemberDefinition(
"None",
new GlEnumDefinition(
"GL_NONE",
"0",
null,
null,
string.Join(",", _nativeGroups),
null,
"Synthetic zero value for a generated flags enum.",
members[0].NativeValue.Element)));
}
return new ManagedEnumDefinition(
Name,
IsFlags,
Array.AsReadOnly(
_nativeGroups.OrderBy(value => value, StringComparer.Ordinal).ToArray()),
Array.AsReadOnly(members.ToArray()));
}
}
}
}
@@ -0,0 +1,122 @@
// -----------------------------------------------------------------------------
// file="GlEnumTypeMap"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using StgSharp.GenerateGL.Registry;
namespace StgSharp.GenerateGL.Generation
{
/// <summary>
/// Resolves unambiguous scalar GLenum and GLbitfield groups to generated C# types.
/// </summary>
internal sealed class GlEnumTypeMap
{
private readonly Dictionary<string, string> _typesByNativeGroup;
public GlEnumTypeMap(
IEnumerable<ManagedEnumDefinition> definitions
)
{
ArgumentNullException.ThrowIfNull(definitions);
_typesByNativeGroup = new Dictionary<string, string>(StringComparer.Ordinal);
foreach (ManagedEnumDefinition definition in definitions)
{
foreach (string nativeGroup in definition.NativeGroups)
{
if (_typesByNativeGroup.TryGetValue(nativeGroup, out string? previous) &&
!string.Equals(previous, definition.Name, StringComparison.Ordinal))
{
throw new InvalidOperationException(
$"Native enum group '{nativeGroup}' maps to both " +
$"'{previous}' and '{definition.Name}'.");
}
_typesByNativeGroup[nativeGroup] = definition.Name;
}
}
}
public bool TryReadParameterType(
GlParameterDefinition parameter,
out string managedType
)
{
ArgumentNullException.ThrowIfNull(parameter);
if (!IsEnumDeclaration(parameter.TypeName, parameter.Group))
{
managedType = string.Empty;
return false;
}
return TryReadGroupType(parameter.Group!, out managedType);
}
public bool TryReadReturnType(
GlReturnDefinition value,
out string managedType
)
{
ArgumentNullException.ThrowIfNull(value);
if (!IsEnumDeclaration(value.TypeName, value.Group))
{
managedType = string.Empty;
return false;
}
return TryReadGroupType(value.Group!, out managedType);
}
private static bool IsEnumDeclaration(
string? nativeType,
string? group
)
{
return group is not null &&
nativeType is "GLenum" or "GLbitfield";
}
private bool TryReadGroupType(
string groups,
out string managedType
)
{
string[] nativeGroups = groups.Split(',')
.Select(value => value.Trim())
.Where(value => value.Length != 0)
.ToArray();
if (nativeGroups.Length == 0)
{
managedType = string.Empty;
return false;
}
HashSet<string> candidates = new HashSet<string>(StringComparer.Ordinal);
foreach (string nativeGroup in nativeGroups)
{
if (!_typesByNativeGroup.TryGetValue(nativeGroup, out string? candidate))
{
managedType = string.Empty;
return false;
}
candidates.Add(candidate);
}
if (candidates.Count == 1)
{
managedType = candidates.First();
return true;
}
managedType = string.Empty;
return false;
}
}
}
@@ -0,0 +1,20 @@
// -----------------------------------------------------------------------------
// file="GlGenerationTarget"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System;
namespace StgSharp.GenerateGL.Generation
{
[Flags]
internal enum GlGenerationTarget
{
None = 0,
Api = 1,
Enum = 2,
All = Api | Enum,
}
}
@@ -0,0 +1,44 @@
// -----------------------------------------------------------------------------
// file="GlManagedApiSuppressionFilter"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using StgSharp.GenerateGL.Registry;
namespace StgSharp.GenerateGL.Generation
{
/// <summary>
/// Omits raw managed forwards for commands that have safer handwritten public APIs.
/// </summary>
internal sealed class GlManagedApiSuppressionFilter : IGlApiFilter
{
private static readonly HashSet<string> _suppressedCommands = new HashSet<string>(
new[]
{
"glCreateShader",
"glShaderSource",
},
StringComparer.Ordinal);
public IReadOnlyList<ManagedMethodDefinition> Apply(
GlCommandDefinition command,
IReadOnlyList<ManagedMethodDefinition> methods,
GlEquivalentTypeMapper typeMapper
)
{
ArgumentNullException.ThrowIfNull(command);
ArgumentNullException.ThrowIfNull(methods);
ArgumentNullException.ThrowIfNull(typeMapper);
return _suppressedCommands.Contains(command.Name)
? Array.Empty<ManagedMethodDefinition>()
: methods;
}
}
}
@@ -17,6 +17,7 @@ namespace StgSharp.GenerateGL.Generation
GlCommandDefinition NativeCommand,
ManagedInvocation Invocation,
bool WrapHandleReturn = false,
bool IsEnumReturn = false,
string? DocumentationPage = null
);
@@ -25,7 +26,8 @@ namespace StgSharp.GenerateGL.Generation
string Name,
GlParameterDefinition? NativeParameter = null,
bool IsHandle = false,
bool IsHandleSpan = false
bool IsHandleSpan = false,
bool IsEnum = false
);
internal abstract record ManagedInvocation;
@@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using StgSharp.GenerateGL.Analysis;
using StgSharp.GenerateGL.Naming;
@@ -20,21 +21,26 @@ namespace StgSharp.GenerateGL.Generation
private readonly IReadOnlyList<IGlApiFilter> _filters = Array.AsReadOnly<IGlApiFilter>(
new IGlApiFilter[]
{
new GlManagedApiSuppressionFilter(),
new GlOverloadApiFilter(),
new GlGetValueApiFilter(),
new GlHandleApiFilter(),
});
private readonly GlEquivalentTypeMapper _typeMapper;
private readonly GlEnumTypeMap _enumTypeMap;
private readonly GlManagedApiNamePolicy _namePolicy;
public ManagedApiPlanner(
GlEquivalentTypeMapper typeMapper,
GlFunctionFamilyAnalysis familyAnalysis
GlFunctionFamilyAnalysis familyAnalysis,
GlEnumTypeMap enumTypeMap
)
{
ArgumentNullException.ThrowIfNull(typeMapper);
ArgumentNullException.ThrowIfNull(familyAnalysis);
ArgumentNullException.ThrowIfNull(enumTypeMap);
_typeMapper = typeMapper;
_enumTypeMap = enumTypeMap;
_namePolicy = new GlManagedApiNamePolicy(familyAnalysis);
}
@@ -57,6 +63,8 @@ namespace StgSharp.GenerateGL.Generation
methods = filter.Apply(command, methods, _typeMapper);
}
methods = ApplyEnumTypes(command, methods);
result.AddRange(
methods.Select(
method => method with
@@ -77,6 +85,77 @@ namespace StgSharp.GenerateGL.Generation
return Array.AsReadOnly(result.ToArray());
}
private ReadOnlyCollection<ManagedMethodDefinition> ApplyEnumTypes(
GlCommandDefinition command,
IReadOnlyList<ManagedMethodDefinition> methods
)
{
bool hasEnumReturn = _enumTypeMap.TryReadReturnType(
command.Return,
out string enumReturnType);
return Array.AsReadOnly(
methods.Select(
method => ConvertEnumReturn(method, hasEnumReturn, enumReturnType)).ToArray());
}
private ManagedMethodDefinition ConvertEnumReturn(
ManagedMethodDefinition method,
bool hasEnumReturn,
string enumReturnType
)
{
string returnType = string.Empty;
bool isEnumReturn = hasEnumReturn && TryReplaceNativeEnumType(
method.ReturnType,
enumReturnType,
out returnType);
return method with
{
ReturnType = isEnumReturn ? returnType : method.ReturnType,
IsEnumReturn = isEnumReturn,
Parameters = Array.AsReadOnly(
method.Parameters.Select(ConvertEnumParameter).ToArray()),
};
}
private ManagedParameterDefinition ConvertEnumParameter(
ManagedParameterDefinition parameter
)
{
if (parameter.NativeParameter is null ||
!_enumTypeMap.TryReadParameterType(
parameter.NativeParameter,
out string enumType) ||
!TryReplaceNativeEnumType(parameter.Type, enumType, out string convertedType))
{
return parameter;
}
return parameter with
{
Type = convertedType,
IsEnum = true,
};
}
private static bool TryReplaceNativeEnumType(
string nativeType,
string enumType,
out string convertedType
)
{
const string nativeBaseType = "uint";
if (!nativeType.StartsWith(nativeBaseType, StringComparison.Ordinal) ||
nativeType.AsSpan(nativeBaseType.Length).ContainsAnyExcept('*'))
{
convertedType = string.Empty;
return false;
}
convertedType = enumType + nativeType[nativeBaseType.Length..];
return true;
}
public static void Validate(
IEnumerable<ManagedMethodDefinition> methods
)
@@ -0,0 +1,24 @@
// -----------------------------------------------------------------------------
// file="ManagedEnumModel"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using System.Collections.Generic;
using StgSharp.GenerateGL.Registry;
namespace StgSharp.GenerateGL.Generation
{
internal sealed record ManagedEnumDefinition(
string Name,
bool IsFlags,
IReadOnlyList<string> NativeGroups,
IReadOnlyList<ManagedEnumMemberDefinition> Members
);
internal sealed record ManagedEnumMemberDefinition(
string Name,
GlEnumDefinition NativeValue
);
}
@@ -42,59 +42,76 @@ namespace StgSharp.GenerateGL.Generation
StringComparer.Ordinal);
public static GeneratedFileSet Generate(
GlRegistryProjection projection
GlRegistryProjection projection,
GlGenerationTarget target = GlGenerationTarget.All
)
{
ArgumentNullException.ThrowIfNull(projection);
if (target == GlGenerationTarget.None || (target & ~GlGenerationTarget.All) != 0)
{
throw new ArgumentOutOfRangeException(nameof(target));
}
IReadOnlyList<GlCommandGroup> commandGroups = ReadCoreCommandGroups(projection);
IReadOnlyList<GlCommandDefinition> commands = Array.AsReadOnly(
commandGroups.SelectMany(value => value.Commands).ToArray());
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,
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>
IReadOnlyList<ManagedEnumDefinition> enums = GlEnumProjector.Project(projection);
GlEnumTypeMap enumTypeMap = new GlEnumTypeMap(enums);
List<GeneratedFile> files = new List<GeneratedFile>();
if ((target & GlGenerationTarget.Enum) != 0)
{
new GeneratedFile("glconst.cs", GenerateConstants(projection.Enums)),
new GeneratedFile(
files.Add(new GeneratedFile("glconst.cs", GenerateConstants(projection.Enums)));
files.Add(new GeneratedFile("GlEnums.g.cs", GenerateEnums(enums)));
}
if ((target & GlGenerationTarget.Api) != 0)
{
IReadOnlyList<GlCommandGroup> commandGroups = ReadCoreCommandGroups(projection);
IReadOnlyList<GlCommandDefinition> commands = Array.AsReadOnly(
commandGroups.SelectMany(value => value.Commands).ToArray());
GlEquivalentTypeMapper typeMapper = new GlEquivalentTypeMapper(projection.Source);
GlFunctionFamilyAnalysis familyAnalysis = GlFunctionFamilyAnalyzer.Analyze(projection);
ManagedApiPlanner apiPlanner = new ManagedApiPlanner(
typeMapper,
familyAnalysis,
enumTypeMap);
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,
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));
files.Add(new GeneratedFile(
"OpenglContext.g.cs",
GenerateContext(commands, typeMapper)),
new GeneratedFile(
GenerateContext(commands, typeMapper)));
files.Add(new GeneratedFile(
"glContextShadow.g.cs",
GenerateContextShadow(commands)),
};
for (int index = 0; index < managedGroups.Count; index++)
{
ManagedCommandGroup managedGroup = managedGroups[index];
GlCommandGroup group = managedGroup.Source;
files.Add(
new GeneratedFile(
group.FileName,
GenerateFunctions(
managedGroup.Methods,
group.Description,
index == 0)));
GenerateContextShadow(commands)));
for (int index = 0; index < managedGroups.Count; index++)
{
ManagedCommandGroup managedGroup = managedGroups[index];
GlCommandGroup group = managedGroup.Source;
files.Add(
new GeneratedFile(
group.FileName,
GenerateFunctions(
managedGroup.Methods,
group.FileName,
group.Description,
index == 0)));
}
}
return new GeneratedFileSet(files);
@@ -184,7 +201,7 @@ namespace StgSharp.GenerateGL.Generation
)
{
StringBuilder builder = new StringBuilder(512 * 1024);
AppendGeneratedHeader(builder, "Desktop OpenGL constants");
AppendGeneratedHeader(builder, "glconst.cs", "Desktop OpenGL constants");
builder.Append("namespace StgSharp.Graphics.OpenGL\n");
builder.Append("{\n");
builder.Append(" public static class glConst\n");
@@ -227,6 +244,60 @@ namespace StgSharp.GenerateGL.Generation
return builder.ToString();
}
private static string GenerateEnums(
IReadOnlyList<ManagedEnumDefinition> enums
)
{
StringBuilder builder = new StringBuilder(512 * 1024);
AppendGeneratedHeader(
builder,
"GlEnums.g.cs",
"Strongly typed desktop OpenGL enum groups");
builder.Append("namespace StgSharp.Graphics.OpenGL\n");
builder.Append("{\n");
foreach (ManagedEnumDefinition value in enums)
{
builder.Append(" /// <summary>Native OpenGL group");
builder.Append(value.NativeGroups.Count == 1 ? " " : "s ");
builder.Append(string.Join(", ", value.NativeGroups));
builder.Append(".</summary>\n");
if (value.IsFlags)
{
builder.Append(" [System.Flags]\n");
}
builder.Append(" public enum ");
builder.Append(value.Name);
builder.Append(" : uint\n");
builder.Append(" {\n");
foreach (ManagedEnumMemberDefinition member in value.Members)
{
builder.Append(" ");
builder.Append(member.Name);
builder.Append(" = ");
if (member.NativeValue.Name == "GL_NONE" &&
member.NativeValue.Comment ==
"Synthetic zero value for a generated flags enum.")
{
builder.Append("0u");
}
else
{
builder.Append("unchecked((uint)glConst.");
builder.Append(ReadConstantName(member.NativeValue.Name));
builder.Append(')');
}
builder.Append(",\n");
}
builder.Append(" }\n\n");
}
builder.Append("}\n");
return builder.ToString();
}
private static ConstantExpression ReadConstantExpression(
GlEnumDefinition value
)
@@ -329,7 +400,10 @@ namespace StgSharp.GenerateGL.Generation
)
{
StringBuilder builder = new StringBuilder(128 * 1024);
AppendGeneratedHeader(builder, "Desktop OpenGL core function pointer table");
AppendGeneratedHeader(
builder,
"OpenglContext.g.cs",
"Desktop OpenGL core function pointer table");
builder.Append("namespace StgSharp.Graphics.OpenGL\n");
builder.Append("{\n");
builder.Append(" [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]\n");
@@ -360,7 +434,10 @@ namespace StgSharp.GenerateGL.Generation
)
{
StringBuilder builder = new StringBuilder(64 * 1024);
AppendGeneratedHeader(builder, "Native-address shadow of the OpenGL function pointer table");
AppendGeneratedHeader(
builder,
"glContextShadow.g.cs",
"Native-address shadow of the OpenGL function pointer table");
builder.Append("namespace StgSharp.Graphics.OpenGL\n");
builder.Append("{\n");
builder.Append(" [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]\n");
@@ -389,13 +466,14 @@ namespace StgSharp.GenerateGL.Generation
private static string GenerateFunctions(
IReadOnlyList<ManagedMethodDefinition> methods,
string outputFileName,
string description,
bool includeContextState
)
{
StringBuilder builder = new StringBuilder(512 * 1024);
AppendGeneratedHeader(builder, description);
builder.Append("using StgSharp.Mathematics.Graphics;\n\n");
AppendGeneratedHeader(builder, outputFileName, description);
builder.Append("using StgSharp.Mathematics.Numeric.Graphics;\n\n");
builder.Append("using System;\n");
builder.Append("using System.Runtime.CompilerServices;\n\n");
builder.Append("namespace StgSharp.Graphics.OpenGL\n");
@@ -572,6 +650,12 @@ namespace StgSharp.GenerateGL.Generation
{
builder.Append("return GlHandle.Create(");
}
else if (method.IsEnumReturn)
{
builder.Append("return (");
builder.Append(method.ReturnType);
builder.Append(')');
}
else if (method.ReturnType != "void")
{
builder.Append("return ");
@@ -719,7 +803,14 @@ namespace StgSharp.GenerateGL.Generation
ManagedParameterDefinition parameter = method.Parameters[
parameterArgument.ParameterIndex];
string parameterName = EscapeIdentifier(parameter.Name);
if (!parameter.IsHandle)
if (parameter.IsEnum)
{
builder.Append("(uint");
builder.Append('*', parameter.Type.Count(value => value == '*'));
builder.Append(')');
builder.Append(parameterName);
}
else if (!parameter.IsHandle)
{
builder.Append(parameterName);
}
@@ -769,9 +860,18 @@ namespace StgSharp.GenerateGL.Generation
private static void AppendGeneratedHeader(
StringBuilder builder,
string outputFileName,
string description
)
{
builder.Append("// -----------------------------------------------------------------------------\n");
builder.Append("// file=\"");
builder.Append(ReadGeneratedFileName(outputFileName));
builder.Append("\"\n");
builder.Append("// Project: StgSharp\n");
builder.Append("// Copyright (c) Nitload.\n");
builder.Append("// SPDX-License-Identifier: MIT\n");
builder.Append("// -----------------------------------------------------------------------------\n\n");
builder.Append("// <auto-generated>\n");
builder.Append("// Generated by StgSharp.GenerateGL.\n");
builder.Append("// ");
@@ -780,6 +880,22 @@ namespace StgSharp.GenerateGL.Generation
builder.Append("// </auto-generated>\n\n");
}
private static string ReadGeneratedFileName(
string outputFileName
)
{
const string generatedExtension = ".g.cs";
const string sourceExtension = ".cs";
if (outputFileName.EndsWith(generatedExtension, StringComparison.Ordinal))
{
return outputFileName[..^generatedExtension.Length];
}
return outputFileName.EndsWith(sourceExtension, StringComparison.Ordinal)
? outputFileName[..^sourceExtension.Length]
: outputFileName;
}
private sealed record ConstantExpression(
string Type,
string Literal
+22 -2
View File
@@ -21,7 +21,7 @@ show command glBindBuffer
target summary
families list Vertex
families show VertexAttributeP
generate
generate all
list files
preview OpenGLFunction.v4_1.g.cs
```
@@ -29,9 +29,21 @@ 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
dotnet run --project tools/StgSharp.GenerateGL/StgSharp.GenerateGL.csproj -- generate all src/StgSharp.Graphics/OpenGL/Generated
```
Generation targets are explicit:
```text
generate api [output-directory] # function tables and managed forwarding APIs
generate enum [output-directory] # glConst and strongly typed enum groups
generate all [output-directory] # both sets
```
The API files reference the generated enum types. Use `generate all` for a clean output
directory; use `generate api` when refreshing an output tree that already contains the enum
files.
Without a directory, `generate` retains its output in the current CLI session. With a directory:
- the directory must already exist and be writable;
@@ -47,6 +59,7 @@ Use a directory dedicated to generated source files.
gl.xml
-> lossless XML and registry models
-> desktop OpenGL 4.6 Core projection
-> GLenum/GLbitfield semantic group projection
-> function-family and scalar/vector relation analysis
-> managed API filters
-> C# naming and signature validation
@@ -59,6 +72,7 @@ The target projection removes GLES and ARB/NV/EXT extension entry points. It ret
Generated files:
- `glconst.cs`: core constants;
- `GlEnums.g.cs`: strongly typed enum groups referenced by Core Profile parameters and return values;
- `OpenglContext.g.cs`: the function-pointer table with native names and ABI types;
- `glContextShadow.g.cs`: an identically ordered `nint` table used while loading native entry points;
- `OpenGLFunction.Base.g.cs`: APIs introduced through OpenGL 3.2 and retained in the target profile;
@@ -134,6 +148,10 @@ Renaming never changes the native target. For example, `VertexAttributeInteger(.
## Type rules
- `gl.xml` typedefs map to equivalent C# ABI types; the generator does not emit separate type aliases;
- `GLenum` and `GLbitfield` declarations with one unambiguous registry group use the generated enum type in public APIs;
- enum pointers preserve their pointer shape (for example, `GLenum*` becomes `DebugSource*`) and are cast back to the native `uint*` representation at the forwarding boundary;
- enum return values are converted from the native `uint` representation before being returned;
- declarations with missing or conflicting enum group metadata remain on their ABI type;
- 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(...)`;
@@ -141,6 +159,8 @@ Renaming never changes the native target. For example, `VertexAttributeInteger(.
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.
Raw managed forwards are omitted when a safer handwritten public API owns the command. In particular, `glShaderSource` remains in `OpenglContext` for ABI loading, while `OpenGLFunction` exposes the handwritten `ReadOnlySpan<byte>` and `string` overloads instead of a generated `byte**` signature.
## Documentation comments
Every generated public method contains:
+3 -3
View File
@@ -1437,7 +1437,7 @@ namespace StgSharp.GenerateGL
Console.WriteLine(" StgSharp.GenerateGL [--xml <path>] show <category> <name> " +
"[--showcount <n>]");
Console.WriteLine(
" StgSharp.GenerateGL [--xml <path>] generate [output-directory]");
" StgSharp.GenerateGL [--xml <path>] generate <api|enum|all> [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");
@@ -1456,9 +1456,9 @@ namespace StgSharp.GenerateGL
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 all");
Console.WriteLine(
" StgSharp.GenerateGL generate src/StgSharp.Graphics/OpenGL/Generated");
" StgSharp.GenerateGL generate all 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");