Mesa (master): intel/fs: Emit HALT_TARGET in emit_nir_code()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 1 22:26:04 UTC 2020


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

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Thu Nov 19 10:26:44 2020 -0600

intel/fs: Emit HALT_TARGET in emit_nir_code()

Instead of making it a fragment-specific thing based on uses_kill, track
whether or not we need one in fs_visitor and emit HALT_TARGET at the end
of emit_nir_code() if needed.

Reviewed-by: Francisco Jerez <currojerez at riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5071>

---

 src/intel/compiler/brw_fs.cpp     | 14 ++++----------
 src/intel/compiler/brw_fs_nir.cpp |  2 ++
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index 87dd28f23cc..3420028cb60 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -7960,13 +7960,10 @@ fs_visitor::fixup_3src_null_dest()
 static const fs_inst *
 find_halt_control_flow_region_start(const fs_visitor *v)
 {
-   if (v->stage == MESA_SHADER_FRAGMENT &&
-       brw_wm_prog_data(v->prog_data)->uses_kill) {
-      foreach_block_and_inst(block, fs_inst, inst, v->cfg) {
-         if (inst->opcode == BRW_OPCODE_HALT ||
-             inst->opcode == SHADER_OPCODE_HALT_TARGET)
-            return inst;
-      }
+   foreach_block_and_inst(block, fs_inst, inst, v->cfg) {
+      if (inst->opcode == BRW_OPCODE_HALT ||
+          inst->opcode == SHADER_OPCODE_HALT_TARGET)
+         return inst;
    }
 
    return NULL;
@@ -8539,9 +8536,6 @@ fs_visitor::run_fs(bool allow_spilling, bool do_rep_send)
       if (failed)
 	 return false;
 
-      if (wm_prog_data->uses_kill)
-         bld.emit(SHADER_OPCODE_HALT_TARGET);
-
       if (wm_key->alpha_test_func)
          emit_alpha_test();
 
diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp
index 2de1a4c9acb..108d778cae9 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -46,6 +46,8 @@ fs_visitor::emit_nir_code()
    last_scratch = ALIGN(nir->scratch_size, 4) * dispatch_width;
 
    nir_emit_impl(nir_shader_get_entrypoint((nir_shader *)nir));
+
+   bld.emit(SHADER_OPCODE_HALT_TARGET);
 }
 
 void



More information about the mesa-commit mailing list