Class Preprocessor
- Namespace
- ShadowDusk.Core.Preprocessor
- Assembly
- ShadowDusk.Core.dll
Flattens an HLSL source tree by expanding all #include directives (honoring
#pragma once and detecting circular includes) and prepending the platform macros,
producing a single self-contained PreprocessedSource for the compiler.
public sealed class Preprocessor
- Inheritance
-
Preprocessor
- Inherited Members
Methods
Flatten(string, string, MacroSet, IIncludeResolver, IReadOnlyList<string>)
Expands all includes in the source and prepends the platform macros.
public Result<PreprocessedSource, ShaderError> Flatten(string cleanedHlsl, string originalFilePath, MacroSet macros, IIncludeResolver includeResolver, IReadOnlyList<string> additionalPaths)
Parameters
cleanedHlslstringThe HLSL entry source (comments may still be present; the include scanner is comment-aware and ignores directives inside them).
originalFilePathstringThe entry source's path, used for diagnostics and relative includes.
macrosMacroSetThe platform macros to prepend.
includeResolverIIncludeResolverThe resolver used to fetch
#includetargets.additionalPathsIReadOnlyList<string>Extra include search directories.
Returns
- Result<PreprocessedSource, ShaderError>
The flattened source on success, or a ShaderError on a missing or circular include.