Table of Contents

Namespace ShadowDusk.GLSL

Classes

MonoGameGlslAttribute

One vertex-input attribute discovered while rewriting a VERTEX shader's SPIRV-Cross GLSL. The attribute is renamed to the MojoShader form vs_v{Slot} (declaration order), and Usage/Index carry the VertexElementUsage+semantic-index the pipeline writes into the .mgfx attribute table so MonoGame's GL runtime binds the attribute to the right vertex element. Empty for pixel shaders.

MonoGameGlslResult

Result of Rewrite(string, ShaderStage).

MonoGameGlslRewriteException

Thrown by Rewrite(string, ShaderStage) when the SPIRV-Cross GLSL contains a construct the MojoShader-dialect rewrite cannot lower to a form that is valid across every MonoGame/KNI GL profile (desktop GL, KNI Reach/WebGL1, and KNI HiDef/WebGL2). Failing loudly here — rather than emitting GLSL that silently breaks under one profile — upholds the Phase 33 generality bar: any shader that compiles for GL must work in HiDef, or the compile must fail at build time.

MonoGameGlslRewriter

Rewrites the modern GLSL that SPIRV-Cross emits (#version 140, in/out, in_var_TEXCOORD0, texture(), a named UBO) into the legacy MojoShader dialect that MonoGame's OpenGL runtime expects (legacy varying names, gl_FragColor, texture2D(), ps_uniforms_vec4[]). This is a pure string transform with no external dependencies.

MonoGameGlslSampler

A single sampler discovered while rewriting SPIRV-Cross GLSL into the MonoGame/MojoShader dialect. Name is always ps_s{Slot}. Dimension is the sampler's dimensionality (2D / cube / 3D), which the pipeline encodes into the .mgfx sampler-type byte.

MonoGameGlslUniform

One uniform-block member modelled into the shader's single {vs,ps}_uniforms_vec4[] register space (Phase 43 F4/F5/F6). The pipeline builds the per-shader .mgfx constant-buffer record DIRECTLY from this layout, so the record's offsets are guaranteed to agree with the indices the emitted GLSL reads — they come from the same allocation.

SpirvCrossGlslTranspiler

The default desktop ISpirvToGlslTranspiler: transpiles SPIR-V to GLSL using the native SPIRV-Cross library (via P/Invoke). This is the faithful pipeline's SPIR-V → GLSL leg; the result is then rewritten into MonoGame's GLSL dialect by MonoGameGlslRewriter.

Interfaces

ISpirvToGlslTranspiler

Transpiles SPIR-V bytes to GLSL source. This is the injection seam that alternative (e.g. WASM/browser) backends plug into in place of the native SPIRV-Cross implementation, without changing the compilation pipeline.

Enums

MonoGameSamplerDimension

The dimensionality of a sampler the rewriter modelled, mapped 1:1 onto MonoGame's SamplerType enum byte (the value the .mgfx sampler record carries). Verified against MonoGame's Shader.cs reader and an mgfxc cube golden — see PHASE34-INVESTIGATION.md §3. Do NOT renumber.