[prev in list] [next in list] [prev in thread] [next in thread]
List: mesa3d-dev
Subject: [Mesa3d-dev] PRINT instruction for NV_vertex_program
From: Brian Paul <brian.paul () tungstengraphics ! com>
Date: 2004-12-16 3:24:29
Message-ID: 41C0FFED.4090807 () tungstengraphics ! com
[Download RAW message or body]
I've been working through some vertex/fragment program bugs that I
found recently, and as usual, I resorted to adding printf's in the
Mesa code for vertex/fragment program execution in order to figure out
what was going on.
It occured to me that I could add a 'print' instruction to the vertex
program language to make things easer. I just checked in the changes
to do so.
Here's an example. This is the vertex program from
progs/demos/fplight.c with a PRINT instruction:
"!!VP1.0\n"
"# typical modelview/projection transform\n"
"DP4 o[HPOS].x, c[0], v[OPOS] ;\n"
"DP4 o[HPOS].y, c[1], v[OPOS] ;\n"
"DP4 o[HPOS].z, c[2], v[OPOS] ;\n"
"DP4 o[HPOS].w, c[3], v[OPOS] ;\n"
"# transform normal by inv transpose of modelview, put in tex0\n"
"DP3 o[TEX0].x, c[4], v[NRML] ;\n"
"DP3 o[TEX0].y, c[5], v[NRML] ;\n"
"DP3 o[TEX0].z, c[6], v[NRML] ;\n"
"DP3 o[TEX0].w, c[7], v[NRML] ;\n"
"PRINT 'texcoord = ', o[TEX0];\n"
"END\n";
When the program is run you'd see this in stdout:
texcoord = 0, 0, 1, 15
texcoord = 0, 0, 1, 15
texcoord = 0, 0.587785, 0.809017, 12.1353
texcoord = -0.345492, 0.475528, 0.809017, 12.1353
texcoord = -0.559017, 0.181636, 0.809017, 12.1353
[...]
The PRINT instruction operands are a string literal inclosed in single
quotes optionally followed by a register name. It's really simple.
There's no % substitutions like printf.
Of course, this probably isn't suitable for hardware execution but
using software rendering for debugging can be better than nothing.
Eventually, I might also implement this in NV_fragment_program and
ARB_vertex/fragment_program and make it into a real GL extension.
-Brian
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic