summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_fs.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2011-03-11 17:39:49 -0800
committerEric Anholt <eric@anholt.net>2011-03-15 10:14:52 -0700
commita99447314ca1cfce60f2a22285398fb222b2a440 (patch)
tree9bc21c28358c9086276979c0bf59b390c327be42 /src/mesa/drivers/dri/i965/brw_fs.cpp
parentb60651a17ba85af14e9d7b9a1398e065adb58665 (diff)
i965: Fix alpha testing when there is no color buffer in the FBO.
We were alpha testing against an unwritten value, resulting in garbage. (part of) Bug #35073.
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 7329f309f0..2c997b4eb3 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2140,6 +2140,17 @@ fs_visitor::emit_fb_writes()
}
if (c->key.nr_color_regions == 0) {
+ if (c->key.alpha_test && (this->frag_color || this->frag_data)) {
+ /* If the alpha test is enabled but there's no color buffer,
+ * we still need to send alpha out the pipeline to our null
+ * renderbuffer.
+ */
+ color.reg_offset += 3;
+ emit(fs_inst(BRW_OPCODE_MOV,
+ fs_reg(MRF, color_mrf + 3),
+ color));
+ }
+
fs_inst *inst = emit(fs_inst(FS_OPCODE_FB_WRITE,
reg_undef, reg_undef));
inst->base_mrf = 0;