Class RdefReader
- Namespace
- ShadowDusk.Core.Reflection
- Assembly
- ShadowDusk.Core.dll
Pure-managed DXBC reflection: parses the DXBC container's RDEF
(resource definition) and ISGN/OSGN (signature) chunks into the same
ReflectedEffect shape D3DReflect produced — the SM4/SM5 sibling
of CtabReader (Phase 18 Track A). This removes the Windows-only
d3dcompiler_47 P/Invoke from the DirectX pipeline, so DX11 .mgfx compiles run
on Linux/macOS (and, being dependency-free managed code, in WASM).
Layout sources: the DXBC container / RDEF format is stable and documented (Wine's
d3dcompiler reflection implementation, vkd3d-shader's tpf/dxbc writers,
and public DXBC container format references). Field semantics were verified byte-level
against d3dcompiler_47's own emission and ID3D11ShaderReflection's readback;
oracle parity is enforced by DxbcReflectionParityTests (managed output deeply
equal to D3DReflect's for both d3dcompiler_47 and vkd3d DXBC, on Windows).
Behavioral quirks preserved deliberately (the bar is "identical to D3DReflect + the previous extractor", not "looks right"):
- Array variables report a 16-byte-aligned size (the previous extractor rounded
D3DReflect's unpadded trailing element up; seeVariableReflection). - Empty constant buffers are dropped — mgfxc emits no cbuffer record for an empty
$Globals(e.g. a texture-only PS), so the DX.mgfxmust match. D3DReflectfixes up signature system values fxc stores as 0 by semantic name (SV_Target→Target,SV_Depth→Depth, …) — reproduced in FixUpSystemValue(uint, string).
public static class RdefReader
- Inheritance
-
RdefReader
- Inherited Members
Methods
Read(ReadOnlySpan<byte>, string)
Parses the reflection chunks of dxbc into a
ReflectedEffect (with Parameters left
empty — the parameter list is assembled downstream, exactly as before). Fails
(never throws) when the blob is not a DXBC container or its reflection data is
malformed.
public static Result<ReflectedEffect, ShaderError> Read(ReadOnlySpan<byte> dxbc, string sourceFile = "")
Parameters
dxbcReadOnlySpan<byte>A complete SM4/SM5 DXBC module.
sourceFilestringThe source file to attribute errors to (may be empty).