Fences with ati

Hi all,

i checked the extension registry,
the web and this forum - is it true
that there is no fence support under
windows and ati?
under os x this works well because
it is an apple extension.

somebody could clarify this?

best & many thanks,

I haved used occlusion queries to implement fences with ATI (and NVidia) GPU’s.

An alternative to occlusion queries (which work) is to read from a render target (pixel buffer or frame buffer). Or just call glFinish().

What do you need the fences for?

i need those fences in combination with PBOs:
set a fence right after triggering a texture upload
from a bound buffer object, and testing for a finished
upload in the next frame:


glBindBuffer( GL_PIXEL_UNPACK_BUFFER_ARB, draw_buffer );
glBindTexture( GL_TEXTURE_TARGET_MXW , texture );


>I haved used occlusion queries to implement fences with ATI (and NVidia) GPU’s.

any hint how to do this?

Start an occlusion query, issue some geometry, and stop the query, right after the operation you want to fence. Then, when time comes to fence, wait/get on the query to get the result. The geometry you issue can be designed to not actually change the frame buffer (say, a small triangle at the far plane); it’s the fact that you ask for the query result that matters. However, in this case, that’s not necessarily good enough, because you’d have to bind the texture you’re interested in when you draw the geometry to test it, and that forces a stall right away.

However, for this particular case, I think you can force the image to be uploaded by simply calling MapBuffer() on the buffer in the next frame. Or just bind the texture. If the upload takes longer than a frame, you have bigger problems than just stalling the pipe for a little bit.

For several years on both ATI and NVIDIA issuing geometry has not been necessary. I just start and stop the query. Of course I can’t guarantee that some future optimization may change this behavior.

Issuing geometry should never be neccesary. Was it ever required by any driver?

I believe a smart driver could optimize a query such that an empty query can immediately finish, because queries have a start and an end. Whether the driver would do that, I don’t know, but I prefer to not rely on such behavior. If I issue geometry, I know what I’m getting!

Well, queries are required to return in order, so that would only work in the case where no other queries are in flight before it. The general philosophy of the extension is that by the time a query returns the results, the rendering to that query has ended, even though the extension only expressly mentions it can be inferred that older queries has also completed.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.