Possible GLSL compilation bug

Hey.

I believe I may have run into a GLSL compilation bug. I have a piece of code that uses uvec2(abs(floor(coords))), but it would appear that abs() is being ignored.

However, using a “manual” if(coords.x < 0) coords.x = -coords.x; does work.

Relevant links (n.b.: this is not the final code, so ignore the intended semantics of it!):

  • Relevant program sources: http://codepad.org/ujUwkswz http://codepad.org/wCmfiiL4 (`COORDS` range from -32.5 to +31.5 due to scaling)
  • Output with `abs()`: http://i.imgur.com/bGbNAGD.png
  • Output with `if()`: http://i.imgur.com/lcYrdaL.png
  • Comparison between the `abs()` version disassembly and the `if()` ("manual") one: http://vpaste.net/Ibcem

A few notes:

  • GL: 3.3.0 NVIDIA 378.92; shader is `#version 330`
  • `#pragma optimize (off)` does not change the output.
  • Using `icoords = abs(icoords);` is exactly the same as simply omitting that line, and not using `abs()` at all.
  • The disassembly seems correct. However (as mentioned in the previous line), during execution, `abs()` is ignored, as if it were a no-op (I suspect the `ABS` flag in the binary output is either ignored or not written in the first place)

DarkUranium,

Thanks for the report. We have created an internal bug to track this issue.
Could you provide a minimum program source code(not just the shader code) so we can better reproduce and debug the problem.

Also please specify your OS