I was trying to do a simple stipple pattern in a glsl fragment shader via
doesn't work |
---|
ivec2 pixel = ivec2(gl_FragCoord.xy); if( ((pixel.x+pixel.y)%2)) discard; |
but this doesn't discard any fragments at all. The silly thing is that if I add a not it works as expected. It also works if I explicitly convert the expression in the if clause to a bool.
does work |
---|
ivec2 pixel = ivec2(gl_FragCoord.xy); if( !((pixel.x+pixel.y)%2)) discard; //if( bool((pixel.x+pixel.y)%2)) discard;//works too |
This happens pretty much in any shader I tried regardless of the other GL-state.
Os: Windows 7 64
Graphics Chipset ATI Radeon HD 5800 Series
Device ID 6898
Driver Packaging Version 8.982-120727a-145524C-ATI
Catalyst Version: 12.8
OpenGL Version: 6.14.10.11762
Hi,
This sounds like the compiler is having issues promoting the integer expression to a Boolean. Do you see any warnings from the shader compiler (glGetShaderInfoLog) or any output from a debug context? Also, could you try updating your driver to Catalyst 12.10? Let us know what you find and we'll go investigate.
Cheers,
Graham
Same problem with version 12.10. With version 12.8 the infologs always contained something along the lines "fragment shader compiled successfully", with version 12.10 I get an empty info log.
Okay, thanks. We'll dig deeper into this to see what's going on.
The change in info log output is expected. We recently removed the "shader compiled successfully" message because a number of applications were expecting an empty log on successful compilation rather than testing the COMPILE_STATUS flag.
Thanks,
Graham