I want to check the value inside the shader

Hello, I want to see the values in the shader.

I want to see the value of in.position.xy inside the fragment shader of chapter 7.

Is there any way?

Hi @muzlatte!

Capture the GPU Workload:

Screenshot 2022-09-02 at 10.27.28 am

Locate the draw call:

Screenshot 2022-09-02 at 10.21.43 am

Click the bug icon to start shader debugging:

Screenshot 2022-09-02 at 10.22.35 am

On the window that pops up, make sure you have Fragment not Vertex selected, click on the pixel you want to examine, and click the bug at the bottom right of the window:

Screenshot 2022-09-02 at 10.26.29 am

If everything is working as it should, the debugger will show you the information, so you can see all the values for the selected pixel in the shader.

Screenshot 2022-09-02 at 10.24.45 am

I’m sorry about the delay in answering - I’ve been without internet for a week, but I’m back now.

1 Like

Thank you very much!
This is the answer I desperately wanted.

The book is looking good.
Although graphics programming is difficult, I definitely want to make my own games.

1 Like

For sure - Capture GPU Workload (Metal GPU Debugger) is the most useful tool. The book will point out some its features, but I’d recommend the Apple videos for full coverage.

Graphics programming is hard, but once you’re on the other side of the learning curve, it’ll be worth it! You’ll understand a lot more about how to write games (and other software) and also computer architecture in general.

Keep at it!

1 Like

I’m working really hard. :melting_face:

Thank you :smiley:

1 Like