LibSL icon indicating copy to clipboard operation
LibSL copied to clipboard

AutoBindShader doesn't propagate defines to included files

Open alixinne opened this issue 6 years ago • 0 comments

#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(); }

alixinne avatar Dec 12 '19 18:12 alixinne