In Apple's 2018 WWDC session "Metal Shader Debugging and Profiling," the speakers detail what was then a new Metal debug workflow. However, they didn't go very far with compute shaders in the demo, only briefly mentioning the options that would appear when debugging compute kernels and focusing on vertex and fragment shader debugging.
How do we debug compute shaders when we send work to the GPU only once as opposed to every frame?
Please direct me to other WWDC sessions you recommend covering this topic and use of MTLCaptureManager
.
To debug your Metal Compute Kernel functions, you need to create a
CaptureScope
.You do not allocate the scope yourself, but rather retrieve it from the
MTLCaptureManager
:Critical steps to get the custom scope to work:
What I said above, but in code:
Some related WWDCs:
WWDC 2019 - Delivering Optimized Metal Apps and Games
More Info:
Developer Guide - Frame Capture Debugging Tools