[Mesa-dev] [PATCH] mesa/st: get interpolation mode from the fragment shader.

Jose Fonseca jfonseca at vmware.com
Fri Oct 28 14:00:50 PDT 2011



----- Original Message -----
> From: Dave Airlie <airlied at redhat.com>
> 
> With the recent changes to interpolation stuff, we can now get the
> value
> direct from the program instead of just being fail.
> 
> fixes some of the glsl-1.30 interpolation tests with softpipe
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/mesa/state_tracker/st_program.c |   15 ++++++++++++++-
>  1 files changed, 14 insertions(+), 1 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_program.c
> b/src/mesa/state_tracker/st_program.c
> index c419c40..023879d 100644
> --- a/src/mesa/state_tracker/st_program.c
> +++ b/src/mesa/state_tracker/st_program.c
> @@ -416,6 +416,19 @@ st_get_vp_variant(struct st_context *st,
>     return vpv;
>  }
>  
> +static int st_translate_interp(enum glsl_interp_qualifier glsl_qual)
> +{
> +   switch (glsl_qual) {
> +   case INTERP_QUALIFIER_NONE:
> +   case INTERP_QUALIFIER_SMOOTH:
> +      return TGSI_INTERPOLATE_PERSPECTIVE;
> +   case INTERP_QUALIFIER_FLAT:
> +      return TGSI_INTERPOLATE_CONSTANT;
> +   case INTERP_QUALIFIER_NOPERSPECTIVE:
> +      return TGSI_INTERPOLATE_LINEAR;
> +   }
> +   assert(0);

Please return TGSI_INTERPOLATE_PERSPECTIVE here. Otherwise we'll get warnings and undefined behavior on release builds.

Otherwise looks good to me.

Jose

> +}
>  
>  /**
>   * Translate a Mesa fragment shader into a TGSI shader using extra
>   info in
> @@ -558,7 +571,7 @@ st_translate_fragment_program(struct st_context
> *st,
>                 if (attr == FRAG_ATTRIB_PNTC)
>                    interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
>                 else
> -                  interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
> +                  interpMode[slot] =
> st_translate_interp(stfp->Base.InterpQualifier[attr]);
>                 break;
>              }
>           }
> --
> 1.7.6.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