Class FxPreParser
- Namespace
- ShadowDusk.HLSL
- Assembly
- ShadowDusk.HLSL.dll
FX9 pre-parser: strips technique, pass, and sampler_state blocks from .fx source and extracts all FX9 metadata needed by the compilation pipeline. DXC rejects these constructs, so they must be removed before invoking DXC. Stripped output preserves original line numbers by replacing removed lines with blank lines. FxSourceMode selects how legacy D3D9 constructs in the shader body are treated: rewritten forward to SM4 for DXC (the default), or preserved verbatim for an SM1–3 backend (the FNA fx_2_0 target, compiled by vkd3d).
public sealed class FxPreParser
- Inheritance
-
FxPreParser
- Inherited Members
Methods
IsKnownProfile(string)
Returns true when the given profile string (already lowercased) is a recognized shader profile.
public static bool IsKnownProfile(string profile)
Parameters
profilestring
Returns
Parse(string, string)
Parses an FX9 .fx source file, strips FX9-specific blocks, and extracts metadata, rewriting legacy D3D9 constructs forward to SM4 (RewriteToSm4).
public static Result<FxParseResult, FxParseError> Parse(string source, string sourceFile)
Parameters
sourcestringFull text of the .fx file.
sourceFilestringDisplay name used in diagnostics (file path or virtual name).
Returns
Parse(string, string, FxSourceMode)
Parses an FX9 .fx source file, strips FX9-specific blocks, and extracts metadata.
public static Result<FxParseResult, FxParseError> Parse(string source, string sourceFile, FxSourceMode mode)
Parameters
sourcestringFull text of the .fx file.
sourceFilestringDisplay name used in diagnostics (file path or virtual name).
modeFxSourceModeHow legacy D3D9/SM3 constructs in the shader body are treated (rewritten forward for DXC, or preserved verbatim for an SM1–3 backend).