<div dir="ltr">On 1 July 2013 04:45, Chris Forbes <span dir="ltr"><<a href="mailto:chrisf@ijw.co.nz" target="_blank">chrisf@ijw.co.nz</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Include src0 alpha in the RT write message when using MRT, so it is used<br>
for the alpha test instead of the normal per-RT alpha value.<br>
<br>
Fixes broken rendering in Dota2 under Wine [FDO #62647] -- but not<br>
tested against much else.<br>
<br>
Signed-off-by: Chris Forbes <<a href="mailto:chrisf@ijw.co.nz" target="_blank">chrisf@ijw.co.nz</a>><br></blockquote><div><br><br></div><div>Since there's no other user of key.sample_alpha_to_coverage, I guess I'd prefer to see it renamed to something like key.replicate_alpha, and then in brw_wm_populate_key(), set it to "ctx->DrawBuffer->_NumColorDrawBuffers > 1 && (ctx->Multisample.SampleAlphaToCoverage || ctx->Color.AlphaEnabled)". That will reduce unnecessary recompiles.<br>
<br></div><div>Also it would be nice to have a piglit test for this--it seems like the sort of thing we could easily regress in the future if we're not careful.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
src/mesa/drivers/dri/i965/brw_fs_emit.cpp | 2 +-<br>
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 2 +-<br>
src/mesa/drivers/dri/i965/brw_wm.c | 4 ++++<br>
src/mesa/drivers/dri/i965/brw_wm.h | 1 +<br>
4 files changed, 7 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp<br>
index f390989..10f4c99 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp<br>
@@ -129,7 +129,7 @@ fs_generator::generate_fb_write(fs_inst *inst)<br>
<br>
if (inst->target > 0 &&<br>
c->key.nr_color_regions > 1 &&<br>
- c->key.sample_alpha_to_coverage) {<br>
+ (c->key.sample_alpha_to_coverage || c->key.alpha_test)) {<br>
/* Set "Source0 Alpha Present to RenderTarget" bit in message<br>
* header.<br>
*/<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
index a67b6ed..0c8dc1b 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
@@ -2255,7 +2255,7 @@ fs_visitor::emit_fb_writes()<br>
src0_alpha_to_render_target = intel->gen >= 6 &&<br>
!do_dual_src &&<br>
c->key.nr_color_regions > 1 &&<br>
- c->key.sample_alpha_to_coverage;<br>
+ (c->key.sample_alpha_to_coverage || c->key.alpha_test);<br>
/* m2, m3 header */<br>
nr += 2;<br>
}<br>
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c<br>
index 6eb4a1d..3265596 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_wm.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_wm.c<br>
@@ -279,6 +279,8 @@ brw_wm_debug_recompile(struct brw_context *brw,<br>
old_key->nr_color_regions, key->nr_color_regions);<br>
found |= key_debug(intel, "sample alpha to coverage",<br>
old_key->sample_alpha_to_coverage, key->sample_alpha_to_coverage);<br>
+ found |= key_debug(intel, "MRT alpha test w/a",<br>
+ old_key->alpha_test, key->alpha_test);<br>
found |= key_debug(intel, "rendering to FBO",<br>
old_key->render_to_fbo, key->render_to_fbo);<br>
found |= key_debug(intel, "fragment color clamping",<br>
@@ -463,6 +465,8 @@ static void brw_wm_populate_key( struct brw_context *brw,<br>
key->nr_color_regions = ctx->DrawBuffer->_NumColorDrawBuffers;<br>
/* _NEW_MULTISAMPLE */<br>
key->sample_alpha_to_coverage = ctx->Multisample.SampleAlphaToCoverage;<br>
+ /* _NEW_COLOR */<br>
+ key->alpha_test = ctx->Color.AlphaEnabled;<br>
<br>
/* BRW_NEW_VUE_MAP_GEOM_OUT */<br>
if (intel->gen < 6)<br>
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h<br>
index 28e8734..13b17d0 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_wm.h<br>
+++ b/src/mesa/drivers/dri/i965/brw_wm.h<br>
@@ -63,6 +63,7 @@ struct brw_wm_prog_key {<br>
GLuint flat_shade:1;<br>
GLuint nr_color_regions:5;<br>
GLuint sample_alpha_to_coverage:1;<br>
+ GLuint alpha_test:1;<br>
GLuint render_to_fbo:1;<br>
GLuint clamp_fragment_color:1;<br>
GLuint line_aa:2;<br>
<span><font color="#888888">--<br>
1.8.3.2<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>