[Mesa-dev] [PATCH 6/8] i965/gen6: Enable the features required for GL_ARB_sample_shading

Paul Berry stereotype441 at gmail.com
Sun Oct 20 16:39:12 CEST 2013


On 20 October 2013 07:25, Paul Berry <stereotype441 at gmail.com> wrote:

> On 14 October 2013 10:12, Anuj Phogat <anuj.phogat at gmail.com> wrote:
>
>> - Enable GEN6_WM_MSDISPMODE_PERSAMPLE, GEN6_WM_POSOFFSET_SAMPLE,
>>   GEN6_WM_OMASK_TO_RENDER_TARGET as per extension's specification.
>> - Don't enable GEN6_WM_16_DISPATCH_ENABLE when
>> GEN6_WM_MSDISPMODE_PERSAMPLE
>>   is enabled. Refer SNB PRM Vol. 2, Part 1, Page 279 for details.
>>
>> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
>> ---
>>  src/mesa/drivers/dri/i965/gen6_wm_state.c | 67
>> +++++++++++++++++++++++++++++--
>>  1 file changed, 64 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c
>> b/src/mesa/drivers/dri/i965/gen6_wm_state.c
>> index c96a107..4bc25d6 100644
>> --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c
>> +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c
>> @@ -103,6 +103,7 @@ upload_wm_state(struct brw_context *brw)
>>
>>     /* _NEW_BUFFERS */
>>     bool multisampled_fbo = ctx->DrawBuffer->Visual.samples > 1;
>> +   bool msdispmode_persample = false;
>>
>>      /* CACHE_NEW_WM_PROG */
>>     if (brw->wm.prog_data->nr_params == 0) {
>> @@ -156,7 +157,17 @@ upload_wm_state(struct brw_context *brw)
>>
>>     /* CACHE_NEW_WM_PROG */
>>     dw5 |= GEN6_WM_8_DISPATCH_ENABLE;
>> -   if (brw->wm.prog_data->prog_offset_16)
>> +   msdispmode_persample =
>> +      ctx->Multisample.Enabled &&
>> +      (ctx->Multisample.SampleShading ||
>> +       brw->fragment_program->Base.InputsRead & VARYING_BIT_SAMPLE_ID ||
>> +       brw->fragment_program->Base.InputsRead & VARYING_BIT_SAMPLE_POS);
>>
>
> The dependency on ctx->Multisample.SampleShading isn't quite right.  You
> also need to account for the value of
> ctx->Multisample.MinSampleShadingValue.  I believe the correct expression
> is something like:
>
> (ctx->Multisample.SampleShading &&
> ceil(ctx->Multisample.MinSampleShadingValue *
> ctx->DrawBuffer->Visual.samples) > 1)
>
> This is necessary to ensure that if, for example, the buffer is 4xMSAA and
> the client sets MinSampleShadingARB to 0.25 or less, we still get
> per-fragment shading.
>

My suggestion on patch 7 about _mesa_get_min_invocations_per_fragment(...)
should also be sufficient to take care of this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131020/57e65bbf/attachment.html>


More information about the mesa-dev mailing list