Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: debug fragment/vertex programs

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    4

    debug fragment/vertex programs

    Does anyone know how to debug asm vertex or fragment programs? thanks!

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Dec 2001
    Location
    Wellington, New Zealand
    Posts
    548

    Re: debug fragment/vertex programs

    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.

  3. #3
    Member Regular Contributor
    Join Date
    Jun 2002
    Posts
    371

    Re: debug fragment/vertex programs

    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:

    Code :
     // fp_pbuffer.enable()
     glEnable(..)
     glTransforms()
     ...
     glDrawXXX()
     
     glReadPixels(..)
     // fp_pbuffer.disable()
    And just enable the fp pbuffer when I need to debug the shader.

  4. #4
    Junior Member Newbie
    Join Date
    Mar 2004
    Location
    student
    Posts
    2

    Re: debug fragment/vertex programs

    There's also some debugging capabaility in Mesa, see

    http://freedesktop.org/cgi-bin/viewc...ram_debug.spec

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •