- Home /
shaderlab preprocessor ignoring #if #endif when #pragma is within it.
I'm trying to figure out how to use preprocessor directives to specify target and glsl pragmas. The end goal for me is to be able to use shader keywords to enable and disable various parts of a shader, while maintaining the lowest "#pragma target" possible.
When i use the following code, the GLSL is defined weather or not USE_ADVANCED_OPTIONS is defined!
#if USE_ADVANCED_OPTIONS
#pragma glsl
#endif
If you add that to a shader, and open up the compiled output, it is as if the preprocessor ignores the #if statement when dealing with pragma. Any idea on how to get beyond that?
I am wondering if #prama is being passed right through by the shader optimizer's preprocessor.
https://github.com/aras-p/glsl-optimizer/tree/master/src/glsl
and produces a new string containing the preprocessed shader. This takes care of things like #if, #ifdef, #define, and preprocessor macro invocations. Note that #version, #extension, and some others are passed straight through. See glcpp/*"1) lex and yacc-based preprocessor takes the inco$$anonymous$$g shader string
Your answer
Follow this Question
Related Questions
Particles to Fluid 0 Answers
Shardelab/CG shaders not working on iOS 1 Answer
'discard' keyword cg error 1 Answer