mc-imperial / shader-compiler-bugs

A collection of shader compiler bugs.
MIT License
49 stars 9 forks source link

Changing literals to ternary operators with OpenGL function calls leads to black image #47

Closed 0152la closed 7 years ago

0152la commented 7 years ago

[Shaders, screenshots, error log, reproduction steps, etc.] [ZIP]

The difference between the two shaders is one line, where three literals are changed to ternary operators, all including OpenGL-specific operations. The line in question is originally:

return b * (1.0 - s) + (b - b * (1.0 - s)) * clamp(abs(abs(6.0 * (h - vec3(0, 1, 2) / 3.0)) - 3.0) - 1.0, 0.0, 1.0);

, becoming:

return b * (1.0 - s) + (b - b * (1.0 - ((true ? s : (mod(vec3(1.0), vec3(1.0)).x))))) * clamp(abs(abs(6.0 * (h - vec3(0, 1, 2) / 3.0)) - 3.0) - ((false ? (distance(vec3(1.0), vec3(1.0))) : 1.0)), 0.0, ((true ? 1.0 : (determinant(mat4(1.0)))))); }

Recipient:

recipient image

Variant:

variant image

0152la commented 7 years ago

Problem persists with driver version 378.13.

0152la commented 7 years ago

Fixed in driver version 381.22.