how to check glTexSubImage2D's progress?

Started by firedoom, October 08, 2014, 06:44:04

Previous topic - Next topic

firedoom

I am trying to show a very short video at the start of my game. I am loading all the frames as textures using glTexSubImage2D(), and then display them frame by frame. However, the first few frames are missing if I play the video immediately. If I delay the playback by a couple seconds, it seems to work okay. Is it due to the texture being transferred from memory to video memory?

I tried to call glFinish() after glTexSubImage2D() and it doesn't matter. Is there a way to check when the transfer to video memory is complete so that I can delay the playback until it is finished?

broumbroum

I think it's glFlush that you are looking for. documentation specifies about buffer commands that don't empty their buffers until this method.

I use glIsTexture to check for the availability of a texture, whether it's fully loaded or not. If I'm not sure about that, I'd have called glFlush instead.

voilà !

Kai

I am pretty sure that the GL guarentees memory synchronization among its operations in the same GL context. So, if you issue a texture upload and right afterwards use an operation that sources texels from that texture, the GL will issue a memory barrier in between by itself, because it knows which operations affect which data and internal state. This could also be an indication of why your glFinish or glFlush did not do any good.

Also, for GLSL compute shaders (for example) you need to provide memory barriers/fences for yourself because with a compute shader the GL cannot know what you do with the data buffers and textures in that shader.

To find the source of the problem, I guess you need to provide some more information about how you upload the texture data and where you source from those data. Are you using different threads to do uploading and sourcing, for example?