added _mesa_print_nv_vertex_instruction()

This commit is contained in:
Brian Paul
2003-03-29 16:38:08 +00:00
parent 52334967ed
commit 29af3b2be6
2 changed files with 26 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: nvvertparse.c,v 1.4 2003/03/14 15:40:59 brianp Exp $ */ /* $Id: nvvertparse.c,v 1.5 2003/03/29 16:38:08 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -1291,7 +1291,7 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget,
program->OutputsWritten = parseState.outputsWritten; program->OutputsWritten = parseState.outputsWritten;
program->IsPositionInvariant = parseState.isPositionInvariant; program->IsPositionInvariant = parseState.isPositionInvariant;
#ifdef DEBUG_foo #ifdef DEBUG
_mesa_printf("--- glLoadProgramNV result ---\n"); _mesa_printf("--- glLoadProgramNV result ---\n");
_mesa_print_nv_vertex_program(program); _mesa_print_nv_vertex_program(program);
_mesa_printf("------------------------------\n"); _mesa_printf("------------------------------\n");
@@ -1394,15 +1394,12 @@ PrintDstReg(const struct vp_dst_register *dst)
/** /**
* Print (unparse) the given vertex program. Just for debugging. * Print a single NVIDIA vertex program instruction.
*/ */
void void
_mesa_print_nv_vertex_program(const struct vertex_program *program) _mesa_print_nv_vertex_instruction(const struct vp_instruction *inst)
{ {
const struct vp_instruction *inst; switch (inst->Opcode) {
for (inst = program->Instructions; ; inst++) {
switch (inst->Opcode) {
case VP_OPCODE_MOV: case VP_OPCODE_MOV:
case VP_OPCODE_LIT: case VP_OPCODE_LIT:
case VP_OPCODE_RCP: case VP_OPCODE_RCP:
@@ -1454,10 +1451,25 @@ _mesa_print_nv_vertex_program(const struct vertex_program *program)
break; break;
case VP_OPCODE_END: case VP_OPCODE_END:
_mesa_printf("END\n"); _mesa_printf("END\n");
return; break;
default: default:
_mesa_printf("BAD INSTRUCTION\n"); _mesa_printf("BAD INSTRUCTION\n");
} }
}
/**
* Print (unparse) the given vertex program. Just for debugging.
*/
void
_mesa_print_nv_vertex_program(const struct vertex_program *program)
{
const struct vp_instruction *inst;
for (inst = program->Instructions; ; inst++) {
_mesa_print_nv_vertex_instruction(inst);
if (inst->Opcode == VP_OPCODE_END)
return;
} }
} }

View File

@@ -1,10 +1,10 @@
/* $Id: nvvertparse.h,v 1.1 2003/01/14 04:55:46 brianp Exp $ */ /* $Id: nvvertparse.h,v 1.2 2003/03/29 16:38:08 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 5.1 * Version: 5.1
* *
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -37,6 +37,8 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum target,
const GLubyte *str, GLsizei len, const GLubyte *str, GLsizei len,
struct vertex_program *program); struct vertex_program *program);
extern void
_mesa_print_nv_vertex_instruction(const struct vp_instruction *inst);
extern void extern void
_mesa_print_nv_vertex_program(const struct vertex_program *program); _mesa_print_nv_vertex_program(const struct vertex_program *program);