Reputation: 371
Let's say that I have a metal shader (Kernel) that only executes if some condition happens. How Can I debug it? I tried unsuccessfully to put a breakpoint after commandBuffer.waitUntilIsScheduled()
when the condition is true and the command buffer with the shader is commited, but the command buffer dosen't appear when I capture the frame...
Any hint?
Upvotes: 2
Views: 304
Reputation: 4376
Metal capture is scoped on a device or a queue. If you try to start capture when the command buffer(s) that contain your "frame" are already being scheduled, you are too late.
Refer to this article Capturing GPU Command Data Programmatically to set up a capture from your code so that you can have more control over it.
Though if you only know the condition after encoding the frame, you would have to find a different approach. For example, try to find if the condition is true before you start encoding your frame. Or start capturing earlier and stop the capture when your condition is true, so the last encoded command buffers will be the ones you are interested in (although capture size will grow substantially each frame).
Upvotes: 2