[Mesa-dev] [PATCH 2/3] glsl: don't validate interface blocks twice

Iago Toral itoral at igalia.com
Thu Feb 11 15:28:38 UTC 2016


On Thu, 2016-02-11 at 15:45 +1100, Timothy Arceri wrote:
> We already check for opaque types so don't recheck for atomics
> and images.
> ---
>  src/compiler/glsl/ast_to_hir.cpp | 46 ++++++++++++++++++++--------------------
>  1 file changed, 23 insertions(+), 23 deletions(-)
> 
> diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
> index 3840cba..b558589 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -6337,30 +6337,30 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
>         */
>        assert(decl_type);
>  
> -      if (is_interface && decl_type->contains_opaque()) {
> -         _mesa_glsl_error(&loc, state,
> -                          "uniform/buffer in non-default interface block contains "
> -                          "opaque variable");
> -      }
> -
> -      if (decl_type->contains_atomic()) {
> -         /* From section 4.1.7.3 of the GLSL 4.40 spec:
> -          *
> -          *    "Members of structures cannot be declared as atomic counter
> -          *     types."
> -          */
> -         _mesa_glsl_error(&loc, state, "atomic counter in structure, "
> -                          "shader storage block or uniform block");
> -      }
> +      if (is_interface) {
> +         if (decl_type->contains_opaque()) {
> +            _mesa_glsl_error(&loc, state, "uniform/buffer in non-default "
> +                             "interface block contains opaque variable");
> +         }
> +      } else {
> +         if (decl_type->contains_atomic()) {
> +            /* From section 4.1.7.3 of the GLSL 4.40 spec:
> +             *
> +             *    "Members of structures cannot be declared as atomic counter
> +             *     types."
> +             */
> +            _mesa_glsl_error(&loc, state, "atomic counter in structure, "
> +                             "shader storage block or uniform block");

You should update the error message to remove the reference to interface
blocks.

> +         }
>  
> -      if (decl_type->contains_image()) {
> -         /* FINISHME: Same problem as with atomic counters.
> -          * FINISHME: Request clarification from Khronos and add
> -          * FINISHME: spec quotation here.
> -          */
> -         _mesa_glsl_error(&loc, state,
> -                          "image in structure, shader storage block or "
> -                          "uniform block");
> +         if (decl_type->contains_image()) {
> +            /* FINISHME: Same problem as with atomic counters.
> +             * FINISHME: Request clarification from Khronos and add
> +             * FINISHME: spec quotation here.
> +             */
> +            _mesa_glsl_error(&loc, state, "image in structure, shader "
> +                             "storage block or uniform block");

Same here.

With these changes,

Reviewed-by: Iago Toral Quiroga <itoral at igalia.cim>

> +         }
>        }
>  
>        if (qual->flags.q.explicit_binding) {




More information about the mesa-dev mailing list