i965/nir: Make INTEL_DEBUG=ann work with NIR.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 24 Jan 2015 10:05:56 +0000 (02:05 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 11 Apr 2015 19:35:47 +0000 (12:35 -0700)
Now that we store a copy of the NIR shader, and don't immediately free
it, we can use it in annotations as well.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_fs_nir.cpp
src/mesa/drivers/dri/i965/intel_asm_annotation.c

index d6508fc707a67c9a369ef1138ee30467f0309ca4..3972581ef12980e8a0f079a55d04b1275428b49a 100644 (file)
@@ -438,6 +438,8 @@ fs_visitor::nir_emit_block(nir_block *block)
 void
 fs_visitor::nir_emit_instr(nir_instr *instr)
 {
+   this->base_ir = instr;
+
    switch (instr->type) {
    case nir_instr_type_alu:
       nir_emit_alu(nir_instr_as_alu(instr));
@@ -464,6 +466,8 @@ fs_visitor::nir_emit_instr(nir_instr *instr)
    default:
       unreachable("unknown instruction type");
    }
+
+   this->base_ir = NULL;
 }
 
 static brw_reg_type
index ac1265561071c0cd95c30f6839c46d971719e784..eed5756e84afaf48ed97101e88fb78fc5e1247fb 100644 (file)
@@ -29,6 +29,7 @@
 #include "program/prog_print.h"
 #include "program/prog_instruction.h"
 #include "main/macros.h"
+#include "glsl/nir/nir.h"
 
 void
 dump_assembly(void *assembly, int num_annotations, struct annotation *annotation,
@@ -55,7 +56,9 @@ dump_assembly(void *assembly, int num_annotations, struct annotation *annotation
          last_annotation_ir = annotation[i].ir;
          if (last_annotation_ir) {
             fprintf(stderr, "   ");
-            if (!prog->Instructions)
+            if (prog->nir)
+               nir_print_instr(annotation[i].ir, stderr);
+            else if (!prog->Instructions)
                fprint_ir(stderr, annotation[i].ir);
             else {
                const struct prog_instruction *pi =