Bug when parsing some #if in shaders

More precisely, bug occurs for strings like:

#if DEBUGMODE_ == 1 && (defined(BUMP) || defined(PARALLAX) || defined(TATA))

where you have some parenthesis in the condition.

https://www.babylonjs-playground.com/#UXCB15#98

The cube should be white, it is red instead.

Commenting out #define PARALLAX makes it work, but commenting #define BUMP or #define TATA does not…

Replacing the expression by:

#if DEBUGMODE_ == 1 && defined(BUMP) || DEBUGMODE_ == 1 && defined(PARALLAX) || DEBUGMODE_ == 1 && defined(TATA)

make it work in all cases, so that’s why I think the problem lies in the parenthesis.

This should come somewhere from here:

Do you want me to investigate?

Thanks, I’m going to have a look, I will let you know if I’m stuck.

1 Like