diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2005-11-05 19:33:13 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2005-11-05 19:33:13 +0000 |
commit | 237dae74f72370523776a3c679b7170248326648 (patch) | |
tree | 5b54f00e5d4b531f955e28e6cd5140969e97aa0b /src | |
parent | bf41bc03c2b461e246658704ba0b38474312cac5 (diff) |
use _mesa_program_file_string() and _mesa_opcode_string()
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/shader/arbfragparse.c | 106 | ||||
-rw-r--r-- | src/mesa/shader/arbvertparse.c | 79 |
2 files changed, 50 insertions, 135 deletions
diff --git a/src/mesa/shader/arbfragparse.c b/src/mesa/shader/arbfragparse.c index a4470cbcb1..296553b269 100644 --- a/src/mesa/shader/arbfragparse.c +++ b/src/mesa/shader/arbfragparse.c @@ -43,95 +43,27 @@ void _mesa_debug_fp_inst(GLint num, struct prog_instruction *fp) { GLint a; - - static const char *opcode_string[] = { - "ABS", /* ARB_f_p only */ - "ADD", - "CMP", /* ARB_f_p only */ - "COS", - "DDX", /* NV_f_p only */ - "DDY", /* NV_f_p only */ - "DP3", - "DP4", - "DPH", /* ARB_f_p only */ - "DST", - "END", /* private opcode */ - "EX2", - "FLR", - "FRC", - "KIL", /* ARB_f_p only */ - "KIL_NV", /* NV_f_p only */ - "LG2", - "LIT", - "LRP", - "MAD", - "MAX", - "MIN", - "MOV", - "MUL", - "PK2H", /* NV_f_p only */ - "PK2US", /* NV_f_p only */ - "PK4B", /* NV_f_p only */ - "PK4UB", /* NV_f_p only */ - "POW", - "PRINT", /* Mesa only */ - "RCP", - "RFL", /* NV_f_p only */ - "RSQ", - "SCS", /* ARB_f_p only */ - "SEQ", /* NV_f_p only */ - "SFL", /* NV_f_p only */ - "SGE", /* NV_f_p only */ - "SGT", /* NV_f_p only */ - "SIN", - "SLE", /* NV_f_p only */ - "SLT", - "SNE", /* NV_f_p only */ - "STR", /* NV_f_p only */ - "SUB", - "SWZ", /* ARB_f_p only */ - "TEX", - "TXB", /* ARB_f_p only */ - "TXD", /* NV_f_p only */ - "TXP", /* ARB_f_p only */ - "TXP_NV", /* NV_f_p only */ - "UP2H", /* NV_f_p only */ - "UP2US", /* NV_f_p only */ - "UP4B", /* NV_f_p only */ - "UP4UB", /* NV_f_p only */ - "X2D", /* NV_f_p only - 2d mat mul */ - "XPD", /* ARB_f_p only - cross product */ - }; - - static const char *file_string[] = { - "TEMP", - "INPUT", - "OUTPUT", - "LOCAL", - "ENV", - "NAMED", - "STATE", - "WRITE_ONLY", - "ADDR" - }; - static const char swz[] = "xyzw01??"; for (a=0; a<num; a++) { - _mesa_printf("%s", opcode_string[fp[a].Opcode]); + _mesa_printf("%s", _mesa_opcode_string(fp[a].Opcode)); if (fp[a].Saturate) _mesa_printf("_SAT"); if (fp[a].DstReg.File != 0xf) { if (fp[a].DstReg.WriteMask != 0xf) - _mesa_printf(" %s[%d].%s%s%s%s ", file_string[fp[a].DstReg.File], fp[a].DstReg.Index, + _mesa_printf(" %s[%d].%s%s%s%s ", + _mesa_program_file_string(fp[a].DstReg.File), + fp[a].DstReg.Index, GET_BIT(fp[a].DstReg.WriteMask, 0) ? "x" : "", GET_BIT(fp[a].DstReg.WriteMask, 1) ? "y" : "", GET_BIT(fp[a].DstReg.WriteMask, 2) ? "z" : "", GET_BIT(fp[a].DstReg.WriteMask, 3) ? "w" : ""); else - _mesa_printf(" %s[%d] ", file_string[fp[a].DstReg.File], fp[a].DstReg.Index); + _mesa_printf(" %s[%d] ", + _mesa_program_file_string(fp[a].DstReg.File), + fp[a].DstReg.Index); } /* Examine each bit of negatebase here as this may be a SWZ instruction @@ -139,7 +71,9 @@ _mesa_debug_fp_inst(GLint num, struct prog_instruction *fp) if (fp[a].SrcReg[0].File != 0xf) { if (fp[a].SrcReg[0].Swizzle != SWIZZLE_NOOP || fp[a].SrcReg[0].NegateBase) - _mesa_printf("%s[%d].%s%c%s%c%s%c%s%c ", file_string[fp[a].SrcReg[0].File], fp[a].SrcReg[0].Index, + _mesa_printf("%s[%d].%s%c%s%c%s%c%s%c ", + _mesa_program_file_string(fp[a].SrcReg[0].File), + fp[a].SrcReg[0].Index, GET_BIT(fp[a].SrcReg[0].NegateBase, 0) ? "-" : "", swz[GET_SWZ(fp[a].SrcReg[0].Swizzle, 0)], GET_BIT(fp[a].SrcReg[0].NegateBase, 0) ? "-" : "", @@ -149,33 +83,43 @@ _mesa_debug_fp_inst(GLint num, struct prog_instruction *fp) GET_BIT(fp[a].SrcReg[0].NegateBase, 0) ? "-" : "", swz[GET_SWZ(fp[a].SrcReg[0].Swizzle, 3)]); else - _mesa_printf("%s[%d] ", file_string[fp[a].SrcReg[0].File], fp[a].SrcReg[0].Index); + _mesa_printf("%s[%d] ", + _mesa_program_file_string(fp[a].SrcReg[0].File), + fp[a].SrcReg[0].Index); } if (fp[a].SrcReg[1].File != 0xf) { if (fp[a].SrcReg[1].Swizzle != SWIZZLE_NOOP || fp[a].SrcReg[1].NegateBase) - _mesa_printf("%s[%d].%s%c%c%c%c ", file_string[fp[a].SrcReg[1].File], fp[a].SrcReg[1].Index, + _mesa_printf("%s[%d].%s%c%c%c%c ", + _mesa_program_file_string(fp[a].SrcReg[1].File), + fp[a].SrcReg[1].Index, fp[a].SrcReg[1].NegateBase ? "-" : "", swz[GET_SWZ(fp[a].SrcReg[1].Swizzle, 0)], swz[GET_SWZ(fp[a].SrcReg[1].Swizzle, 1)], swz[GET_SWZ(fp[a].SrcReg[1].Swizzle, 2)], swz[GET_SWZ(fp[a].SrcReg[1].Swizzle, 3)]); else - _mesa_printf("%s[%d] ", file_string[fp[a].SrcReg[1].File], fp[a].SrcReg[1].Index); + _mesa_printf("%s[%d] ", + _mesa_program_file_string(fp[a].SrcReg[1].File), + fp[a].SrcReg[1].Index); } if (fp[a].SrcReg[2].File != 0xf) { if (fp[a].SrcReg[2].Swizzle != SWIZZLE_NOOP || fp[a].SrcReg[2].NegateBase) - _mesa_printf("%s[%d].%s%c%c%c%c ", file_string[fp[a].SrcReg[2].File], fp[a].SrcReg[2].Index, + _mesa_printf("%s[%d].%s%c%c%c%c ", + _mesa_program_file_string(fp[a].SrcReg[2].File), + fp[a].SrcReg[2].Index, fp[a].SrcReg[1].NegateBase ? "-" : "", swz[GET_SWZ(fp[a].SrcReg[2].Swizzle, 0)], swz[GET_SWZ(fp[a].SrcReg[2].Swizzle, 1)], swz[GET_SWZ(fp[a].SrcReg[2].Swizzle, 2)], swz[GET_SWZ(fp[a].SrcReg[2].Swizzle, 3)]); else - _mesa_printf("%s[%d] ", file_string[fp[a].SrcReg[2].File], fp[a].SrcReg[2].Index); + _mesa_printf("%s[%d] ", + _mesa_program_file_string(fp[a].SrcReg[2].File), + fp[a].SrcReg[2].Index); } _mesa_printf("\n"); diff --git a/src/mesa/shader/arbvertparse.c b/src/mesa/shader/arbvertparse.c index 1cc2384fb5..27bdaff1c2 100644 --- a/src/mesa/shader/arbvertparse.c +++ b/src/mesa/shader/arbvertparse.c @@ -52,104 +52,75 @@ void _mesa_debug_vp_inst(GLint num, struct prog_instruction *vp) { GLint a; - static const char *opcode_string[] = { - "ABS", - "ADD", - "ARL", - "DP3", - "DP4", - "DPH", - "DST", - "END", /* Placeholder */ - "EX2", /* ARB only */ - "EXP", - "FLR", /* ARB */ - "FRC", /* ARB */ - "LG2", /* ARB only */ - "LIT", - "LOG", - "MAD", - "MAX", - "MIN", - "MOV", - "MUL", - "POW", /* ARB only */ - "PRINT", /* Mesa only */ - "RCC", - "RCP", - "RSQ", - "SGE", - "SLT", - "SUB", - "SWZ", /* ARB only */ - "XPD" /* ARB only */ - }; - - static const char *file_string[] = { - "TEMP", - "INPUT", - "OUTPUT", - "LOCAL", - "ENV", - "NAMED", - "STATE", - "WRITE_ONLY", - "ADDR" - }; - static const char swz[] = "xyzw01??"; for (a=0; a<num; a++) { - _mesa_printf("%s", opcode_string[vp[a].Opcode]); + _mesa_printf("%s", _mesa_opcode_string(vp[a].Opcode)); if (vp[a].DstReg.File != 0xf) { if (vp[a].DstReg.WriteMask != 0xf) - _mesa_printf(" %s[%d].%s%s%s%s ", file_string[vp[a].DstReg.File], vp[a].DstReg.Index, + _mesa_printf(" %s[%d].%s%s%s%s ", + _mesa_program_file_string(vp[a].DstReg.File), + vp[a].DstReg.Index, GET_BIT(vp[a].DstReg.WriteMask, 0) ? "x" : "", GET_BIT(vp[a].DstReg.WriteMask, 1) ? "y" : "", GET_BIT(vp[a].DstReg.WriteMask, 2) ? "z" : "", GET_BIT(vp[a].DstReg.WriteMask, 3) ? "w" : ""); else - _mesa_printf(" %s[%d] ", file_string[vp[a].DstReg.File], vp[a].DstReg.Index); + _mesa_printf(" %s[%d] ", + _mesa_program_file_string(vp[a].DstReg.File), + vp[a].DstReg.Index); } if (vp[a].SrcReg[0].File != 0xf) { if (vp[a].SrcReg[0].Swizzle != SWIZZLE_NOOP || vp[a].SrcReg[0].NegateBase) - _mesa_printf("%s[%d].%s%c%c%c%c ", file_string[vp[a].SrcReg[0].File], vp[a].SrcReg[0].Index, + _mesa_printf("%s[%d].%s%c%c%c%c ", + _mesa_program_file_string(vp[a].SrcReg[0].File), + vp[a].SrcReg[0].Index, vp[a].SrcReg[0].NegateBase ? "-" : "", swz[GET_SWZ(vp[a].SrcReg[0].Swizzle, 0)], swz[GET_SWZ(vp[a].SrcReg[0].Swizzle, 1)], swz[GET_SWZ(vp[a].SrcReg[0].Swizzle, 2)], swz[GET_SWZ(vp[a].SrcReg[0].Swizzle, 3)]); else - _mesa_printf("%s[%d] ", file_string[vp[a].SrcReg[0].File], vp[a].SrcReg[0].Index); + _mesa_printf("%s[%d] ", + _mesa_program_file_string(vp[a].SrcReg[0].File), + vp[a].SrcReg[0].Index); } if (vp[a].SrcReg[1].File != 0xf) { if (vp[a].SrcReg[1].Swizzle != SWIZZLE_NOOP || vp[a].SrcReg[1].NegateBase) - _mesa_printf("%s[%d].%s%c%c%c%c ", file_string[vp[a].SrcReg[1].File], vp[a].SrcReg[1].Index, + _mesa_printf("%s[%d].%s%c%c%c%c ", + _mesa_program_file_string(vp[a].SrcReg[1].File), + vp[a].SrcReg[1].Index, vp[a].SrcReg[1].NegateBase ? "-" : "", swz[GET_SWZ(vp[a].SrcReg[1].Swizzle, 0)], swz[GET_SWZ(vp[a].SrcReg[1].Swizzle, 1)], swz[GET_SWZ(vp[a].SrcReg[1].Swizzle, 2)], swz[GET_SWZ(vp[a].SrcReg[1].Swizzle, 3)]); else - _mesa_printf("%s[%d] ", file_string[vp[a].SrcReg[1].File], vp[a].SrcReg[1].Index); + _mesa_printf("%s[%d] ", + _mesa_program_file_string(vp[a].SrcReg[1].File), + vp[a].SrcReg[1].Index); } if (vp[a].SrcReg[2].File != 0xf) { if (vp[a].SrcReg[2].Swizzle != SWIZZLE_NOOP || vp[a].SrcReg[2].NegateBase) - _mesa_printf("%s[%d].%s%c%c%c%c ", file_string[vp[a].SrcReg[2].File], vp[a].SrcReg[2].Index, + _mesa_printf("%s[%d].%s%c%c%c%c ", + _mesa_program_file_string(vp[a].SrcReg[2].File), + vp[a].SrcReg[2].Index, vp[a].SrcReg[2].NegateBase ? "-" : "", swz[GET_SWZ(vp[a].SrcReg[2].Swizzle, 0)], swz[GET_SWZ(vp[a].SrcReg[2].Swizzle, 1)], swz[GET_SWZ(vp[a].SrcReg[2].Swizzle, 2)], swz[GET_SWZ(vp[a].SrcReg[2].Swizzle, 3)]); else - _mesa_printf("%s[%d] ", file_string[vp[a].SrcReg[2].File], vp[a].SrcReg[2].Index); + _mesa_printf("%s[%d] ", + _mesa_program_file_string(vp[a].SrcReg[2].File), + vp[a].SrcReg[2].Index); } _mesa_printf("\n"); |