generate glenum, link glenum, add source gen for text regex
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user