You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Shader Preprocessor: Fix preprocessing for shader asserts. Need to preprocess the contents of TEXT macros to handle __FILE__ macros, or other possible macro generated text.
#rnx #rb dan.elksnitis [CL 29538506 by jason hoerner in ue5-main branch]
This commit is contained in:
@@ -702,8 +702,14 @@ bool InnerPreprocessShaderStb(
|
||||
macro_definition** StbDefines = nullptr;
|
||||
FShaderPreprocessorUtilities::PopulateDefines(Environment, AdditionalDefines, &MacroArena, StbDefines);
|
||||
|
||||
arrput(StbDefines, pp_define_custom_macro(&MacroArena, ShaderPrintTextIdentifier));
|
||||
arrput(StbDefines, pp_define_custom_macro(&MacroArena, ShaderPrintAssertIdentifier));
|
||||
// The substitution text generated by custom macros gets run through the preprocessor afterwards, but in some cases we want to
|
||||
// run the arguments through the preprocessor before as well. The TEXT macro needs this to handle things like TEXT(__FILE__),
|
||||
// where the __FILE__ macro needs to be expanded before the custom macro handler is called, so we pass "1" to enable running
|
||||
// the preprocessor first. By contrast, for shader asserts, we must NOT run the preprocessor on the arguments first, because
|
||||
// the assert macro sets a state flag which modifies behavior of TEXT macros inside the assert. Asserts store their TEXT tokens
|
||||
// outside the shader for printing in code when an assert is triggered, while ShaderPrint stores TEXT in the shader itself.
|
||||
arrput(StbDefines, pp_define_custom_macro(&MacroArena, ShaderPrintTextIdentifier, 1));
|
||||
arrput(StbDefines, pp_define_custom_macro(&MacroArena, ShaderPrintAssertIdentifier, 0));
|
||||
|
||||
PRAGMA_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user