[Mesa-dev] [PATCH 3/3] st/mesa: automatically set per-sample interpolation if using SampleID/Pos

Ilia Mirkin imirkin at alum.mit.edu
Thu Oct 1 15:42:31 PDT 2015


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

On Mon, Sep 28, 2015 at 8:38 PM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
>  src/mesa/state_tracker/st_atom_shader.c | 8 +++++++-
>  src/mesa/state_tracker/st_program.c     | 4 +++-
>  2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
> index dc03156..1e880a1 100644
> --- a/src/mesa/state_tracker/st_atom_shader.c
> +++ b/src/mesa/state_tracker/st_atom_shader.c
> @@ -70,9 +70,15 @@ update_fp( struct st_context *st )
>     key.clamp_color = st->clamp_frag_color_in_shader &&
>                       st->ctx->Color._ClampFragmentColor;
>
> -   /* Ignore sample qualifier while computing this flag. */
> +   /* Don't set it if the driver can force the interpolation by itself.
> +    * If SAMPLE_ID or SAMPLE_POS are used, the interpolation is set
> +    * automatically.
> +    * Ignore sample qualifier while computing this flag.
> +    */
>     key.persample_shading =
>        !st->can_force_persample_interp &&
> +      !(stfp->Base.Base.SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID |
> +                                            SYSTEM_BIT_SAMPLE_POS)) &&
>        _mesa_get_min_invocations_per_fragment(st->ctx, &stfp->Base, true) > 1;
>
>     st->fp_variant = st_get_fp_variant(st, stfp, &key);
> diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
> index 9c27147..a07f8fe 100644
> --- a/src/mesa/state_tracker/st_program.c
> +++ b/src/mesa/state_tracker/st_program.c
> @@ -619,7 +619,9 @@ st_translate_fragment_program(struct st_context *st,
>           else
>              interpLocation[slot] = TGSI_INTERPOLATE_LOC_CENTER;
>
> -         if (key->persample_shading)
> +         if (stfp->Base.Base.SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID |
> +                                                 SYSTEM_BIT_SAMPLE_POS) ||
> +             key->persample_shading)
>              interpLocation[slot] = TGSI_INTERPOLATE_LOC_SAMPLE;
>
>           switch (attr) {
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list