[Mesa-dev] [PATCH] glsl: Remove field array_lvalue from ir_variable.

Kenneth Graunke kenneth at whitecape.org
Wed Sep 14 09:43:07 PDT 2011


On 09/12/2011 06:20 PM, Paul Berry wrote:
> The array_lvalue field was attempting to enforce the restriction that
> whole arrays can't be used on the left-hand side of an assignment in
> GLSL 1.10 or GLSL ES, and can't be used as out or inout parameters in
> GLSL 1.10.
>
> However, it was buggy (it didn't work properly for built-in arrays),
> and it was clumsy (it unnecessarily kept track on a
> variable-by-variable basis, and it didn't cover the GLSL ES case).
>
> This patch removes the array_lvalue field completely in favor of
> explicit checks in ast_parameter_declarator::hir() (this check is
> added) and in do_assignment (this check was already present).
>
> This causes a benign behavioral change: when the user attempts to pass
> an array as an out or inout parameter of a function in GLSL 1.10, the
> error is now flagged at the time the function definition is
> encountered, rather than at the time of invocation.  Previously we
> allowed such functions to be defined, and only flagged the error if
> they were invoked.
>
> Fixes Piglit tests
> spec/glsl-1.10/compiler/qualifiers/fn-{out,inout}-array-prohibited*
> and
> spec/glsl-1.20/compiler/assignment-operators/assign-builtin-array-allowed.vert.

Looks good to me, Paul...thanks for cleaning this up.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>


More information about the mesa-dev mailing list