GPU capture crash using Metal from SwiftUI

I am adopting direct use of Metal (via MTKView) in my SwiftUI app's custom view. Currently I am trying to add a second rendered primitive (a point with a custom shader) but it isn't working as expected so I want to debug it. When I click the GPU frame capture button, the program immediately crashes on my call to commandBuffer.commit(). Thinking this is related some something I'm doing wrong in my second rendered primitive, I comment it out and try again -- the crash is identical. At this point the only thing I am rendering in Metal (and it works perfectly until I frame capture) is a single full-view textured quad.


Running latest Catalina on a 2018 Mac mini with an eGPU, latest Xcode, Mac build. Running an iOS build on an iPadPro (1st gen) the frame capture works and I'm able to debug the frame.


Here is the crash's stack trace:


Thread 1 Queue : com.apple.main-thread (serial)

#0 0x00007fff6e987613 in ___lldb_unnamed_symbol61$$libMTLCapture.dylib ()

#1 0x00007fff6e9c2310 in ___lldb_unnamed_symbol578$$libMTLCapture.dylib ()

#2 0x00007fff6e9d28b8 in ___lldb_unnamed_symbol838$$libMTLCapture.dylib ()

#3 0x00007fff6e9dca4e in ___lldb_unnamed_symbol1034$$libMTLCapture.dylib ()

#4 0x00007fff6e9dc686 in ___lldb_unnamed_symbol1021$$libMTLCapture.dylib ()

#5 0x00007fff6e9b5663 in ___lldb_unnamed_symbol415$$libMTLCapture.dylib ()

#6 0x00007fff6e9b5568 in ___lldb_unnamed_symbol414$$libMTLCapture.dylib ()

#7 0x00000001000201de in SpaceView.Coordinator.draw(in:) at /Volumes/HelixRust/Development/NewtonSpace/NewtonSpace/SpaceView.swift:401

#8 0x00000001000204c4 in @objc SpaceView.Coordinator.draw(in:) ()

#9 0x00007fff73bdd644 in -[MTKView draw] ()

#10 0x00007fff437dcb84 in -[CALayer display] ()

#11 0x00007fff437dc469 in CA::Layer::display_if_needed(CA::Transaction*) ()

#12 0x00007fff437ba716 in CA::Context::commit_transaction(CA::Transaction*, double) ()

#13 0x00007fff437b9304 in CA::Transaction::commit() ()

#14 0x00007fff437f5725 in CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) ()

#15 0x00007fff37cfb4f5 in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()

#16 0x00007fff37cfb427 in __CFRunLoopDoObservers ()

#17 0x00007fff37cfa039 in CFRunLoopRunSpecific ()

#18 0x00007fff3692dabd in RunCurrentEventLoopInMode ()

#19 0x00007fff3692d7d5 in ReceiveNextEventCommon ()

#20 0x00007fff3692d579 in _BlockUntilNextEventMatchingListInModeWithFilter ()

#21 0x00007fff34f78c99 in _DPSNextEvent ()

#22 0x00007fff34f774e0 in -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] ()

#23 0x00007fff34f691ee in -[NSApplication run] ()

#24 0x00007fff34f3aff6 in NSApplicationMain ()

#25 0x00007fff3525ca85 in _NSApplicationMainWithInfoDictionary ()

#26 0x00007fff68ea5e00 in UINSApplicationMain ()

#27 0x00007fff7858c6ff in UIApplicationMain ()

#28 0x0000000100005d7b in main at /Volumes/HelixRust/Development/NewtonSpace/NewtonSpace/AppDelegate.swift:74

#29 0x00007fff71c42cc9 in start ()

#30 0x00007fff71c42cc9 in start ()

I get an printed error telling me that it cannot init() the MTLCaptureManager in Mac Catalyst. I guess that answers that question.

GPU capture crash using Metal from SwiftUI
 
 
Q