Post

Replies

Boosts

Views

Activity

Reply to Debug symbols in metallib
As promised, here's the result of using spirv-cross to get the shader symbols. A few caveats first, I can't get the original source shader to show up, it seems to be the intermediate result from the HLSL -> SPIR-V compilation. I'll bring this up with the DXC repository directly. So tested toolchain is: HLSL -> SPIRV -> AIR -> METALLIB, here's an example of a script to compile a pixel shader: dxc -T ps_6_0 -E PSMain -spirv shaders/triangle.hlsl -Zi -Qembed_debug -O0 -Fo shaders/triangle.frag.spirv spirv-cross --msl shaders/triangle.frag.spirv --output shaders/triangle.frag.metal xcrun -sdk macosx metal -c -frecord-sources shaders/triangle.frag.metal -o shaders/triangle.frag.air xcrun -sdk macosx metallib shaders/triangle.frag.air -o shaders/triangle.frag.metallib As you can see, it's a lot more steps than metal shader converter, but after all those steps you can get some sort of shader symbols in xcode when debugging a metal frame, which is better than nothing: Please let me know if I can provide files, projects or anything that can help supporting shader symbols directly with metal shader converter. Cheers, Alex
Jun ’23
Reply to Debug symbols in metallib
@Alecazam that's the whole point of my post, right now Metal Shader Converter doesn't produce any kind of debug information, it's completely stripped out, making debugging the shaders or profiling them impossible in its current state. The only workaround I have right now is the one I've outlined in my 1st answer, to use spir-v cross, with the caveats outlined (spir-v looking debug info, etc.)
Jan ’24