massive occlusion query in FBO

hi to all! ( post #1 for me… )

I have a problem described by this code: external link

It is related to massive issue of occlusion queries when rendering to an FBO. (WindowsXP/Vista/32bit/NVidia)

I tested this code on some NVidia GeForce and Quadro.
The problem arose with new chipsets, while in older ones it was not a problem.

Description:

If i have - say - 100.000 points per cycle, and i perform an occlusion query for each of them, i can do at last 9 cycles before death. With “death” i mean

<< Unhandled Exception at 0x69592001 in test.exe: 0xC0000005:
Access violation in writing [snip] 0x695e76f0 >>

which seems to be inside NVidia driver.

my debugger shows the IP to point to a random OpenGL call (maybe the first after the problem ).

If i perform the same queries without FBO all runs perfectly, if i draw the same points to FBO without queries all runs perfectly.

Since the problem occours only performin many queries (e.g. a million), could it be related to state deletion of query objects?

In the code linked above, i reproduced the problem in the simpler case. I borrowed FBO code from an Nvidia example, and the GLUT structure from NeHe tutorials.

The occlusion query code is quite the same as the one in the ARB specification, except that i massively use vector constructor/destructor of query objects.

If this is not an NVidia bug, i am doing something wrong.

hoping to be useful,
thanks for your time

MM

How long it takes to do a million queries per cycle?

I mean, it sounds like a driver bug, but is it the best way to implement whatever algorithm you are trying to implement?

If i have - say - 100.000 points per cycle, and i perform an occlusion query for each of them, i can do at last 9 cycles before death.

I’m pretty sure driver developers do not intend you to do a million queries. You should not do a query per point; that’s not what they’re for.

If this is not an NVidia bug

It is technically a driver bug, but you are so abusing the occlusion query technology that such limitations are not surprising. You should report it so that they fix it, but that does not mean that what you are doing is good.

two seconds or less more.

yes, i know it sounds ugly, and in fact it is if you think about realtime applications. what i do is an ambient occlusion calculation, which is not supposed to complete in realtime frame rates, but is faster than ray-based algorithms. in this algorithm i have to know which vertices are occluded and not only how many.

i know that there are newer and faster algorithms but i want to make this old thing work on new cards… until i have time to do some more research on that topic :wink:

i already contacted nvidia guys, but i don’t expect a fast answer, in the meantime i am disabling FBO… :slight_smile:

It looks like you create and delete all the queries at every iteration.

Did you try to reuse the same query instead to see if it fixes your problem?

ok, if i create a group of queries and reuse it seems to workaround the problem.

Now remains the task to determine how many queries i can create in that unique group, that is an undocumented per-model limit.

if i create a group of 100.000 queries works in all models but 9800 GX2 which hangs indefinitely… i try to investigate more.

thanks for your help, though, now i can do a workaround hotfix :slight_smile: