I have the objects in my scene roughly sorted according to a painter’s algorithm and am rendering them front to back. To speed things up, I want to first render their bounding box with writes to the color and depth buffers disabled and use a Query object to count the number of fragments that make it onto the screen. If 0 fragments are drawn, I do not draw the bounded object. While this lets me throw away a lot of geometry, every Query will require the pipeline to be flushed.
Would I save more time than I loose with this technique? Is there a way to speed this up?