mesa: when printing src regs, use |reg| for absolute value

And check opcode number to avoid crashing on driver-private opcodes.
This commit is contained in:
Brian Paul
2009-03-05 17:14:05 -07:00
parent ee41bb2ed0
commit f787baff80

View File

@@ -458,11 +458,15 @@ fprint_src_reg(FILE *f,
gl_prog_print_mode mode, gl_prog_print_mode mode,
const struct gl_program *prog) const struct gl_program *prog)
{ {
_mesa_fprintf(f, "%s%s", const char *abs = srcReg->Abs ? "|" : "";
_mesa_fprintf(f, "%s%s%s%s",
abs,
reg_string((enum register_file) srcReg->File, reg_string((enum register_file) srcReg->File,
srcReg->Index, mode, srcReg->RelAddr, prog), srcReg->Index, mode, srcReg->RelAddr, prog),
_mesa_swizzle_string(srcReg->Swizzle, _mesa_swizzle_string(srcReg->Swizzle,
srcReg->NegateBase, GL_FALSE)); srcReg->NegateBase, GL_FALSE),
abs);
#if 0 #if 0
_mesa_fprintf(f, "%s[%d]%s", _mesa_fprintf(f, "%s[%d]%s",
file_string((enum register_file) srcReg->File, mode), file_string((enum register_file) srcReg->File, mode),
@@ -724,11 +728,16 @@ _mesa_fprint_instruction_opt(FILE *f,
break; break;
/* XXX may need other special-case instructions */ /* XXX may need other special-case instructions */
default: default:
/* typical alu instruction */ if (inst->Opcode < MAX_OPCODE) {
fprint_alu_instruction(f, inst, /* typical alu instruction */
_mesa_opcode_string(inst->Opcode), fprint_alu_instruction(f, inst,
_mesa_num_inst_src_regs(inst->Opcode), _mesa_opcode_string(inst->Opcode),
mode, prog); _mesa_num_inst_src_regs(inst->Opcode),
mode, prog);
}
else {
_mesa_fprintf(f, "Other opcode %d\n", inst->Opcode);
}
break; break;
} }
return indent; return indent;