PDA

View Full Version : How to debug a vertex program



dilectio
08-28-2003, 07:42 PM
I'm using ARB_vertex_program extension in my program. But how do i debug a program?

jra101
08-28-2003, 08:42 PM
Write values you want to debug to the output primary color. This will allow you to visualize the value.

jwatte
08-29-2003, 07:49 AM
Well, if the output position isn't right, then the output color isn't going to show up in the frame buffer.

I suggest starting with a simple multiply by MVP, a 4-instruction program taken from the extension spec. This should work. If it doesn't, try your geometry with the fixed function pipeline as a diagnostic.

Once you have that simple step working, add the next step (say, normals, or texture coordinates, or whatever). Look at the geometry again. Then keep going. Once you have the basic gometry path working, you can put other things (tangent basis, etc) into output color (and turn off texturing) for additional debugging info.

Korval
08-29-2003, 10:12 AM
Unfortunately, there are not good debugging tools avaliable for shaders. Granted, such tools would require a software-renderer in order to work.

kansler
08-30-2003, 01:22 AM
Originally posted by Korval:
Unfortunately, there are not good debugging tools avaliable for shaders. Granted, such tools would require a software-renderer in order to work.

Enter Mesa3D...

jwatte
08-30-2003, 09:34 AM
Actually, the Direct3D RefRast has integration with MS Visual Studio to allow debugging of their shaders.

It's... not fast, though. However, if you're careful about your shaders, porting shaders between the platforms is easy, so this is a possibility if you're really against the wall.

At some point, we'll have GPUs capable of generating interrupts, suspend/resume, restartable instructions, etc, and can treat the GPU just like the second target machine it is. Except the AGP bus is a faster connection than the 38400 baud cable traditionally used for remote debugging :-)

Korval
09-02-2003, 10:00 AM
At some point, we'll have GPUs capable of generating interrupts, suspend/resume, restartable instructions, etc, and can treat the GPU just like the second target machine it is.

Sure... if you spend $4000 on nVidia's special debugging version of their hardware. They certainly aren't going to provide such facilities for free on all their chipsets; space on GPU's is at a premium. That space could have gone to a useful feature or performance optimization.