I'm making a Gaussian blur shader in GLSL. Since the convolution kernel is symmetrical, I store one half of it. I write:
vec3 glow = vec3(0.0);
for (int i = -WIDTH; i <= WIDTH; i++) {
uint j = abs(i);
glow += kernel[j] + texelFetch(u_glowTexture, coord + ivec2(i, 0), 0);
}
Strangely, this is drawing the blur slightly to the left of what it should be. But then I replace that third line with:
uint j = i * sign(i);
And now it's working like I expect. Have I broken abs()
? Have I really found a driver bug?
Abs() start to support integers at 1.30 and doubles at 4.10 version. Might be an unobvious problem with versions and types. try to debug with floats instead of ints. If that does not help than isolate and debug abs() via screen-space shader and use it output as fragment color.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With