Hi, I work on a app with Metal-cpp rendering. The app does not use an MTKView. Instead, it requests a drawable from the MetalLayer and renders to the drawable's texture.
When calling [CAMetalLayer nextDrawable] i sometime get this error:
-[MTLDebugDevice notifyExternalReferencesNonZeroOnDealloc:]:2885: failed assertion `The following Metal object is being destroyed while still required to be alive by the command buffer 0x142944a00 (label: <no label set>):
<MTLToolsObject: 0x16e22b0a0> -> <AGXG13GFamilyTexture: 0x16e232a80>
label = CAMetalLayer Display Drawable
textureType = MTLTextureType2D
The call stack shows that nextDrawable tries to delete some textures.
1- I am confused by this message. Can someone confirm which object "is being destroyed"? The AGXG13GFamilyTexture or the MTLToolsObject?
2- I did a memory graph but i see no direct or indirect link between the texture and the command buffer. How can I find who is preventing the object from being destroyed?
My workstation: M1 Mac mini, MacOS Ventura 13.0.1, XCode 14.1
2
0
2.5k