Preprocessor class
#include <derCompiler/ShaderParser.h>
Object-like macro preprocessor used to produce the per-variant declaration stream for reflection.
Public functions
- void Define(StringView name, StringView body)
-
auto Run(const std::
vector<SourceLine>& input, std:: vector<SourceLine>& output, Diagnostic& diag) -> bool - auto IsDefined(StringView name) const -> bool
- auto TryGetMacroBody(StringView name, String& body) const -> bool
-
auto EvaluateExpression(StringView expression,
std::
int32_t line, std:: int32_t depth, std:: int64_t& value, Diagnostic& diag) const -> bool
Function documentation
void ShaderCompiler:: Preprocessor:: Define(StringView name,
StringView body)
Predefines an object-like macro (used to bake variant defines, e.g. DITHER=1)
bool ShaderCompiler:: Preprocessor:: Run(const std:: vector<SourceLine>& input,
std:: vector<SourceLine>& output,
Diagnostic& diag)
Runs the preprocessor, appending active (macro-expanded) lines to output
bool ShaderCompiler:: Preprocessor:: IsDefined(StringView name) const
Returns true if the macro is defined (BATCH_SIZE always reports as defined)
bool ShaderCompiler:: Preprocessor:: TryGetMacroBody(StringView name,
String& body) const
Retrieves the body of a defined object-like macro, returns false if not defined or function-like
bool ShaderCompiler:: Preprocessor:: EvaluateExpression(StringView expression,
std:: int32_t line,
std:: int32_t depth,
std:: int64_t& value,
Diagnostic& diag) const
Evaluates a if/elif integer constant expression