problem with occlusion query

I am using an occlusion query to determine how much of a quad is rendered to the screen provided the quad is not occluded.

Later on I am rendering the quad again, this time with any occluders in front of it, and determine how much of it is visible.

The quotient of the two values is used as a brightness intensity gradient for the quad later on.

With Catalyst v7.10 that worked; with 7.12 it doesn’t: The first step - just rendering every quad (“glDisable (GL_DEPTH_TEST)”) and querying the rendered samples afterwards always yields 0 now. The quads are however rendered.

The procedure basically works like this:


glDepthMask (0);
glDisable (GL_DEPTH_TEST);
<for all quads> {
   glBeginQuery (GL_SAMPLES_PASSED_ARB, <handle>);
   <render quad>
   glEndQuery (GL_SAMPLES_PASSED_ARB);
   }
glFlush ();
<for all quads> {
   GLint bAvailable = 0;
   GLuint nSamples;
   do {
      glGetQueryObjectiv (<handle>, GL_QUERY_RESULT_AVAILABLE_ARB, &bAvailable);
      } while (!bAvailable);
   glGetQueryObjectuiv (<handle>, GL_QUERY_RESULT_ARB, &nSamples);
   }

nSamples is always 0. Each quad has ofc its own unique handle (the handles are stored in an array).

What could I be doing wrong?

Do you get the same result if you enable depth testing and set glDepthFunc(GL_ALWAYS) ?

N.

Yes, unfortunately.

I noticed the ‘ui’ in glGetQueryObjectuiv so I guess it’s expecting a GLuint instead of a GLint. It’s a long shot, but who knows…

N.

Zero is zero, isn’t it? :wink:

Anyway, I just checked the code, and nSamples actually is GLuint there. I also checked the query counter bits, and there are 32.

What’s the value of QUERY_COUNTER_BITS ?

…oops, too late :slight_smile:

Well, seems to be a driver problem… can you make an isolated test program that exhibits this behavior?

N.

No, I can’t. That would be a days work for me.

I have reinstalled Catalyst 7.10, and occlusion query fully works with it.

Catalyst 7.12 is a driver from hell, it messed my system up so badly I had to restore a previous state of my Windows installation because I couldn’t just uninstall it and reinstall 7.10. Grrrrrrrrr.

I had the same problem already with 7.10. 7.9 works great, but after installing 7.10 my system crashed at boot time. Since then i use 7.9 and didn’t upgrade anymore.

However, this is on a laptop with hacked drivers (DhMod). It is a shame ATI does not release drivers for all hardware equally, especially since laptop-sales are so strong the last years. They really don’t get it, that also people with laptops are playing modern games. And i really don’t want to wait a year to get an updated driver from the manufacturer.

Jan.

No, I can’t. That would be a days work for me.

Part of being a graphics programmer is to track down these kinds of problems. At least half of the time, if not more, of a graphics programmer, is spent on annoying issues like this. The fact that it’s a day’s work is inconvenient, but it seems like the right thing to do. If it’s actually a driver problem, then the simple test case can be mailed to devrel@ati and they can fix it.

It works with Catalyst 7.10. I simply don’t have the time to write a test app for this problem. I downgraded (had to use a system save point because 7.12 had thouroughly messed my system up), and everything is nice and dandy again. Can it be some code in 7.12 meant for Vista interfered with my OS?