PDA

View Full Version : glDeleteQueries is taking forever



RenderBuffer
02-04-2008, 06:56 PM
glDeleteQueries is taking an enormous amount of time (10's of minutes). Granted, I'm deleting a healthy number of query objects, but gen'ing was near instant, and I don't expect that the delete call should be exponentially slower.

Is deleting that much more expensive than gen'ing or is this just a buggy driver issue (again)?

Korval
02-04-2008, 08:14 PM
I think it's a little unreasonable to expect that allocating and deleting an object should be comparable in speed. Especially since glGen* doesn't really do anything except tell the GL implementation that the object name X may be used in the future.

At the same time, taking tens of minutes does seem rather broken.

Are you actually done with them? That is, did you finish the last query before you tried to delete them.

Also, what is "a healthy number" of query objects? 100? 10,000?

RenderBuffer
02-04-2008, 08:53 PM
They're done, and all queries are finished (and results are collected) before I delete them.

"Healthy" is quite a bit larger than that. I'm running into trouble at around 62,400. I'd like to go as high as 3,000,000, though that may be unreasonable(?).

Korval
02-04-2008, 09:38 PM
I'm running into trouble at around 62,400. I'd like to go as high as 3,000,000, though that may be unreasonable(?).

???

60,000 is already in the "unreasonable" territory. You don't need one query for every single thing you draw.

The driver's probably not designed to be able to handle so many query objects. It may be that whatever they're doing to map GL query object names to real objects, and to remove that mapping on delete, isn't a very scalable algorithm. Thus, they expected you to have maybe 300 query objects at the most, and you're trying to shove 60,000 deletes through an O(n^2) algorithm.

RenderBuffer
02-04-2008, 09:56 PM
Thanks, I'll scale it back.

This is the first I've used occlusion queries, and I decided to try them out generating an ambient occlusion solution. Out of convenience I allocated all the queries I needed at the beginning, and deleted them at the end. As I increased the sampling rate (and thus the number of queries I allocated & deleted) I noticed the delete time significantly increasing (taking longer than actually generating the solution), so I thought I'd ask about it.

Thanks!