PDA

View Full Version : debug fragment/vertex programs



laniik
03-25-2004, 12:40 PM
Does anyone know how to debug asm vertex or fragment programs? thanks!

OneSadCookie
03-25-2004, 02:16 PM
You can debug vertex programs on a Macintosh -- there is a tool called "OpenGL Shader Builder" which lets you step through the shader instruction-by-instruction.

The only way I've found to debug a fragment program is to stop it part-way through processing and output an intermediate result as the color. Then, based on the color, you can get some idea of what kinds of values you have. Very, very tedious, though.

roffe
03-26-2004, 04:41 PM
The only addition I have to OneSadCookie's post is that you may want to use floating point render targets(only pbuffers for now) while 'debugging' instead of your regular 32bit framebuffer. The reason for this is clamping. The floating point buffer doesn't clamp[0.0-1.0] color values, which can really help at times. However, if your intermediate values are always in the [0-1] range using an fp buffer wont help much.

When I debug shader code I usually use blocks like these:


// fp_pbuffer.enable()
glEnable(..)
glTransforms()
...
glDrawXXX()

glReadPixels(..)
// fp_pbuffer.disable()And just enable the fp pbuffer when I need to debug the shader.

karl rasche
03-29-2004, 03:28 AM
There's also some debugging capabaility in Mesa, see

http://freedesktop.org/cgi-bin/viewcvs.cgi/mesa/Mesa/docs/MESA_program_debug.spec