RenderingPipeline

from geometry to pixels

OpenGL conditional rendering bug on MacOS X

At least on Intel HD4000 GPUs there seems to be a bug regarding conditional rendering in OpenGL on 10.8 Mountain Lion: After the conditional rendering the condition state (ignore draw calls or execute them) is ‘stuck’ until the next draw call gets issued – this can ignore glClear calls which shouldn’t get ignored.

Here’s an example:

GLuint query;
glGenQueries(1, &query);
glBeginQuery(GL_SAMPLES_PASSED, query);
// draw bounding box
glEndQuery(GL_SAMPLES_PASSED);
 
glBeginConditionalRender( query, GL_QUERY_WAIT );
// draw actual object: if no sample of the draw call above was
// drawn, all glClear and draw commands will get ignored
glEndConditionalRender();
 
// now everything should get drawn again!
glClear( GL_COLOR_BUFFER_BIT ); // might also get ignored -> BUG
glDrawArrays(...);
glClear( ... ); // now it works again

To be clear, glClear and glClearBuffer commands between glBeginConditionalRender and glEndConditionalRender should get ignored if the query failed, but after¬†glEndConditionalRender everything should be back to normal. In fact at least on the stated configuration (10.8, Intel HD4000) it isn’t, the state of ignoring the glClear calls is stuck until the next draw call gets issued (which works as intended btw.). On 10.7 with a GeForce 9600M it works as intended, so I’m not sure whether this is a bug of the Intel drivers or of 10.8.

The bug is listed under bug id #12949224 and joins the list of other open issues.

, , , , ,

2 thoughts on “OpenGL conditional rendering bug on MacOS X
  • Christophe says:

    I tried to reproduce this bug but I haven’t been successful.
    I am using a MacBook with a GeForce 9600M and MacOS X 10.8.2.

    Thanks,
    Christophe

    • Robert says:

      Good to know, so this wasn’t introduced in 10.8 but is ‘only’ a problem on specific GPUs. Thanks for the info.
      When I have some more time I have to release some code that reproduces this bug for me.

Leave a Reply

Your email address will not be published. Required fields are marked *

*