[Mesa-dev] [PATCH] glsl: simplify validation of illegal layouts on block members

Iago Toral itoral at igalia.com
Thu Nov 12 04:59:30 PST 2015


On Thu, 2015-11-12 at 16:13 +1100, Timothy Arceri wrote:
> From: Timothy Arceri <timothy.arceri at collabora.com>
> 
> We already give the location of the qualifier so there is
> no need to list all the identifiers in the error message.

However, there can be multiple layout qualifiers in the same declaration
and in that case, with this change, the user can't tell which one caused
this error.

Iago

> Also not calling the binding validation function will make things
> much simpler when adding compile time constant support as we
> wont need to resolve the binding value.
> ---
>  src/glsl/ast_to_hir.cpp | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index 9d341e8..79bd4e7 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -5896,18 +5896,14 @@ ast_process_structure_or_interface_block(exec_list *instructions,
>           const struct ast_type_qualifier *const qual =
>              & decl_list->type->qualifier;
>  
> -         if (qual->flags.q.explicit_binding)
> -            validate_binding_qualifier(state, &loc, decl_type, qual);
> -
>           if (qual->flags.q.std140 ||
>               qual->flags.q.std430 ||
>               qual->flags.q.packed ||
> -             qual->flags.q.shared) {
> +             qual->flags.q.shared ||
> +             qual->flags.q.explicit_binding) {
>              _mesa_glsl_error(&loc, state,
> -                             "uniform/shader storage block layout qualifiers "
> -                             "std140, std430, packed, and shared can only be "
> -                             "applied to uniform/shader storage blocks, not "
> -                             "members");
> +                             "this layout qualifier can only be applied to "
> +                             "uniform/shader storage blocks, not members");
>           }
>  
>           if (qual->flags.q.constant) {




More information about the mesa-dev mailing list