[Mesa-dev] [PATCH] st/mesa: Convert PIPE_SHADER_CAP_CONSTRAINT_* to mesa's PACKING_CONSTRAINT_*

Brian Paul brian.e.paul at gmail.com
Sat Feb 25 07:25:21 PST 2012


On Fri, Feb 24, 2012 at 2:43 PM, Vincent Lejeune <vljn at ovi.com> wrote:
> v2: remove underscore between NO and PERSPECTIVE in PIPE_PACKING_CONSTRAINT_SMOOTH_NO_PERSPECTIVE_MIXED
> ---
>  src/mesa/state_tracker/st_extensions.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index fb36a68..04ff9d4 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -206,6 +206,22 @@ void st_init_limits(struct st_context *st)
>       options->EmitNoIndirectUniform = !screen->get_shader_param(screen, sh,
>                                         PIPE_SHADER_CAP_INDIRECT_CONST_ADDR);
>
> +      switch (screen->get_shader_param(screen, sh,
> +                                       PIPE_SHADER_CAP_VARYINGS_PACKING_CONSTRAINTS)) {
> +      case PIPE_PACKING_CONSTRAINT_NONE:
> +         options->VaryingsPackingConstraint = PACKING_CONSTRAINT_NONE;
> +         break;
> +      case PIPE_PACKING_CONSTRAINT_SMOOTH_NOPERSPECTIVE_MIXED:
> +         options->VaryingsPackingConstraint = PACKING_CONSTRAINT_SMOOTH_NOPERSPECTIVE_MIXED;
> +         break;
> +      case PIPE_PACKING_CONSTRAINT_NO_MIXED_INTERPOLATION:
> +         options->VaryingsPackingConstraint = PACKING_CONSTRAINT_NO_MIXED_INTERPOLATION;
> +         break;
> +      default:
> +         options->VaryingsPackingConstraint = PACKING_CONSTRAINT_AVOID_PACKING;
> +         break;
> +      }
> +

If the values of the Mesa enums matches the gallium enums, just use an
assignment:

options->VaryingPackingConstraint = screen->get_shader_param(screen, sh,

PIPE_SHADER_CAP_VARYINGS_PACKING_CONSTRAINTS);

BUT, be sure to add some (static) assertions that the mesa values
match the gallium values to catch any mismatches in the future.  We do
this in a few other places.

-Brian


More information about the mesa-dev mailing list