Re: [Mesa-dev] [PATCH] compiler/glsl: Allow the sequence operator to be a constant expression

2016-03-22 Thread Lars Hamre
You are correct, it should be state->is_version(120, 300).
I will submit an updated patch.

On Tue, Mar 22, 2016 at 3:32 PM, Eduardo Lima Mitev 
wrote:

> On 03/22/2016 02:48 PM, Lars Hamre wrote:
>
>> Resending this patch because it received no response last week.
>>
>> 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
>>
>>
> I confirm this fixes the above test, but it also regresses test:
>
>
> /all/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence-in-parenthesis.vert.
>
> Maybe you are missing a version check?
>
> Eduardo
>
> This mirrors the logic from process_initializer() which performs the
>> same check for constant variable initialization with sequence operators.
>>
>> Section 4.3.3 (Constant Expressions) of the GLSL 4.30.9 spec and of the
>> GLSL ES 3.00.4 spec say that the result of a sequence operator is not a
>> constant expression; however, we should not mandate that for lower GLSL
>> versions.
>>
>> Signed-off-by: Lars Hamre 
>>
>> ---
>>   src/compiler/glsl/ast_to_hir.cpp | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/compiler/glsl/ast_to_hir.cpp
>> b/src/compiler/glsl/ast_to_hir.cpp
>> index 5262bd8..4037468 100644
>> --- a/src/compiler/glsl/ast_to_hir.cpp
>> +++ b/src/compiler/glsl/ast_to_hir.cpp
>> @@ -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(430, 300) &&
>> +array_size->has_sequence_subexpression())) {
>> _mesa_glsl_error(& loc, state, "array size must be a "
>>  "constant valued expression");
>> return 0;
>> --
>> 2.5.0
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] compiler/glsl: Allow the sequence operator to be a constant expression

2016-03-22 Thread Eduardo Lima Mitev

On 03/22/2016 02:48 PM, Lars Hamre wrote:

Resending this patch because it received no response last week.

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



I confirm this fixes the above test, but it also regresses test:

/all/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence-in-parenthesis.vert.

Maybe you are missing a version check?

Eduardo


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

Section 4.3.3 (Constant Expressions) of the GLSL 4.30.9 spec and of the
GLSL ES 3.00.4 spec say that the result of a sequence operator is not a
constant expression; however, we should not mandate that for lower GLSL
versions.

Signed-off-by: Lars Hamre 

---
  src/compiler/glsl/ast_to_hir.cpp | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 5262bd8..4037468 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -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(430, 300) &&
+array_size->has_sequence_subexpression())) {
_mesa_glsl_error(& loc, state, "array size must be a "
 "constant valued expression");
return 0;
--
2.5.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] compiler/glsl: Allow the sequence operator to be a constant expression

2016-03-22 Thread Lars Hamre
Resending this patch because it received no response last week.

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 mirrors the logic from process_initializer() which performs the
same check for constant variable initialization with sequence operators.

Section 4.3.3 (Constant Expressions) of the GLSL 4.30.9 spec and of the
GLSL ES 3.00.4 spec say that the result of a sequence operator is not a
constant expression; however, we should not mandate that for lower GLSL
versions.

Signed-off-by: Lars Hamre 

---
 src/compiler/glsl/ast_to_hir.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 5262bd8..4037468 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -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(430, 300) &&
+array_size->has_sequence_subexpression())) {
   _mesa_glsl_error(& loc, state, "array size must be a "
"constant valued expression");
   return 0;
--
2.5.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] compiler/glsl: Allow the sequence operator to be a constant expression in GLSL ES versions prior to GLSL ES 3.0

2016-03-14 Thread Lars Hamre
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 mirrors the logic from process_initializer() which performs the
same check for constant variable initialization with sequence operators.

Section 4.3.3 (Constant Expressions) of the GLSL 4.30.9 spec and of the
GLSL ES 3.00.4 spec say that the result of a sequence operator is not a
constant expression; however, we should not mandate that for lower GLSL
versions.

---
 src/compiler/glsl/ast_to_hir.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 5262bd8..4037468 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -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(430, 300) &&
+array_size->has_sequence_subexpression())) {
   _mesa_glsl_error(& loc, state, "array size must be a "
"constant valued expression");
   return 0;
--
2.5.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev