diff options
author | Brian Paul <[email protected]> | 2004-12-16 03:07:18 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2004-12-16 03:07:18 +0000 |
commit | 575700fbdcdde9c31ee6ccdd0369604b8ee2df91 (patch) | |
tree | 2bc35036e7f335f2dfa7211334108ce8bd34fbb3 /src/mesa/shader/nvvertexec.c | |
parent | c75900e7a2ad17ecf832e7e9aa41e714a1a78f2a (diff) |
Experimental PRINT instruction for NV_vertex_program.
Basically, this lets you put a "PRINT 'mesage', register;" statement in a
vertex program to aid in debugging.
Diffstat (limited to 'src/mesa/shader/nvvertexec.c')
-rw-r--r-- | src/mesa/shader/nvvertexec.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/mesa/shader/nvvertexec.c b/src/mesa/shader/nvvertexec.c index 269c4c93d8c..064a7f020b9 100644 --- a/src/mesa/shader/nvvertexec.c +++ b/src/mesa/shader/nvvertexec.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.1 + * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * @@ -249,6 +249,10 @@ get_register_pointer( const struct vp_src_register *source, case PROGRAM_INPUT: ASSERT(source->Index < MAX_NV_VERTEX_PROGRAM_INPUTS); return state->Inputs[source->Index]; + case PROGRAM_OUTPUT: + /* This is only needed for the PRINT instruction */ + ASSERT(source->Index < MAX_NV_VERTEX_PROGRAM_OUTPUTS); + return state->Outputs[source->Index]; case PROGRAM_LOCAL_PARAM: ASSERT(source->Index < MAX_PROGRAM_LOCAL_PARAMS); return state->Current->Base.LocalParams[source->Index]; @@ -774,7 +778,17 @@ _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program) store_vector4( &inst->DstReg, state, result ); } break; - + case VP_OPCODE_PRINT: + if (inst->SrcReg[0].File) { + GLfloat t[4]; + fetch_vector4( &inst->SrcReg[0], state, t ); + _mesa_printf("%s%g, %g, %g, %g\n", + (char *) inst->Data, t[0], t[1], t[2], t[3]); + } + else { + _mesa_printf("%s\n", (char *) inst->Data); + } + break; case VP_OPCODE_END: ctx->_CurrentProgram = 0; return; |