Mesa (master): mesa: better handling/printing of driver-specific opcodes, register files

Brian Paul brianp at kemper.freedesktop.org
Mon May 11 15:51:32 UTC 2009


Module: Mesa
Branch: master
Commit: 7c2fe42dedcd9f437f2b3fae92963d4c4c56fe03
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c2fe42dedcd9f437f2b3fae92963d4c4c56fe03

Author: Brian Paul <brianp at vmware.com>
Date:   Mon May 11 09:38:32 2009 -0600

mesa: better handling/printing of driver-specific opcodes, register files

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 |    7 +++++--
 src/mesa/shader/prog_print.c       |   11 +++++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c
index ae3a003..44c9619 100644
--- a/src/mesa/shader/prog_instruction.c
+++ b/src/mesa/shader/prog_instruction.c
@@ -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;
+   }
 }
 
diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c
index e6f9a91..de7fef1 100644
--- a/src/mesa/shader/prog_print.c
+++ b/src/mesa/shader/prog_print.c
@@ -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;
    }




More information about the mesa-commit mailing list