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 <kenn...@whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp         | 4 ++++
 src/mesa/drivers/dri/i965/intel_asm_annotation.c | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index ccffd5d..b067735 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -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
diff --git a/src/mesa/drivers/dri/i965/intel_asm_annotation.c 
b/src/mesa/drivers/dri/i965/intel_asm_annotation.c
index ac12655..eed5756 100644
--- a/src/mesa/drivers/dri/i965/intel_asm_annotation.c
+++ b/src/mesa/drivers/dri/i965/intel_asm_annotation.c
@@ -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 =
-- 
2.3.5

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to