[Mesa-dev] [PATCH 2/2] i965/fs: Only emit FS_OPCODE_PLACEHOLDER_HALT if there are discards.

Kenneth Graunke kenneth at whitecape.org
Tue Aug 12 09:48:25 PDT 2014


It's unnecessary, and makes pattern matching for simple clear programs
more difficult.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_fs.cpp         | 3 ++-
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 3aee822..e79dfc9 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3036,7 +3036,8 @@ fs_visitor::run()
       if (failed)
 	 return false;
 
-      emit(FS_OPCODE_PLACEHOLDER_HALT);
+      if (fp->UsesKill)
+         emit(FS_OPCODE_PLACEHOLDER_HALT);
 
       if (key->alpha_test_func)
          emit_alpha_test();
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index c16401b..3ed6e94 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2061,6 +2061,7 @@ fs_visitor::visit(ir_discard *ir)
       /* For performance, after a discard, jump to the end of the shader.
        * Only jump if all relevant channels have been discarded.
        */
+      assert(fp->UsesKill);
       fs_inst *discard_jump = emit(FS_OPCODE_DISCARD_JUMP);
       discard_jump->flag_subreg = 1;
 
-- 
2.0.2



More information about the mesa-dev mailing list