LibSL
LibSL copied to clipboard
AutoBindShader doesn't propagate defines to included files
#define statements are not propagated to included files, so this will fail at runtime (g not defined):
// a.glsl
#ifdef X
vec2 g() { return vec2(1.0, 2.0); }
#endif
// b.glsl
#define X
#include "a.glsl"
vec2 f() { return g(); }
One work-around is to ignore all statements that rely on defines from other files:
// a.glsl
#ifdef X // ignore
vec2 g() { return vec2(1.0, 2.0); }
#endif // ignore
// b.glsl
#define X // ignore
#include "a.glsl"
vec2 f() { return g(); }