[Piglit] [PATCH 3/5] array-size-sequence-in-parenthesis: Invert expected result.
Ian Romanick
idr at freedesktop.org
Wed May 29 12:45:41 PDT 2013
Sorry I missed this before...
On 05/02/2013 01:17 PM, Fabian Bieler wrote:
> The test incorectly stated that (5, 3) is not a grammatically correct
> constant_expression.
The sequence operator is included in the grammar, but the body of the
spec makes it invalid. It would have required a lot of grammar
headaches to capture this semantic rule in the grammar. Section 4.3.3
of the GLSL 4.20 spec says:
"However, the lowest precedence operators of the sequence
operator ( , ) and the assignment operators ( =, +=, ...) are
not included in the operators that can create a constant
expression."
This text was added to 4.20 as a clarification of previous specs. Since
the sequence operator cannot result in a constant expression, it can't
be used as an array size.
The commit message of the original test says as much:
commit 0eef1440c1d6604bf425a277213e954c309e9ce1
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Thu Apr 7 12:22:15 2011 -0700
Fix test that sizes an array using the sequence operator
After discussion in the ARB, it was decided that the grammar is
correct and
takes precedence. Sequence operators are not allowed, at all, for
sizing
arrays. This shouldn't be surprising since it matches the rules in
C and C++.
Please revert.
> According to the GLSL 1.20 spec this is possible like so:
>
> constant_expression:
> conditional_expression: <---------------------------------------+
> [a bunch of logical & arithmetic binary expressions]: |
> unary_expression: |
> postfix_expression: |
> primary_expression: |
> '(' expression ')' ------+ |
> INTCONSTANT | |
> | |
> +----------------------------------------------+ |
> | |
> V |
> expression: |
> assignment_expression |
> expression ',' assignment_expression |
> |
> assignment_expression: |
> conditional_expression ----------------------------------------+
>
> Invert expected result of test and check that correct operand of comma
> operator is discarded.
> ---
> .../array-size-sequence-in-parenthesis.vert | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence-in-parenthesis.vert b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence-in-parenthesis.vert
> index 8f3d42f..4fedd3f 100644
> --- a/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence-in-parenthesis.vert
> +++ b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence-in-parenthesis.vert
> @@ -1,5 +1,5 @@
> /* [config]
> - * expect_result: fail
> + * expect_result: pass
> * glsl_version: 1.20
> * [end config]
> *
> @@ -27,6 +27,6 @@
> */
> #version 120
>
> -uniform float a[(5,3)];
> +uniform float a[(3,5)];
>
> -void main() { gl_Position = vec4(0.0); }
> +void main() { gl_Position = vec4(a[4]); }
>
More information about the Piglit
mailing list