Table of Contents

Class RaylibConverter

Namespace
ShadowDusk.Compiler.Raylib
Assembly
ShadowDusk.Compiler.dll

Converts an HLSL .fx pixel shader to a raylib fragment shader for Raylib-cs (Phase 59, the fragment-only slice). The route is the same seam the SkSL converter uses: HLSL → [DXC] → SPIR-V → [SPIRV-Cross] → modern GLSL → [raylib convention mapper], branching before the MonoGame GLSL rewriter and the MGFX writer, so no substitute compiler is involved and no existing target's output changes.

Evidence model: rendered-image fidelity (owner decision 2026-10-01, the SkSL target's model): raylib has no reference compiler, so this is never an mgfxc-equivalence claim. The proof is validation/RaylibRoute, which renders each converted shader in real Raylib-cs and pixel-diffs it against the same .fx built for OpenGL and rendered in real MonoGame DesktopGL.

Input languages: anything that becomes .fx text. A .slang file goes through ConvertSlang(string, RaylibConvertOptions, CancellationToken) (built-in frontend) or ShadowDusk.Slang's SlangCompiler.ConvertToRaylib (real slangc); the HLSL either yields is compiled by the same DXC as every .fx, so the converter itself needs nothing Slang-specific.

Everything raylib's fixed-function model cannot hold is rejected loudly (SD0630–SD0636), never emitted as a shader that loads and renders wrong.

public static class RaylibConverter
Inheritance
RaylibConverter
Inherited Members

Methods

Convert(string, RaylibConvertOptions, CancellationToken)

Converts the pixel shader of fxSource's single technique/pass to a raylib glsl330 fragment shader, or returns the loud diagnostics for anything raylib's model cannot hold.

public static Result<RaylibShader, ShaderError[]> Convert(string fxSource, RaylibConvertOptions options, CancellationToken cancellationToken = default)

Parameters

fxSource string

The HLSL .fx effect source.

options RaylibConvertOptions

Conversion options; see RaylibConvertOptions.

cancellationToken CancellationToken

Observed between pipeline stages.

Returns

Result<RaylibShader, ShaderError[]>

ConvertSlang(string, RaylibConvertOptions, CancellationToken)

Converts HLSL-compatible .slang source to a raylib fragment shader through the built-in Slang frontend (ConvertToFx(string, SlangConvertOptions), no extra package, every host), then Convert(string, RaylibConvertOptions, CancellationToken) applies every raylib rule unchanged. Slang-only constructs (SD0600) are refused by the frontend; for genuine Slang use ShadowDusk.Slang's SlangCompiler.ConvertToRaylib. Set SourceName to the .slang name for diagnostics.

public static Result<RaylibShader, ShaderError[]> ConvertSlang(string slangSource, RaylibConvertOptions options, CancellationToken cancellationToken = default)

Parameters

slangSource string

The Slang source; pixel entry marked [shader("fragment")].

options RaylibConvertOptions

Conversion options; see RaylibConvertOptions.

cancellationToken CancellationToken

Observed between pipeline stages.

Returns

Result<RaylibShader, ShaderError[]>