Reputation: 19
Every piece of Metal example code, both from Apple and 3rd-party, seems to re-allocate a MTKMeshBufferAllocator
every time they need one. It's a reference type, and rarely does the MTLDevice
used to create it change, so this pattern confuses me. Apple documentation provides no hints.
Is this usage intentional, and caching MTKMeshBufferAllocator
is bad?
Or, is it just to keep sample code simple, and caching MTKMeshBufferAllocator
is fine, so long as you re-create it if your MTLDevice
changes?
(Using a cached MTKMeshBufferAllocator
causes no immediately apparent issues.)
Upvotes: 0
Views: 21