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 <[email protected]> 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 <[email protected]>
> ---
>  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
>
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to