views:

22

answers:

1

Hi everyone!

This is a question about syncronization in OpenGL. And the question is:

At which point in the following (pseudo) code sample does syncronization happen.

// 1.
try to map buffer object (write only and invalidate buffer)
  copy new data to mapped buffer   
unmap buffer

// 2.
bind buffer
  call subteximage to fill texture from buffer
unbind buffer

// 3.
render with texture

As far as i know syncronization happens as soon as 'an object is used'. Now it's questionable if the texture is used if it is filled from the buffer or if it is used in rendering.

If glSubTexImage doesn't block it would be possible to generally stream texture data by using buffer updates in texture update calls.

Florian

+1  A: 

Your code can block anywhere between copy and glFlush after render with texture (or frame buffer swap). It's up to the implementation.

ybungalobill
hmm :( any best guesses how this i implemented by the 'big two'?
Florian
The implementation can even not sync at all, as long as it's multiple-buffering the Buffer Object (that usually depends on which flags you used for its creation, but is also implementation-dependent).
Bahbar
@Florian, I don't know. But you can't observe the behavior in anyway except timing. Whenever the implementation blocks the end-result will be the same, so you can't 'stream the texture' as you suggested. For efficiency the implementation should block as late as possible.
ybungalobill
That's the idea. The implementation uploads new texture data after the last render call and before the pre calculations of the new frame.Now if it's possible to stream data 'per default' using the method above it would fail gracefully and there wouldn't be any programatically overhead in the code.
Florian