[Mesa-dev] [PATCH] st/mesa: only enable MSAA coverage options when we have a MSAA buffer

Roland Scheidegger sroland at vmware.com
Fri Sep 16 19:02:02 UTC 2016


We can't change how gallium is supposed to behave since other apis rely
on coverage-to-alpha working even if msaa is disabled.

Roland

Am 16.09.2016 um 18:58 schrieb Ilia Mirkin:
> FTR, the new piglit test passed as-is on NVIDIA hw (at least nv50 and
> nvc0). I'm not opposed to this new state dependency if Marek isn't
> (he's analyzed these things a whole lot more than I suspect anyone
> else), but just wanted to point it out in case the preference is to
> instead change how gallium is supposed to behave.
> 
> Cheers,
> 
>   -ilia
> 
> On Thu, Sep 15, 2016 at 5:20 PM, Brian Paul <brianp at vmware.com> wrote:
>> Regardless of whether GL_MULTISAMPLE is enabled (it's enabled by default)
>> we should not set the alpha_to_coverage or alpha_to_one flags if the
>> current drawing buffer does not do MSAA.
>>
>> This fixes the new piglit gl-1.3-alpha_to_coverage_nop test.
>> ---
>>  src/mesa/state_tracker/st_atom_blend.c | 9 ++++++---
>>  src/mesa/state_tracker/st_context.c    | 3 ++-
>>  2 files changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c
>> index 65de67b..222267e 100644
>> --- a/src/mesa/state_tracker/st_atom_blend.c
>> +++ b/src/mesa/state_tracker/st_atom_blend.c
>> @@ -265,9 +265,12 @@ update_blend( struct st_context *st )
>>
>>     blend->dither = ctx->Color.DitherFlag;
>>
>> -   if (ctx->Multisample.Enabled) {
>> -      /* unlike in gallium/d3d10 these operations are only performed
>> -         if msaa is enabled */
>> +   if (ctx->Multisample.Enabled &&
>> +       ctx->DrawBuffer &&
>> +       ctx->DrawBuffer->Visual.sampleBuffers > 0) {
>> +      /* Unlike in gallium/d3d10 these operations are only performed
>> +       * if both msaa is enabled and we have a multisample buffer.
>> +       */
>>        blend->alpha_to_coverage = ctx->Multisample.SampleAlphaToCoverage;
>>        blend->alpha_to_one = ctx->Multisample.SampleAlphaToOne;
>>     }
>> diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
>> index ddc11a4..81b3387 100644
>> --- a/src/mesa/state_tracker/st_context.c
>> +++ b/src/mesa/state_tracker/st_context.c
>> @@ -166,7 +166,8 @@ void st_invalidate_state(struct gl_context * ctx, GLbitfield new_state)
>>     struct st_context *st = st_context(ctx);
>>
>>     if (new_state & _NEW_BUFFERS) {
>> -      st->dirty |= ST_NEW_DSA |
>> +      st->dirty |= ST_NEW_BLEND |
>> +                   ST_NEW_DSA |
>>                     ST_NEW_FB_STATE |
>>                     ST_NEW_SAMPLE_MASK |
>>                     ST_NEW_SAMPLE_SHADING |
>> --
>> 1.9.1
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=CwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=FXrt74ZtFglQGjzdeMzTViyt5ShMaOWiemjQQr1Brfo&s=Gn2XFwCKJqAGKnzGpmFXVDwVDuM7C9FSad_e8d3dp_4&e= 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=CwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=FXrt74ZtFglQGjzdeMzTViyt5ShMaOWiemjQQr1Brfo&s=Gn2XFwCKJqAGKnzGpmFXVDwVDuM7C9FSad_e8d3dp_4&e= 
> 



More information about the mesa-dev mailing list