Can we pretend this came from Chris so it can be applied sooner rather than later ? :)
Include src0 alpha in the RT write message when using MRT, so it is used for the alpha test instead of the normal per-RT alpha value. No Piglit regressions on Ivybridge. V2: reuse (and simplify) existing sample_alpha_to_coverage flag in the FS key, rather than adding another redundant one. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62647 NOTE: This is a candidate for the stable branches. Signed-off-by: Chris Forbes <chrisf at ijw.co.nz> --- src/mesa/drivers/dri/i965/brw_fs_emit.cpp | 4 +--- src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 3 +-- src/mesa/drivers/dri/i965/brw_wm.c | 10 ++++++---- src/mesa/drivers/dri/i965/brw_wm.h | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp index f390989..c158016 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp @@ -127,9 +127,7 @@ fs_generator::generate_fb_write(fs_inst *inst) retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UD)); brw_set_compression_control(p, BRW_COMPRESSION_NONE); - if (inst->target > 0 && - c->key.nr_color_regions > 1 && - c->key.sample_alpha_to_coverage) { + if (inst->target > 0 && c->key.replicate_alpha) { /* Set "Source0 Alpha Present to RenderTarget" bit in message * header. */ diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index a67b6ed..3353f55 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -2254,8 +2254,7 @@ fs_visitor::emit_fb_writes() if (header_present) { src0_alpha_to_render_target = intel->gen >= 6 && !do_dual_src && - c->key.nr_color_regions > 1 && - c->key.sample_alpha_to_coverage; + c->key.replicate_alpha; /* m2, m3 header */ nr += 2; } diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 6eb4a1d..5f681f6 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -277,8 +277,8 @@ brw_wm_debug_recompile(struct brw_context *brw, old_key->flat_shade, key->flat_shade); found |= key_debug(intel, "number of color buffers", old_key->nr_color_regions, key->nr_color_regions); - found |= key_debug(intel, "sample alpha to coverage", - old_key->sample_alpha_to_coverage, key->sample_alpha_to_coverage); + found |= key_debug(intel, "MRT alpha test or alpha-to-coverage", + old_key->replicate_alpha, key->replicate_alpha); found |= key_debug(intel, "rendering to FBO", old_key->render_to_fbo, key->render_to_fbo); found |= key_debug(intel, "fragment color clamping", @@ -461,8 +461,10 @@ static void brw_wm_populate_key( struct brw_context *brw, /* _NEW_BUFFERS */ key->nr_color_regions = ctx->DrawBuffer->_NumColorDrawBuffers; - /* _NEW_MULTISAMPLE */ - key->sample_alpha_to_coverage = ctx->Multisample.SampleAlphaToCoverage; + + /* _NEW_MULTISAMPLE, _NEW_COLOR, _NEW_BUFFERS */ + key->replicate_alpha = ctx->DrawBuffer->_NumColorDrawBuffers > 1 && + (ctx->Multisample.SampleAlphaToCoverage || ctx->Color.AlphaEnabled); /* BRW_NEW_VUE_MAP_GEOM_OUT */ if (intel->gen < 6) diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 28e8734..57db27f 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -62,7 +62,7 @@ struct brw_wm_prog_key { GLuint stats_wm:1; GLuint flat_shade:1; GLuint nr_color_regions:5; - GLuint sample_alpha_to_coverage:1; + GLuint replicate_alpha:1; GLuint render_to_fbo:1; GLuint clamp_fragment_color:1; GLuint line_aa:2; -- 1.8.3.2 On Tue, Jul 2, 2013 at 8:46 PM, Ian Romanick <i...@freedesktop.org> wrote: > On 07/02/2013 01:42 AM, Chris Forbes wrote: >> >> Include src0 alpha in the RT write message when using MRT, so it is used >> for the alpha test instead of the normal per-RT alpha value. >> >> Fixes broken rendering in Dota2 under Wine [FDO #62647]. > > > Could you use the normative bugzilla reference, and add a note for the > stable branches. :) > > >> No Piglit regressions on Ivybridge. >> >> V2: reuse (and simplify) existing sample_alpha_to_coverage flag in >> the FS key, rather than adding another redundant one. >> >> Signed-off-by: Chris Forbes <chr...@ijw.co.nz> >> --- >> src/mesa/drivers/dri/i965/brw_fs_emit.cpp | 4 +--- >> src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 3 +-- >> src/mesa/drivers/dri/i965/brw_wm.c | 10 ++++++---- >> src/mesa/drivers/dri/i965/brw_wm.h | 2 +- >> 4 files changed, 9 insertions(+), 10 deletions(-) >> >> diff --git a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp >> b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp >> index f390989..c158016 100644 >> --- a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp >> +++ b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp >> @@ -127,9 +127,7 @@ fs_generator::generate_fb_write(fs_inst *inst) >> retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UD)); >> brw_set_compression_control(p, BRW_COMPRESSION_NONE); >> >> - if (inst->target > 0 && >> - c->key.nr_color_regions > 1 && >> - c->key.sample_alpha_to_coverage) { >> + if (inst->target > 0 && c->key.replicate_alpha) { >> /* Set "Source0 Alpha Present to RenderTarget" bit in >> message >> * header. >> */ >> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp >> b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp >> index a67b6ed..3353f55 100644 >> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp >> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp >> @@ -2254,8 +2254,7 @@ fs_visitor::emit_fb_writes() >> if (header_present) { >> src0_alpha_to_render_target = intel->gen >= 6 && >> !do_dual_src && >> - c->key.nr_color_regions > 1 && >> - c->key.sample_alpha_to_coverage; >> + c->key.replicate_alpha; >> /* m2, m3 header */ >> nr += 2; >> } >> diff --git a/src/mesa/drivers/dri/i965/brw_wm.c >> b/src/mesa/drivers/dri/i965/brw_wm.c >> index 6eb4a1d..5f681f6 100644 >> --- a/src/mesa/drivers/dri/i965/brw_wm.c >> +++ b/src/mesa/drivers/dri/i965/brw_wm.c >> @@ -277,8 +277,8 @@ brw_wm_debug_recompile(struct brw_context *brw, >> old_key->flat_shade, key->flat_shade); >> found |= key_debug(intel, "number of color buffers", >> old_key->nr_color_regions, key->nr_color_regions); >> - found |= key_debug(intel, "sample alpha to coverage", >> - old_key->sample_alpha_to_coverage, >> key->sample_alpha_to_coverage); >> + found |= key_debug(intel, "MRT alpha test or alpha-to-coverage", >> + old_key->replicate_alpha, key->replicate_alpha); >> found |= key_debug(intel, "rendering to FBO", >> old_key->render_to_fbo, key->render_to_fbo); >> found |= key_debug(intel, "fragment color clamping", >> @@ -461,8 +461,10 @@ static void brw_wm_populate_key( struct brw_context >> *brw, >> >> /* _NEW_BUFFERS */ >> key->nr_color_regions = ctx->DrawBuffer->_NumColorDrawBuffers; >> - /* _NEW_MULTISAMPLE */ >> - key->sample_alpha_to_coverage = >> ctx->Multisample.SampleAlphaToCoverage; >> + >> + /* _NEW_MULTISAMPLE, _NEW_COLOR, _NEW_BUFFERS */ >> + key->replicate_alpha = ctx->DrawBuffer->_NumColorDrawBuffers > 1 && >> + (ctx->Multisample.SampleAlphaToCoverage || >> ctx->Color.AlphaEnabled); >> >> /* BRW_NEW_VUE_MAP_GEOM_OUT */ >> if (intel->gen < 6) >> diff --git a/src/mesa/drivers/dri/i965/brw_wm.h >> b/src/mesa/drivers/dri/i965/brw_wm.h >> index 28e8734..57db27f 100644 >> --- a/src/mesa/drivers/dri/i965/brw_wm.h >> +++ b/src/mesa/drivers/dri/i965/brw_wm.h >> @@ -62,7 +62,7 @@ struct brw_wm_prog_key { >> GLuint stats_wm:1; >> GLuint flat_shade:1; >> GLuint nr_color_regions:5; >> - GLuint sample_alpha_to_coverage:1; >> + GLuint replicate_alpha:1; >> GLuint render_to_fbo:1; >> GLuint clamp_fragment_color:1; >> GLuint line_aa:2; >> > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev