[Mesa-dev] [PATCH] glsl: Improve error message when attemping assignment to unsized array

Ian Romanick idr at freedesktop.org
Tue Nov 19 12:20:01 PST 2013


Other than the tiny nit below,

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 11/19/2013 03:13 AM, Timothy Arceri wrote:
> Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
> ---
>  src/glsl/ast_to_hir.cpp | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index 76b256c..73be274 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -696,9 +696,14 @@ validate_assignment(struct _mesa_glsl_parse_state *state,
>      * Note: Whole-array assignments are not permitted in GLSL 1.10, but this
>      * is handled by ir_dereference::is_lvalue.
>      */
> -   if (is_initializer && lhs_type->is_unsized_array() && rhs->type->is_array()
> +   if (lhs_type->is_unsized_array() && rhs->type->is_array()
>         && (lhs_type->element_type() == rhs->type->element_type())) {
> -      return rhs;
> +      if (is_initializer) {
> +         return rhs;
> +      } else {
> +         _mesa_glsl_error(&loc, state,
> +                          "implicitly sized arrays cannot be assigned to");

The "to" is redundant.

> +      }
>     }
>  
>     /* Check for implicit conversion in GLSL 1.20 */
> 



More information about the mesa-dev mailing list