[Mesa-dev] [PATCH] glsl: Validate aux storage qualifier combination with other qualifiers.

Chris Forbes chrisf at ijw.co.nz
Fri Apr 11 18:12:51 PDT 2014


This is a lame place to put this validation. Will respin something
more sensible.

On Sat, Apr 12, 2014 at 12:35 PM, Chris Forbes <chrisf at ijw.co.nz> wrote:
> We've been allowing `centroid` and `sample` in all kinds of weird places
> where they're not valid.
>
> Insist that `sample` is combined with `in` or `out`;
> and that `centroid` is combined with `in`, `out`, or the deprecated
> `varying`.
>
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>  src/glsl/ast_to_hir.cpp | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index 1d15e62..34ac1ef 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -1980,6 +1980,24 @@ ast_fully_specified_type::glsl_type(const char **name,
>                         type->name);
>     }
>
> +   /* Validate auxiliary storage qualifiers */
> +   if (this->qualifier.flags.q.sample &&
> +       !(this->qualifier.flags.q.in ||
> +         this->qualifier.flags.q.out)) {
> +      YYLTYPE loc = this->get_location();
> +      _mesa_glsl_error(&loc, state,
> +                       "sample qualifier may only be used with `in' or `out'");
> +   }
> +   if (this->qualifier.flags.q.centroid &&
> +       !(this->qualifier.flags.q.in ||
> +         this->qualifier.flags.q.out ||
> +         this->qualifier.flags.q.varying)) {
> +      YYLTYPE loc = this->get_location();
> +      _mesa_glsl_error(&loc, state,
> +                       "centroid qualifier may only be used with `in', "
> +                       "`out' or `varying'");
> +   }
> +
>     return type;
>  }
>
> --
> 1.9.2
>


More information about the mesa-dev mailing list