PDA

View Full Version : Detecting if a change occurred somewhere



knucklefinger
05-01-2008, 07:29 AM
I am creating a gpgpu style app, and from one iteration to the next I need to test if a change has occurred to the framebuffer.

It seems like this is an occlusion test, since there seems to be no other way of testing if a framebuffer (and the count) has changed.

Is there some other way I'm overlooking?

k_szczech
05-02-2008, 06:57 AM
There are other ways, but occlusion query is both simplier and faster than all of them.

To maximize performance, you can consider dividing your screen to let's say 16 areas (4x4). Create 2 oclusion queries and start "rendering differences". Send commands to render 2 quads to GPU. Wait for occlusion query result for 1st quad. If result is positive (something has changed), then you can stop rendering more areas - you have your answer allready.
If nothing has changed - render 3rd area using this query and wait for results from 2nd area. And so on.

You should always render one quad ahead to keep GPU working, that's why you need 2 queries.

And of course you can use some probability function to determine which areas to test first. No one says you need to render them in just one order.