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

Author: Jason Ekstrand <[email protected]>
Date:   Fri Jun 29 23:08:05 2018 -0700

nir/print: Print texture and sampler indices

Commit 5fb69daa6076e56b deleted support from nir_print for printing the
texture and sampler indices on texture instructions.  This commit just
brings it back as best as we can.

Reviewed-by: Bas Nieuwenhuizen <[email protected]>

---

 src/compiler/nir/nir_print.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 32839fa4dc..18860db005 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -795,6 +795,7 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
       break;
    }
 
+   bool has_texture_deref = false, has_sampler_deref = false;
    for (unsigned i = 0; i < instr->num_srcs; i++) {
       print_src(&instr->src[i].src, state);
 
@@ -832,9 +833,11 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
          fprintf(fp, "(ddy)");
          break;
       case nir_tex_src_texture_deref:
+         has_texture_deref = true;
          fprintf(fp, "(texture_deref)");
          break;
       case nir_tex_src_sampler_deref:
+         has_sampler_deref = true;
          fprintf(fp, "(sampler_deref)");
          break;
       case nir_tex_src_texture_offset:
@@ -858,6 +861,14 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
    if (instr->op == nir_texop_tg4) {
       fprintf(fp, "%u (gather_component), ", instr->component);
    }
+
+   if (!has_texture_deref) {
+      fprintf(fp, "%u (texture), ", instr->texture_index);
+   }
+
+   if (!has_sampler_deref) {
+      fprintf(fp, "%u (sampler), ", instr->sampler_index);
+   }
 }
 
 static void

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to