do I debug a shader?
a shader is a bit complicated because it’s running on the GPU. Typically there’s no easy communication back
to the CPU from the GPU. Shaders don’t provide a “printf” command to output
debugging information to a console.
there are some options:
- In the fragment shader, set the fragment
to a specific colour when a bug occurs (a shader version of “printf”)
- Use transform feedback to debug vertex
- Use a debugging tool like Nvidia Nsight
- There are other tools like Shader
can be used to develop shaders