In my MTKView render loop, I'm implementing a triple-buffering scheme which transitions between two videos (so, dual triple-buffering). This is done with a dispatch_semaphore_create(3);
As the CVPixelBuffer frames are arriving from my pair of AVPlayers, I convert them to MTLTextures with CVMetalTextureCacheCreateTextureFromImage.
I'm currently including the underlying CVMetalTextureCacheRef cache to the transitional buffers. So, there are 6 such caches that i rotate through.
Is this necessary? Overkill?
Is a call to CVMetalTextureCacheCreateTextureFromImage thread-safe? If not, a thought I had was to enclose the call to itin a dispatch_sync handler and grab the resulting texture, and have only one such cache on the MTKView.