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

Ben Widawsky benjamin.widawsky at intel.com
Fri Apr 10 12:52:03 PDT 2015


Based originally on a patch from Ken in May 2014 of the same title. Things
changed enough that I didn't feel comfortable leaving his authorship. Ken, if
you feel you should retain authorship, it's fine with me, just call it
reviewed-by me instead.

Cc: Kenneth Graunke <kenneth at whitecape.org>
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---

Notes:
    Ken, if you feel you should retain authorship, it's fine with me, just call it
    reviewed-by me instead.

 src/mesa/drivers/dri/i965/brw_fs.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 214ba40..72000cf 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1700,6 +1700,9 @@ fs_visitor::emit_math(enum opcode opcode, fs_reg dst, fs_reg src0, fs_reg src1)
 void
 fs_visitor::emit_discard_jump()
 {
+   struct gl_fragment_program *fp = (struct gl_fragment_program *) this->prog;
+   assert(fp->UsesKill);
+
    /* For performance, after a discard, jump to the end of the
     * shader if all relevant channels have been discarded.
     */
@@ -3956,7 +3959,8 @@ fs_visitor::run_fs()
       if (failed)
 	 return false;
 
-      emit(FS_OPCODE_PLACEHOLDER_HALT);
+      if (wm_prog_data->uses_kill)
+         emit(FS_OPCODE_PLACEHOLDER_HALT);
 
       if (wm_key->alpha_test_func)
          emit_alpha_test();
-- 
2.3.5



More information about the mesa-dev mailing list