Now that I understand your use case more. You have two methods.
-
Use the locking procedure I mentioned before: The other thread only starts writing data when the texture is unlocked, and will lock it for reading and writing. The main thread will only start reading the data when the texture is unlocked, and will lock it for reading.
-
Instead of letting the main thread read the texture, use a second texture object and clone the original texture data into this texture, then read the second texture object.
The first method is preferred as the second method does result in some extra computations but it does completely remove the synchronisation issues.