PDA

View Full Version : [ATI BUG] glUseProgramObject() NOP changes output



speedy
11-07-2008, 10:27 AM
I have encountered a bug in newer ATI OpenGL drivers which, after some drilling into it, boils down to the following test case - three lines of code which act as a NOP (if anyones sees a problem in that assumption please correct me) actually change the rendering output.

GLhandleARB tmp = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);
glUseProgramObjectARB(cur->prog_id);
glUseProgramObjectARB(tmp);

The effect is that game subtitles do not show on screen when those lines are compiled in. When they are commented out, the subtitles are showing up normally.

If anyone has encountered anything similar to this, or knows of a workaround, please help.

ps. This is the last and showstopping bug for the russian and czech localization of the OpenGL game. :)

speedy
11-07-2008, 12:09 PM
After further drilling, the bug turned out to be a piece of legacy code which touches a rarely used OpenGL feature:

glEnable(GL_VERTEX_PROGRAM_TWO_SIDE_ARB) & glDisable(GL_VERTEX_PROGRAM_TWO_SIDE_ARB)

Touching this flag causes problems for GLSL compiler which sideeffects (in a totaly strange way, known only to the driver writers) the text writing routines - fixed-pipeline polygon blits. The bug is triggered _only_ when the first GLSL shader is bound via:

glUseProgramObjectARB(cur->prog_id);

and that's why the NOP code from the previous message caused a different rendering output.

This is a lesson learned again and again: stray of the well trodden driver usage paths (as in Doom 3, GLSL, GPGPU), and you'll get bitten.