Shader Debugger & Source Location

I run my metal app on a capable device (iPhone X) with iOS 12. When I capture the gpu frame during debugging, select geomety from the captured metadata, select a polygon within the metal debugger, then the metal debug button is blue and enabled. Though, when I click on the metal debug button (in this case for a vertex shader), I get a Xcode dialog complaining that it can't find source code for the shader and the metal compiler in build settings should be in debug mode. But the metal compiler is in debug mode.


My default metal library for the device is set to a bundled framework within the main applications bundle. I set my device up like the following:


let shaders = try device.makeDefaultLibrary(bundle: myFrameworkBundle) // works for default.metallib


There are no metal shaders in the main bundle itself -- they reside only within the framework bundled within the app. So, I suspect the metal shader debugger is just defaulting to the main app bundle and not finding anything? Its not looking at the device for a location? I tried adding a build phase to copy the shaders into the framework too but that did not seem to make a difference. Really would be useful to get the debugger working.

Accepted Reply

In my framework project, for the debug build under "Other Metal Compiler Flags", I added the following -gline-tables-only and -MO . That fixed the issue.


Though, the instructions in the alert dialog imply to only do that if your building commandline.

Replies

In my framework project, for the debug build under "Other Metal Compiler Flags", I added the following -gline-tables-only and -MO . That fixed the issue.


Though, the instructions in the alert dialog imply to only do that if your building commandline.