MTLTexture streaming to app directory

For better memory usage when working with MTLTextures (editing + displaying in render passes, compute shaders, etc.) is it possible to save the texture to the app's Documents folder, and then use an UnsafeMutablePointer to access/modify the contents of the texture before displaying in a render pass? And would this be performant (i.e 60fps)? That way the texture won't be directly in memory all the time, but the contents can still be edited and displayed when needed.

If I understand correctly, you're proposing to mmap a file containing a bitmap, and then on each frame create an MTLTexture from that pointer, draw your frame, and discard the MTLTexture.

This technique is unlikely to reduce your app’s peak memory consumption unless you have a very unique usage pattern that ensures your textures aren’t needed at the same time. It’s also very unlikely to meet your performance requirements—every frame, Metal will potentially be blocked on paging in the bitmap data from the file that backs the memory mapped pointer.

MTLTexture streaming to app directory
 
 
Q