[BUG - WebGL] Wrapping code in ternary operator with macro declaration leads to compilation failure

Bug report and files:

https://github.com/mc-imperial/shader-compiler-bugs/issues/58

We have a successfully compiling original fragment shader, which we have slightly modified in a semantics-preserving manner. The line:

backCol2 += mix(.4, 1., v2) * vec3(1.8 * t3 * t3 * t3, 1.4 * t3 * t3, t3) * fade;

becomes:

backCol2 += mix(.4, 1., v2) * vec3((injectionSwitch.x < injectionSwitch.y ? 1.8 * t3 * t3 * t3 : GLF_live1pi), 1.4 * t3 * t3, t3) * fade;

Tested on Chrome and Firefox, verified with glslangValidator. OpenGL renders the image correctly.

Might be related to Adding valid code leads to compilation fail · Issue #57 · mc-imperial/shader-compiler-bugs · GitHub, as they both make use of macros.

  1. Operating system version.

Windows 10

  1. Graphics hardware.

GeForce GTX 770. Driver: 373.06

  1. Reproducer project.
    We have provided the fragment shader at the above link.

  2. Description of single steps to reproduce the problem.
    Navigate to GitHub & BitBucket HTML Preview with the appropriate browser, enter the shader code in the provided text box and click “Start rendering (Execute)”.

  3. Description of the expected result.
    No compilation error.