Stepping into functions using GPUTrace

I'm trying to debug some shaders that call functions that are in other files. (Specifically I have a ShadowTerm function that is used by many different shaders.) I can bring up the fragment shader in XCode's GPU debugging, but I don't see a way to step into my function ShadowTerm(). Is there a way to step into functions that are in other .metal files?

Replies

Hey, have you solved the problem yet?

Xcode’s Metal Shader Debugger presents you with the execution of your shader all at once, for multiple threads at a time. This gives you an opportunity to inspect how your code was executed (there is no stepping, the whole execution is available to you at a glance) as well as inspecting the values of neighbor threads. To find out who called a particular function, you can filter for the function’s name in Xcode’s Debug Navigator (panel at the left) which contains the shader’s Execution History. This will narrow down all the places in your code that called that particular function, and allow you to inspect each call’s to that function (input parameters, etc). To learn more about Xcode’s Metal Shader Debugger please check the following WWDC videos:

https://developer.apple.com/documentation/metal/shader_authoring/developing_and_debugging_metal_shaders https://developer.apple.com/videos/play/wwdc2018/608/