mesa: better handling/printing of driver-specific opcodes, register files
authorBrian Paul <brianp@vmware.com>
Mon, 11 May 2009 15:38:32 +0000 (09:38 -0600)
committerBrian Paul <brianp@vmware.com>
Mon, 11 May 2009 15:47:32 +0000 (09:47 -0600)
Drivers such as i965 define extra instruction opcodes and register files.
Improve the program printing code to handle those opcodes/files better.

src/mesa/shader/prog_instruction.c
src/mesa/shader/prog_print.c

index ae3a003feedc3ad546e201007e1c9e41fd386aed..44c961927a382c6532aed5c89443da2d2ae3c732 100644 (file)
@@ -343,7 +343,10 @@ _mesa_opcode_string(gl_inst_opcode opcode)
 {
    if (opcode < MAX_OPCODE)
       return InstInfo[opcode].Name;
-   else
-      return "OP?";
+   else {
+      static char s[20];
+      _mesa_snprintf(s, sizeof(s), "OP%u", opcode);
+      return s;
+   }
 }
 
index e6f9a910690c2c7af57c472474d3f234a2c607d0..de7fef1f861e1c133405fc100b673cb95e6a1fb3 100644 (file)
@@ -75,7 +75,11 @@ file_string(gl_register_file f, gl_prog_print_mode mode)
    case PROGRAM_UNDEFINED:
       return "UNDEFINED";
    default:
-      return "Unknown program file!";
+      {
+         static char s[20];
+         _mesa_snprintf(s, sizeof(s), "FILE%u", f);
+         return s;
+      }
    }
 }
 
@@ -736,7 +740,10 @@ _mesa_fprint_instruction_opt(FILE *f,
                                 mode, prog);
       }
       else {
-         _mesa_fprintf(f, "Other opcode %d\n", inst->Opcode);
+         fprint_alu_instruction(f, inst,
+                                _mesa_opcode_string(inst->Opcode),
+                                3/*_mesa_num_inst_src_regs(inst->Opcode)*/,
+                                mode, prog);
       }
       break;
    }