Readme for new namespace; New file for special expression format in text regex.

Signed-off-by: Nitload <Nitload_Creater@outlook.com>
This commit is contained in:
2026-09-09 23:39:51 +08:00
33 changed files with 1225 additions and 937 deletions
@@ -232,13 +232,13 @@ namespace StgSharp.GenerateGL.Generation
List<ManagedParameterDefinition> singleParameters = new List<ManagedParameterDefinition>(prefix)
{
new ManagedParameterDefinition("bool", "transpose", transposeSource),
new ManagedParameterDefinition("GraphicsMatrix", "value", valueSource),
new ManagedParameterDefinition("GMatrix44<float>", "value", valueSource),
};
List<ManagedParameterDefinition> spanParameters = new List<ManagedParameterDefinition>(prefix)
{
new ManagedParameterDefinition("bool", "transpose", transposeSource),
new ManagedParameterDefinition(
"ReadOnlySpan<GraphicsMatrix>",
"ReadOnlySpan<GMatrix44<float>>",
"values",
valueSource),
};
@@ -740,7 +740,7 @@ namespace StgSharp.GenerateGL.Generation
string matrixName = EscapeIdentifier(matrix.Name);
if (invocation.IsSpan)
{
builder.Append(" fixed (GraphicsMatrix* __value = ");
builder.Append(" fixed (GMatrix44<float>* __value = ");
builder.Append(matrixName);
builder.Append(")\n");
builder.Append(" {\n");
+7 -3
View File
@@ -1,9 +1,13 @@
# StgSharp.GenerateGL
# Nitload.GenerateGL
`StgSharp.GenerateGL` generates the StgSharp desktop OpenGL C# bindings from the Khronos `gl.xml` registry.
`Nitload.GenerateGL` generates the Nitload desktop OpenGL C# bindings from the Khronos `gl.xml` registry.
The current target is OpenGL 4.6 Core. The generator does not emit OpenGL ES or mix extension entry points into the core API. `gl.xml` is the authoritative generation input; the retained `gl.h` is reference material only.
## Namespace migration
The project and directory are named `Nitload.GenerateGL`, but the implementation namespace and generated-source templates still contain `StgSharp.*`. Update the templates in `Generation/OpenGlGenerator.cs` to emit `Nitload.Graphics.OpenGL` and import `Nitload.Mathematics.Numeric.Graphics` before regenerating the renamed graphics library. The CLI commands below use the current project paths; they do not automatically migrate generated namespaces.
## Usage
Start the interactive CLI:
@@ -92,7 +96,7 @@ The generator merges a family only when it can validate the resulting signatures
| `glUniform1*v` | `Uniform(..., ReadOnlySpan<T>)` |
| `glUniform4*v` | `Uniform(..., ReadOnlySpan<Vec4<T>>)` |
| `glUniform2*v` and `glUniform3*v` | Omitted because `Vec2` and `Vec3` storage is not a tightly packed C array |
| `glUniformMatrix4fv` | `Uniform(..., GraphicsMatrix)` and matrix-span overloads |
| `glUniformMatrix4fv` | `Uniform(..., GMatrix44<float>)` and matrix-span overloads |
| Other matrix sizes and double matrices | Omitted because only the graphics-oriented 4x4 float layout is defined |
| `glGetBooleanv`, `glGetFloatv`, `glGetIntegerv`, and related queries | `GetValue(..., Span<T>)` |
| `glVertexAttrib1f/2f/3f/4f` and equivalent scalar forms | `VertexAttribute(...)`; component count is expressed by the parameter list |
+1 -1
View File
@@ -1,6 +1,6 @@
# Khronos OpenGL Registry input
This directory intentionally does not track the third-party Khronos registry files. Before building or running `StgSharp.GenerateGL`, supply a registry snapshot from the canonical [KhronosGroup/OpenGL-Registry](https://github.com/KhronosGroup/OpenGL-Registry) repository.
This directory intentionally does not track the third-party Khronos registry files. Before building or running `Nitload.GenerateGL`, supply a registry snapshot from the canonical [KhronosGroup/OpenGL-Registry](https://github.com/KhronosGroup/OpenGL-Registry) repository.
1. Clone or download one coherent revision of `KhronosGroup/OpenGL-Registry`.
2. Copy the contents of its `xml/` directory directly into this directory.
+3 -3
View File
@@ -1,14 +1,14 @@
# Development Tools
This directory contains repository-maintenance and source-generation programs. Tools are kept outside `src` because they help build or maintain StgSharp but are not shipped as part of the runtime libraries.
This directory contains repository-maintenance and source-generation programs. Tools are kept outside `src` because they help build or maintain Nitload but are not shipped as part of the runtime libraries.
## Directory map
| Directory | Purpose |
| --- | --- |
| `StgSharp.GenerateGL` | Reads the Khronos `gl.xml` registry, projects the OpenGL 4.6 Core API, analyzes function families, and generates the managed OpenGL bindings used by `StgSharp.Graphics`. |
| `Nitload.GenerateGL` | Reads the Khronos `gl.xml` registry, projects the OpenGL 4.6 Core API, analyzes function families, and generates the managed OpenGL bindings used by `Nitload.Graphics`. |
`StgSharp.GenerateGL` has its own `README.md` with its pipeline, naming rules, and interactive commands. The common direct-generation command is:
`Nitload.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/Nitload.GenerateGL/Nitload.GenerateGL.csproj -- generate all src/Nitload.Graphics/OpenGL/Generated