mc-imperial / shader-compiler-bugs

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

Wrapping a float in a ternary operator leads to wrong image being produced #56

Closed 0152la closed 7 years ago

0152la commented 7 years ago

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

In the shader, line:

vec3 p3 = from + (s3 + zoffset) * dir / (0.500 / 0.5);

becomes:

vec3 p3 = from + (s3 + zoffset) * dir / (0.500 / (injectionSwitch.x > injectionSwitch.y ? 0.5 : 0.5));

This small change causes the background to be more blue compared to the original. What is interesting in this case is that the value of injectionSwitch should not matter, as the ternary expression will always evaluate to the same value. Tested using Chrome and Firefox.

Recipient:

recipient image

Variant:

variant image

0152la commented 7 years ago

Reported:

https://devtalk.nvidia.com/default/topic/982343/opengl/-bug-webgl-wrapping-a-float-in-a-ternary-operator-leads-to-wrong-image-being-produced/

0152la commented 7 years ago

Problem persists with driver version 378.13.

0152la commented 7 years ago

Fixed in driver version 381.22.