Pat's Log
Tue, 20 Dec 2005

Working Around ATI's Bugs
I'm celebrating. After months of living with a bug in ATI's drivers triggered by Celestia's OpenGL 2.0 render path, I've finally found a work-around. Not having the source or any way to debug GLSL that is compiled and then executed by the ATI binary, the only option was to fiddle with the GLSL code. After several iterations of setting the texture red, green, or blue based on an if statement that could confirm the state of a value, I was no closer to getting it. Also, when the problematic line:

gl_FragColor = color * diff + color.a * spec;
... was broken into two lines...
gl_FragColor = color * diff gl_FragColor += color.a * spec;
... and still crashed. But when either of the lines was run on its own (changing '+=' to '='), it ran just fine. The solution in the end came as a complete accident. The line became:
gl_FragColor = color * diff + float(color.a) * spec;
BINGO. This worked. Which is strange, since color is a vec4 is a (float, float, float, float), as defined in the GLSL Specification:

vec4: a four component floating-point vector

Definitely a bug in the ATI binary. The GLSL compiler was not catching it, because the code was right. However, whatever was executing the compiler's output was certainly misinterpreting. For now, I'm celebrating. But eventually, I'll raise a little hell.


[] | posted @ 04:57 | link

copyright ©2004-2016 pat suwalski