compiler/glsl: allow sequence op as a const expr in gles 1.0
authorLars Hamre <chemecse@gmail.com>
Wed, 23 Mar 2016 14:14:23 +0000 (10:14 -0400)
committerEduardo Lima Mitev <elima@igalia.com>
Wed, 23 Mar 2016 17:13:26 +0000 (18:13 +0100)
Allow the sequence operator to be a constant expression in GLSL ES
versions prior to GLSL ES 3.0

Fixes the following piglit test:
/all/spec/glsl-es-1.0/compiler/array-sized-by-sequence-in-parenthesis.vert

This is similar to the logic from process_initializer() which performs
the same check for constant variable initialization with sequence
operators.

v2: Fixed regression pointed out by Eduardo Lima Mitev

Signed-off-by: Lars Hamre <chemecse@gmail.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
src/compiler/glsl/ast_to_hir.cpp

index 5262bd87655ae991c216b5b709efb1666378ca0b..35def8e3ae01a8057686c36aff3cb278fe43ecd6 100644 (file)
@@ -2125,7 +2125,9 @@ process_array_size(exec_node *node,
    }
 
    ir_constant *const size = ir->constant_expression_value();
-   if (size == NULL || array_size->has_sequence_subexpression()) {
+   if (size == NULL ||
+       (state->is_version(120, 300) &&
+        array_size->has_sequence_subexpression())) {
       _mesa_glsl_error(& loc, state, "array size must be a "
                        "constant valued expression");
       return 0;