Closed psulat closed 8 years ago
GLSLX isn't designed to interact with the preprocessor. That said, your use case should be pretty easy to get working. I added extensions to GLSL to make this kind of stuff easy to add yourself. Just add an import and the compiler will emit that identifier unmangled in the final output:
import bool SRGB_EXT_DEFINE;
export void main() {
gl_FragColor = vec4(SRGB_EXT_DEFINE ? 1.0 : 0.0);
}
As long as your macro is well-behaved (doesn't make drastic changes to the syntax tree), it should be easy to model it using an import statement. Does that work?
That worked. Thanks!
I currently use google's compiler and I was giving glslx a try.
I'm running into one issue. I have several #defines that get dynamically added to my shaders after the minimization process. For example, I use "SRGB_EXT_DEFINE" in my glsl code and then in javascript I add #define SRGB_EXT_DEFINE to true or false based on what is actually available. This doesn't work in glslx because the SRGB_EXT_DEFINE symbol can't be found. How do I modify glslx to not complain about specific symbols that have yet to be defined? Thanks!
Pete