Table of Contents

Class D3DCompilerShaderCompiler

Namespace
ShadowDusk.HLSL.D3DCompiler
Assembly
ShadowDusk.HLSL.dll

Compiles preprocessed HLSL to SM5 DXBC via d3dcompiler_47.dll (the fxc engine). This is the Windows-only "oracle" DXBC backend (Phase 18): it emits the real Shader-Model-5 bytecode MonoGame's DX11 runtime loads, which DXC cannot produce (DXC's minimum is SM6 DXIL). A cross-platform vkd3d-shader backend is intended to replace it behind IDxbcShaderCompiler.

Off Windows the package restores fine (managed wrapper) but the native d3dcompiler_47.dll is absent; CompileAsync(D3DCompileRequest, CancellationToken) returns a clear ShaderError rather than throwing DllNotFoundException.

public sealed class D3DCompilerShaderCompiler : IDxbcShaderCompiler
Inheritance
D3DCompilerShaderCompiler
Implements
Inherited Members

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.

public Result<PlatformBlob, ShaderError> Compile(D3DCompileRequest request, CancellationToken cancellationToken = default)

Parameters

request D3DCompileRequest

The compile request: source, entry point, stage, and flags.

cancellationToken CancellationToken

Token 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.

public Task<Result<PlatformBlob, ShaderError>> CompileAsync(D3DCompileRequest request, CancellationToken cancellationToken = default)

Parameters

request D3DCompileRequest

The compile request: source, entry point, stage, and flags.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<Result<PlatformBlob, ShaderError>>

The compiled DXBC PlatformBlob on success, or a ShaderError on failure.