i965/fs: Gen4-5: Setup discard masks for MRT alpha test
authorChris Forbes <chrisf@ijw.co.nz>
Sun, 27 Oct 2013 15:18:29 +0000 (04:18 +1300)
committerChris Forbes <chrisf@ijw.co.nz>
Wed, 6 Nov 2013 06:29:49 +0000 (19:29 +1300)
The same setup is required here as when the user-provided shader
explicitly uses KIL or discard.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs_generator.cpp

index c332d4cbb539ea2e3156b0f27baa0dd8d5a38f18..cd806c77c413af68e2c5cb7065d35ebee28ebe46 100644 (file)
@@ -3228,7 +3228,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;
       }
index 63ac53062b2316afe2450ac4920c0d19ac2397a9..6678553ee2541147297793673a377b0ebd7f55aa 100644 (file)
@@ -116,7 +116,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)