Debugging the output of vertex shaders

In the Metal 2 Optimization and Debugging session at 11:37 we can see that not just the input, but the output of a vertex shaders is being debugged.

https://developer.apple.com/videos/play/wwdc2017/607/


This seems like the most magical thing ever, but I cannot replicate it. What does this behaviour depend on? I'm on High Sierra with a Hashwell CPU / integrated graphics.


Does this feature require using argument buffers? Does it work on my Hashwell computer (MacBook Pro (Retina, 15-inch, Late 2013), or on an iPhone SE?

Replies

You can only view vertex shader outputs if your shader has a parameter using the [[stage_in]] qualifier.


If your shader is using the [[stage_in]] qualifier you can view the buffer outputs by A) performing a GPU Capture and then B) selecting "Vertex Attributes" in resources view when your draw call is selected in the capture. You can can see the outputs in right most columns (you may need to scroll horizontally)

So if I understand right, this requires using VertexDescriptors.

What happens when I do instanced rendering with

drawPrimitives(...., instanceCount: )


It'd create multiple value per line, wouldn't it?

My fragment shader uses the stage_in qualifier, but I do not see a "Vertex Attributes" in the resources view like your picture shows.

Your vertex shader (not fragment shader) must to use the stage_in qualifier (thus your pipeline needs to use a vertex descriptor to specify the layout of vertices input to the vertex shader).

I think instancing will just multiply the number of lines: (Num Lines) = (Num Instances) * (Num Verticies per Instance)

ugh. Okay, thanks for letting me know...