Class CompilerOptions
- Namespace
- ShadowDusk.Core
- Assembly
- ShadowDusk.Core.dll
Settings that control a single CompileAsync(string, CompilerOptions, CancellationToken) call: the
target backend, how #include directives are resolved, debug output, the MGFX
container version, and (for DirectX) which DXBC backend to use.
public sealed class CompilerOptions
- Inheritance
-
CompilerOptions
- Inherited Members
Properties
AdditionalIncludePaths
Additional directories searched, in order, when resolving #include directives.
Equivalent to the CLI's /I flag.
public IReadOnlyList<string> AdditionalIncludePaths { get; init; }
Property Value
Container
Which effect container to emit. Defaults to Mgfx (MGFX v10), which loads on every MonoGame/KNI runtime, the seamless default. Set Knifx to opt into KNI's additive KNIFX v11 container (KNI v4.02+). This is a non-required escape hatch / additive target, never needed for correct v10 output. Ignored for Fna.
public EffectContainer Container { get; init; }
Property Value
Debug
When true, compiles with debug information enabled. Deliberately a
no-op for Fna: MojoShader is stricter on fxc
debug-style codegen, so the FNA path always compiles optimized — Debug can never
produce a .fxb the FNA runtime rejects.
public bool Debug { get; init; }
Property Value
DxbcBackend
Which backend compiles HLSL to SM5 DXBC when Target is
DirectX. Defaults to Vkd3d,
the cross-platform shipping backend: it runs on every desktop OS and is
host-independent, so a default DirectX compile produces the same bytes on
Linux, macOS, and Windows. Set D3DCompiler to opt in
to the Windows-only d3dcompiler_47 correctness oracle (it hard-fails off
Windows). Ignored for non-DirectX targets — Fna
always uses vkd3d-shader. On the browser/WASM host this option is moot:
WasmShaderCompiler always compiles DXBC via the vkd3d-shader WASM backend
(there is no d3dcompiler_47 in a browser), which matches the desktop default.
public DxbcBackend DxbcBackend { get; init; }
Property Value
IncludeResolver
Optional custom resolver for #include directives. When null,
includes are resolved relative to SourceFileName and
AdditionalIncludePaths. Supply an in-memory resolver to compile without
touching disk (e.g. in WASM/in-browser scenarios).
public IIncludeResolver? IncludeResolver { get; init; }
Property Value
MgfxVersion
The MGFX container version to emit. Defaults to 10, which loads across the
supported MonoGame/KNI runtimes (the backwards-compatible choice). Ignored for
Fna, whose output is the D3D9 fx_2_0 container, not MGFX.
Also ignored when Container is Knifx.
public int MgfxVersion { get; init; }
Property Value
Profile
An optional, render-proven CapabilityProfile naming a full (runtime, format) contract: when set it selects the effect container/version and the GL ShaderDialect, overriding Container / MgfxVersion. Defaults to null, which reproduces today's behavior exactly (the container comes from Container / MgfxVersion and the dialect from Target). A profile is never required for correct output, only an additive, named convenience the runtime-detection helper also returns.
public CapabilityProfile? Profile { get; init; }
Property Value
SourceFileName
The logical source file name used for include resolution and for the file path reported in ShaderError diagnostics. Optional when compiling a string literal in memory.
public string? SourceFileName { get; init; }
Property Value
Target
The platform backend to compile for. Defaults to OpenGL.
Note this differs from the CLI's default profile (DirectX_11).
public PlatformTarget Target { get; init; }
Property Value
Methods
WithGraphicsTarget(PlatformTarget)
Returns a copy with Target replaced by graphicsTarget,
preserving every other setting. The pipeline uses this to apply a
GraphicsTarget (a profile fully specifies its output
backend, so a set Profile determines the backend).
public CompilerOptions WithGraphicsTarget(PlatformTarget graphicsTarget)
Parameters
graphicsTargetPlatformTarget