Advertisement

Vertex/Fragment Program Debugger?

Started by November 07, 2004 05:33 AM
8 comments, last by L0rdDiabl0 20 years ago
Anybody know of a good debugger that can work with Vertex/Fragment Programs? Its really hard to find where the Error is in those programs without debugging and going through it step by step.
Bump
Advertisement
NVIDIA has a tool for doing that in Direct3D.
They stated explicitly that no such tool existed for OpenGL (at least, not from them) and that they had no plan on doing this for OpenGL in the short run.
It's not really a debugger, but do you know that you can print the compiler output to e.g. the stdout or in a text file? This is very useful for finding syntax errors etc., but it doesn't help you finding algorithm errors.

Thanks for the response guys
Lutz : How can i print the compiler(shader) output? it would be better than nothing.

I found such program, its called shadesmith http://graphics.stanford.edu/projects/shadesmith/ but its so buggy like it crashes all the time and work only on ARB_FRAGMENT_PROGRAM and NV_FRAGMENT_PROGRAM.

btw. Thanks vincoof for the great program (Cel-Shading) its the best Tutorial on Vertex/Fragment Programs
Oh, I was talking about CG.
I don't know if you're using it...

Put this at the beginning of your CG startup routine:
cgSetErrorCallback(cgErrorCallback);// Create CG context and profiles, load programs and so on...


The error callback function could look like this:
void cgErrorCallback(){  // Get error strings  CGerror Error = cgGetError();  const char* errorString = cgGetErrorString(Error);	  // Print error strings  printf("\n%s\n", errorString);  printf("Compiler output: %s", cgGetLastListing(cgContext));  // Terminate program  exit(0);}

Advertisement
Sorry but i'm not using CG just plain ARB vp/fp extensions.
Thanks for your help anyway.
Actually when I want to debug a program, I do it by hand. That is, I cut the shader where I want to test a value, and I output this value in the color output. It's pretty annoying because you need to recompile your program everytime (or have lots of shaders hanging out there) and this method is limited to checking values in the [0,1] range. Anyway that's the only way I found, so...
I was just about to suggest what vincoof just said. Thats the standard way to go about things, if you have the ability to reload the shader while previewing it, this can be quite efficient.

Other than that, as mentioned, only Direct3D offers a proper shader debugger, and naturally you can only use it with the reference rasterizer, which doesn't make it all that efficient or usable.
Thanks for the Suggestions guys, guess i'll have to do it by hand

This topic is closed to new replies.

Advertisement