PDA

View Full Version : problem with occlusion query



karx11erx
01-04-2008, 03:48 PM
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, &amp;bAvailable);
} while (!bAvailable);
glGetQueryObjectuiv (<handle>, GL_QUERY_RESULT_ARB, &amp;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?

-NiCo-
01-04-2008, 04:16 PM
Do you get the same result if you enable depth testing and set glDepthFunc(GL_ALWAYS) ?

N.

karx11erx
01-04-2008, 04:24 PM
Yes, unfortunately.

-NiCo-
01-04-2008, 04:28 PM
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.

karx11erx
01-04-2008, 04:32 PM
Zero is zero, isn't it? ;)

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

-NiCo-
01-04-2008, 04:51 PM
What's the value of QUERY_COUNTER_BITS ?

...oops, too late :)

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

N.

karx11erx
01-04-2008, 05:12 PM
No, I can't. That would be a days work for me.

karx11erx
01-05-2008, 08:00 PM
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.

Jan
01-06-2008, 06:14 AM
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.

jwatte
01-06-2008, 01:13 PM
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.

karx11erx
01-08-2008, 09:03 AM
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?