Debugging GLSL shaders

I’ve recently began delving into GLSL vertex and fragment shaders. I do all of my development under Linux but I’ve been unable to find a way to debug my shaders other than trying to code a duplicate of my vertex shader in C and stepping through that. Unfortunately, this is more than a bit of a pain in the butt.

Does anyone know of any software products that allow the developer to step through execution of a shader (much like gdb, or similar debuggers)? Baring that, how do you debug your shaders in a Linux development environment?


I’m not aware of a gdb like program that lets you step through a shader. A good debugging method is to render different values and make sure they make sense. So if you have a shader that does lighting, try rendering the normals to make sure they make sense, then render the different components of the colors etc. This method breaks down when you are rendering data to textures that is < 0 or > 1 as they will be clamped and will probably be meaningless to you. However, sometimes you are able to gather generally whether the data is correct or not.

Hope this helps.

The current version of Mesa3D supports GLSL in an early stage. There was a discussion on GLSL shader debugging with Mesa3D but I don’t know if that works with the current release.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.