Mesa (9.2): i965/fs: Gen4-5: Setup discard masks for MRT alpha test

Carl Worth cworth at kemper.freedesktop.org
Fri Dec 13 04:20:45 UTC 2013


Module: Mesa
Branch: 9.2
Commit: 56b0e3271a26d90f760319434ccb518b205dc2bb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=56b0e3271a26d90f760319434ccb518b205dc2bb

Author: Chris Forbes <chrisf at ijw.co.nz>
Date:   Mon Oct 28 04:18:29 2013 +1300

i965/fs: Gen4-5: Setup discard masks for MRT alpha test

The same setup is required here as when the user-provided shader
explicitly uses KIL or discard.

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
Reviewed-by: Eric Anholt <eric at anholt.net>
(cherry picked from commit ca82ba90dd7ef78be2b95972dc19913c76d5e6a8)

---

 src/mesa/drivers/dri/i965/brw_fs.cpp      |    2 +-
 src/mesa/drivers/dri/i965/brw_fs_emit.cpp |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 62dccc1..e96e5ff 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2920,7 +2920,7 @@ fs_visitor::run()
       /* We handle discards by keeping track of the still-live pixels in f0.1.
        * Initialize it with the dispatched pixels.
        */
-      if (fp->UsesKill) {
+      if (fp->UsesKill || c->key.alpha_test_func) {
          fs_inst *discard_init = emit(FS_OPCODE_MOV_DISPATCH_TO_FLAGS);
          discard_init->flag_subreg = 1;
       }
diff --git a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
index 4225922..8b02ea9 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
@@ -107,7 +107,7 @@ fs_generator::generate_fb_write(fs_inst *inst)
    brw_set_mask_control(p, BRW_MASK_DISABLE);
    brw_set_compression_control(p, BRW_COMPRESSION_NONE);
 
-   if (fp->UsesKill) {
+   if (fp->UsesKill || c->key.alpha_test_func) {
       struct brw_reg pixel_mask;
 
       if (brw->gen >= 6)




More information about the mesa-commit mailing list