Hi Dan,
The situation is this:
I have a cache of decoded video frames, and I'm selectively uploading the most likely frames to be rendered next to textures on the GPU. Textures are pulled from a cache (or created if the cache is empty) and their contents updated. This happens in a worker thread.
This system is working fine on the following platforms:
Windows and Android with OpenGL
iOS/tvOS with Metal (The decoder outputs Metal compatible buffers, and textures are just mapped without any copying.)
MacOS with OpenGL
On MacOS with Metal, however I'm seeing frames being displayed out of order.
As I see it, it could be one of two things:
1) Textures are reused (and updated) while they're still queued to be rendered for a previous frame.
2) Textures are used before they've been uploaded to the GPU.
I've sort of discarded point 1 because I would expect to see the same issue on other platforms. (This could be an incorrect assumption.) Which leaves point 2, hence my question. The Open GL renderer/uploader sets up a fence for each upload, so I know a texture is definitely available before attempting to render it.
Typically there are three or four video frames available for display at any given time. When a frame is deemed no longer needed, its textures are returned to the cache.