Interface IDxbcShaderCompiler
- Namespace
- ShadowDusk.HLSL.D3DCompiler
- Assembly
- ShadowDusk.HLSL.dll
Compiles preprocessed HLSL to SM5 DXBC (Shader Model ≤ 5) — the bytecode
MonoGame's DX11 runtime loads. This is the seam behind which a DXBC backend
sits: the d3dcompiler_47 "oracle" (D3DCompilerShaderCompiler,
Windows-only) and the cross-platform vkd3d-shader backend
(Vkd3dShaderCompiler) — selected via CompilerOptions.DxbcBackend
without changing the pipeline.
public interface IDxbcShaderCompiler
Methods
Compile(D3DCompileRequest, CancellationToken)
Synchronous counterpart of CompileAsync(D3DCompileRequest, CancellationToken): compiles the request on the
calling thread. Every DXBC backend's compile is synchronous work —
CompileAsync(D3DCompileRequest, CancellationToken) is only a thread-offload (desktop) or
one-time-module-load (WASM) shell over this — so both entry points produce
identical bytes by construction. On the browser/WASM host the vkd3d-shader module
must already be loaded (IShaderCompiler.InitializeAsync); otherwise a clear
ShaderError (SD1903) is returned. Never blocks on a task
internally.
Result<PlatformBlob, ShaderError> Compile(D3DCompileRequest request, CancellationToken cancellationToken = default)
Parameters
requestD3DCompileRequestThe compile request: source, entry point, stage, and flags.
cancellationTokenCancellationTokenToken checked before the compile starts.
Returns
- Result<PlatformBlob, ShaderError>
The compiled DXBC PlatformBlob on success, or a ShaderError on failure.
CompileAsync(D3DCompileRequest, CancellationToken)
Compiles a preprocessed HLSL request to an SM ≤ 5 DXBC blob.
Task<Result<PlatformBlob, ShaderError>> CompileAsync(D3DCompileRequest request, CancellationToken cancellationToken = default)
Parameters
requestD3DCompileRequestThe compile request: source, entry point, stage, and flags.
cancellationTokenCancellationTokenA cancellation token.
Returns
- Task<Result<PlatformBlob, ShaderError>>
The compiled DXBC PlatformBlob on success, or a ShaderError on failure.