<div dir="ltr">On 2 July 2013 01:42, 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:0 0 0 .8ex;border-left:1px #ccc solid;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].<br>
<br>
No Piglit regressions on Ivybridge.<br>
<br>
V2: reuse (and simplify) existing sample_alpha_to_coverage flag in<br>
the FS key, rather than adding another redundant one.<br>
<br>
Signed-off-by: Chris Forbes <<a href="mailto:chrisf@ijw.co.nz">chrisf@ijw.co.nz</a>><br></blockquote><div><br></div><div>Reviewd-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
 src/mesa/drivers/dri/i965/brw_fs_emit.cpp    |  4 +---<br>
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |  3 +--<br>
 src/mesa/drivers/dri/i965/brw_wm.c           | 10 ++++++----<br>
 src/mesa/drivers/dri/i965/brw_wm.h           |  2 +-<br>
 4 files changed, 9 insertions(+), 10 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..c158016 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp<br>
@@ -127,9 +127,7 @@ fs_generator::generate_fb_write(fs_inst *inst)<br>
                 retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UD));<br>
         brw_set_compression_control(p, BRW_COMPRESSION_NONE);<br>
<br>
-         if (inst->target > 0 &&<br>
-            c->key.nr_color_regions > 1 &&<br>
-            c->key.sample_alpha_to_coverage) {<br>
+         if (inst->target > 0 && c->key.replicate_alpha) {<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..3353f55 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
@@ -2254,8 +2254,7 @@ fs_visitor::emit_fb_writes()<br>
    if (header_present) {<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.replicate_alpha;<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..5f681f6 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_wm.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_wm.c<br>
@@ -277,8 +277,8 @@ brw_wm_debug_recompile(struct brw_context *brw,<br>
                       old_key->flat_shade, key->flat_shade);<br>
    found |= key_debug(intel, "number of color buffers",<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 or alpha-to-coverage",<br>
+                      old_key->replicate_alpha, key->replicate_alpha);<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>
@@ -461,8 +461,10 @@ static void brw_wm_populate_key( struct brw_context *brw,<br>
<br>
    /* _NEW_BUFFERS */<br>
    key->nr_color_regions = ctx->DrawBuffer->_NumColorDrawBuffers;<br>
-  /* _NEW_MULTISAMPLE */<br>
-   key->sample_alpha_to_coverage = ctx->Multisample.SampleAlphaToCoverage;<br>
+<br>
+   /* _NEW_MULTISAMPLE, _NEW_COLOR, _NEW_BUFFERS */<br>
+   key->replicate_alpha = ctx->DrawBuffer->_NumColorDrawBuffers > 1 &&<br>
+      (ctx->Multisample.SampleAlphaToCoverage || 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..57db27f 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_wm.h<br>
+++ b/src/mesa/drivers/dri/i965/brw_wm.h<br>
@@ -62,7 +62,7 @@ struct brw_wm_prog_key {<br>
    GLuint stats_wm:1;<br>
    GLuint flat_shade:1;<br>
    GLuint nr_color_regions:5;<br>
-   GLuint sample_alpha_to_coverage:1;<br>
+   GLuint replicate_alpha:1;<br>
    GLuint render_to_fbo:1;<br>
    GLuint clamp_fragment_color:1;<br>
    GLuint line_aa:2;<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.3.2<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">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>