mc-imperial/shader-compiler-bugs

Adding an unreachable addition operation leads to difference in rendered image

Closed this issue · 1 comments

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

The difference between the two shaders is adding an unreachable addition to a live variable:

if(((injectionSwitch.x > injectionSwitch.y))) { ray += vec3(1, 0, 0); }

Setting the vector to be all 0s leads to the bug disappearing.

Recipient:

recipient image

Variant:

variant image

The difference is believed to be due to precision of built-in function calls. In particular, this shader makes use of built-in trigonometric functions. The standard (GLSL standard, version 4.5, section 4.7.1, page 86) says:

Built-in functions not listed above and not defined as equations of the above have undefined precision. These include, for example, the trigonometric functions and determinant.