[Mesa-dev] [PATCH v2 13/82] glsl: buffer variables cannot be defined outside interface blocks

Jordan Justen jordan.l.justen at intel.com
Thu Jun 11 11:38:13 PDT 2015


On 2015-06-03 00:01:03, Iago Toral Quiroga wrote:
> From: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> 
> Section 4.3.7 "Buffer Variables", GLSL 4.30 spec:
> 
> "Buffer variables may only be declared inside interface blocks
> (section 4.3.9 “Interface Blocks”), which are then referred to as
> shader storage blocks. It is a compile-time error to declare buffer
> variables at global scope (outside a block)."
> 
> Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> ---
>  src/glsl/ast_to_hir.cpp | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index d246c00..99b6eeb 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -3378,6 +3378,18 @@ ast_declarator_list::hir(exec_list *instructions,
>  
>     decl_type = this->type->glsl_type(& type_name, state);
>  
> +   /* Section 4.3.7 "Buffer Variables" of the GLSL 4.30 spec:
> +    *    "Buffer variables may only be declared inside interface blocks
> +    *    (section 4.3.9 “Interface Blocks”), which are then referred to as
> +    *    shader storage blocks. It is a compile-time error to declare buffer
> +    *    variables at global scope (outside a block)."
> +    */
> +   if (type->qualifier.flags.q.buffer && !decl_type->is_interface()) {
> +      _mesa_glsl_error(&loc, state,
> +                       "buffer variables cannot be declared outside"
> +                       " interface blocks");

I think we usually put the space at the end of the previous line.

Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>

> +   }
> +
>     /* An offset-qualified atomic counter declaration sets the default
>      * offset for the next declaration within the same atomic counter
>      * buffer.
> -- 
> 1.9.1
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list