Module: Mesa
Branch: main
Commit: ea9156edc3624e0aed65d85561d0ef6ade9c2225
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea9156edc3624e0aed65d85561d0ef6ade9c2225

Author: Marek Olšák <[email protected]>
Date:   Sun Mar 12 03:29:18 2023 -0400

nir: return a status from nir_remove_varying whether it removed the instruction

Reviewed-by: Qiang Yu <[email protected]>
Reviewed-by: Timur Kristóf <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21861>

---

 src/compiler/nir/nir.c | 5 ++++-
 src/compiler/nir/nir.h | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index cb6ceb4f671..8c0265f4f1c 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -3495,7 +3495,8 @@ nir_slot_is_sysval_output_and_varying(gl_varying_slot 
slot)
  * This marks the output store instruction as not feeding the next shader
  * stage. If the instruction has no other use, it's removed.
  */
-void nir_remove_varying(nir_intrinsic_instr *intr)
+bool
+nir_remove_varying(nir_intrinsic_instr *intr)
 {
    nir_io_semantics sem = nir_intrinsic_io_semantics(intr);
 
@@ -3504,8 +3505,10 @@ void nir_remove_varying(nir_intrinsic_instr *intr)
       /* Demote the store instruction. */
       sem.no_varying = true;
       nir_intrinsic_set_io_semantics(intr, sem);
+      return false;
    } else {
       nir_instr_remove(&intr->instr);
+      return true;
    }
 }
 
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index d1921dfe768..32f201f9877 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -4782,7 +4782,7 @@ void nir_link_varying_precision(nir_shader *producer, 
nir_shader *consumer);
 bool nir_slot_is_sysval_output(gl_varying_slot slot);
 bool nir_slot_is_varying(gl_varying_slot slot);
 bool nir_slot_is_sysval_output_and_varying(gl_varying_slot slot);
-void nir_remove_varying(nir_intrinsic_instr *intr);
+bool nir_remove_varying(nir_intrinsic_instr *intr);
 void nir_remove_sysval_output(nir_intrinsic_instr *intr);
 
 bool nir_lower_amul(nir_shader *shader,

Reply via email to