glslang: Bug 13724: ES global initializers must be constant.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@30990 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2015-04-30 03:22:41 +00:00
parent 09388459a8
commit 968c8f8e78
9 changed files with 299 additions and 206 deletions

View File

@ -1,6 +1,6 @@
// okay // okay
#version 100 #version 100
int a[3] = { 2, 3, 4, }; // ERROR int a[3] = { 2, 3, 4, }; // ERROR (lots)
#version 100 #version 100
int uint; int uint;
@ -194,6 +194,25 @@ void badswizzle()
a.method(); // ERROR a.method(); // ERROR
} }
float fooinit();
float fooinittest()
{
return fooinit();
}
// Test extra-function initializers
const float fi1 = 3.0;
const float fi2 = 4.0;
const float fi3 = 5.0;
float fooinit()
{
return fi1 + fi2 + fi3; // should make a constant of 12.0
}
int init1 = gl_FrontFacing ? 1 : 2; // ERROR, non-const initializer
#pragma STDGL invariant(all) #pragma STDGL invariant(all)
#line 3000 #line 3000

View File

@ -33,8 +33,21 @@ layout(location = 5) out vec4 factor;
layout(location=4) in vec4 vl2; layout(location=4) in vec4 vl2;
float fooi();
void foo() void foo()
{ {
vec2 r1 = modf(v.xy, v.zw); // ERROR, v.zw not l-value vec2 r1 = modf(v.xy, v.zw); // ERROR, v.zw not l-value
vec2 r2 = modf(o.xy, o.zw); vec2 r2 = modf(o.xy, o.zw);
o.z = fooi();
}
// Test extra-function initializers
float i1 = gl_FrontFacing ? -2.0 : 2.0;
float i2 = 102;
float fooi()
{
return i1 + i2;
} }

View File

@ -2,6 +2,7 @@
ERROR: 0:3: '{ } style initializers' : not supported with this profile: es ERROR: 0:3: '{ } style initializers' : not supported with this profile: es
ERROR: 0:3: 'initializer' : not supported for this version or the enabled extensions ERROR: 0:3: 'initializer' : not supported for this version or the enabled extensions
ERROR: 0:3: 'array initializer' : not supported for this version or the enabled extensions ERROR: 0:3: 'array initializer' : not supported for this version or the enabled extensions
ERROR: 0:3: 'non-constant global initializer' : not supported with this profile: es
ERROR: 0:4: '#version' : must occur first in shader ERROR: 0:4: '#version' : must occur first in shader
ERROR: 0:7: 'attribute' : not supported in this stage: fragment ERROR: 0:7: 'attribute' : not supported in this stage: fragment
ERROR: 0:7: 'float' : type requires declaration of default precision qualifier ERROR: 0:7: 'float' : type requires declaration of default precision qualifier
@ -82,9 +83,10 @@ ERROR: 0:192: '.' : cannot apply to an array: nothing
ERROR: 0:193: '.length' : not supported for this version or the enabled extensions ERROR: 0:193: '.length' : not supported for this version or the enabled extensions
ERROR: 0:194: '.' : cannot apply to an array: method ERROR: 0:194: '.' : cannot apply to an array: method
ERROR: 0:194: 'a' : can't use function syntax on variable ERROR: 0:194: 'a' : can't use function syntax on variable
ERROR: 0:214: 'non-constant global initializer' : not supported with this profile: es
ERROR: 0:3000: '#error' : line of this error should be 3000 ERROR: 0:3000: '#error' : line of this error should be 3000
ERROR: 0:3002: '' : syntax error ERROR: 0:3002: '' : syntax error
ERROR: 76 compilation errors. No code generated. ERROR: 78 compilation errors. No code generated.
Shader version: 100 Shader version: 100
@ -352,6 +354,29 @@ ERROR: node is still EOpNull!
0:193 5 (const int) 0:193 5 (const int)
0:194 Constant: 0:194 Constant:
0:194 0.000000 0:194 0.000000
0:199 Function Definition: fooinittest( (global mediump float)
0:199 Function Parameters:
0:201 Sequence
0:201 Branch: Return with expression
0:201 Function Call: fooinit( (global mediump float)
0:209 Function Definition: fooinit( (global mediump float)
0:209 Function Parameters:
0:211 Sequence
0:211 Branch: Return with expression
0:211 Constant:
0:211 12.000000
0:214 Sequence
0:214 move second child to first child (temp mediump int)
0:214 'init1' (global mediump int)
0:214 Test condition and select (temp mediump int)
0:214 Condition
0:214 'gl_FrontFacing' (gl_FrontFacing bool)
0:214 true case
0:214 Constant:
0:214 1 (const int)
0:214 false case
0:214 Constant:
0:214 2 (const int)
0:? Linker Objects 0:? Linker Objects
0:? 'a' (global 3-element array of mediump int) 0:? 'a' (global 3-element array of mediump int)
0:? 'uint' (global mediump int) 0:? 'uint' (global mediump int)
@ -376,6 +401,13 @@ ERROR: node is still EOpNull!
0:? 'f124' (global mediump float) 0:? 'f124' (global mediump float)
0:? 'sCube' (uniform lowp samplerCube) 0:? 'sCube' (uniform lowp samplerCube)
0:? 's' (smooth in structure{global mediump float f}) 0:? 's' (smooth in structure{global mediump float f})
0:? 'fi1' (const mediump float)
0:? 3.000000
0:? 'fi2' (const mediump float)
0:? 4.000000
0:? 'fi3' (const mediump float)
0:? 5.000000
0:? 'init1' (global mediump int)
Linked fragment stage: Linked fragment stage:
@ -646,6 +678,29 @@ ERROR: node is still EOpNull!
0:193 5 (const int) 0:193 5 (const int)
0:194 Constant: 0:194 Constant:
0:194 0.000000 0:194 0.000000
0:199 Function Definition: fooinittest( (global mediump float)
0:199 Function Parameters:
0:201 Sequence
0:201 Branch: Return with expression
0:201 Function Call: fooinit( (global mediump float)
0:209 Function Definition: fooinit( (global mediump float)
0:209 Function Parameters:
0:211 Sequence
0:211 Branch: Return with expression
0:211 Constant:
0:211 12.000000
0:214 Sequence
0:214 move second child to first child (temp mediump int)
0:214 'init1' (global mediump int)
0:214 Test condition and select (temp mediump int)
0:214 Condition
0:214 'gl_FrontFacing' (gl_FrontFacing bool)
0:214 true case
0:214 Constant:
0:214 1 (const int)
0:214 false case
0:214 Constant:
0:214 2 (const int)
0:? Linker Objects 0:? Linker Objects
0:? 'a' (global 3-element array of mediump int) 0:? 'a' (global 3-element array of mediump int)
0:? 'uint' (global mediump int) 0:? 'uint' (global mediump int)
@ -670,4 +725,11 @@ ERROR: node is still EOpNull!
0:? 'f124' (global mediump float) 0:? 'f124' (global mediump float)
0:? 'sCube' (uniform lowp samplerCube) 0:? 'sCube' (uniform lowp samplerCube)
0:? 's' (smooth in structure{global mediump float f}) 0:? 's' (smooth in structure{global mediump float f})
0:? 'fi1' (const mediump float)
0:? 3.000000
0:? 'fi2' (const mediump float)
0:? 4.000000
0:? 'fi3' (const mediump float)
0:? 5.000000
0:? 'init1' (global mediump int)

View File

@ -6,8 +6,8 @@ ERROR: 0:24: 'location' : not supported for this version or the enabled extensio
ERROR: 0:24: 'location qualifier on input' : not supported for this version or the enabled extensions ERROR: 0:24: 'location qualifier on input' : not supported for this version or the enabled extensions
ERROR: 0:26: 'location' : not supported for this version or the enabled extensions ERROR: 0:26: 'location' : not supported for this version or the enabled extensions
ERROR: 0:26: 'location qualifier on output' : not supported for this version or the enabled extensions ERROR: 0:26: 'location qualifier on output' : not supported for this version or the enabled extensions
ERROR: 0:38: 'assign' : l-value required "v" (can't modify shader input) ERROR: 0:40: 'assign' : l-value required "v" (can't modify shader input)
ERROR: 0:38: 'out' : Non-L-value cannot be passed for 'out' or 'inout' parameters. ERROR: 0:40: 'out' : Non-L-value cannot be passed for 'out' or 'inout' parameters.
ERROR: 8 compilation errors. No code generated. ERROR: 8 compilation errors. No code generated.
@ -30,45 +30,75 @@ ERROR: node is still EOpNull!
0:22 'patch' (global float) 0:22 'patch' (global float)
0:22 Constant: 0:22 Constant:
0:22 3.100000 0:22 3.100000
0:36 Function Definition: foo( (global void) 0:38 Function Definition: foo( (global void)
0:36 Function Parameters: 0:38 Function Parameters:
0:38 Sequence 0:40 Sequence
0:38 Sequence 0:40 Sequence
0:38 move second child to first child (temp 2-component vector of float) 0:40 move second child to first child (temp 2-component vector of float)
0:38 'r1' (temp 2-component vector of float) 0:40 'r1' (temp 2-component vector of float)
0:38 modf (global 2-component vector of float) 0:40 modf (global 2-component vector of float)
0:38 vector swizzle (temp 2-component vector of float) 0:40 vector swizzle (temp 2-component vector of float)
0:38 'v' (smooth in 4-component vector of float) 0:40 'v' (smooth in 4-component vector of float)
0:38 Sequence 0:40 Sequence
0:38 Constant: 0:40 Constant:
0:38 0 (const int) 0:40 0 (const int)
0:38 Constant: 0:40 Constant:
0:38 1 (const int) 0:40 1 (const int)
0:38 vector swizzle (temp 2-component vector of float) 0:40 vector swizzle (temp 2-component vector of float)
0:38 'v' (smooth in 4-component vector of float) 0:40 'v' (smooth in 4-component vector of float)
0:38 Sequence 0:40 Sequence
0:38 Constant: 0:40 Constant:
0:38 2 (const int) 0:40 2 (const int)
0:38 Constant: 0:40 Constant:
0:38 3 (const int) 0:40 3 (const int)
0:39 Sequence 0:41 Sequence
0:39 move second child to first child (temp 2-component vector of float) 0:41 move second child to first child (temp 2-component vector of float)
0:39 'r2' (temp 2-component vector of float) 0:41 'r2' (temp 2-component vector of float)
0:39 modf (global 2-component vector of float) 0:41 modf (global 2-component vector of float)
0:39 vector swizzle (temp 2-component vector of float) 0:41 vector swizzle (temp 2-component vector of float)
0:39 'o' (out 4-component vector of float) 0:41 'o' (out 4-component vector of float)
0:39 Sequence 0:41 Sequence
0:39 Constant: 0:41 Constant:
0:39 0 (const int) 0:41 0 (const int)
0:39 Constant: 0:41 Constant:
0:39 1 (const int) 0:41 1 (const int)
0:39 vector swizzle (temp 2-component vector of float) 0:41 vector swizzle (temp 2-component vector of float)
0:39 'o' (out 4-component vector of float) 0:41 'o' (out 4-component vector of float)
0:39 Sequence 0:41 Sequence
0:39 Constant: 0:41 Constant:
0:39 2 (const int) 0:41 2 (const int)
0:39 Constant: 0:41 Constant:
0:39 3 (const int) 0:41 3 (const int)
0:42 move second child to first child (temp float)
0:42 direct index (temp float)
0:42 'o' (out 4-component vector of float)
0:42 Constant:
0:42 2 (const int)
0:42 Function Call: fooi( (global float)
0:47 Sequence
0:47 move second child to first child (temp float)
0:47 'i1' (global float)
0:47 Test condition and select (temp float)
0:47 Condition
0:47 'gl_FrontFacing' (gl_FrontFacing bool)
0:47 true case
0:47 Constant:
0:47 -2.000000
0:47 false case
0:47 Constant:
0:47 2.000000
0:48 Sequence
0:48 move second child to first child (temp float)
0:48 'i2' (global float)
0:48 Constant:
0:48 102.000000
0:50 Function Definition: fooi( (global float)
0:50 Function Parameters:
0:52 Sequence
0:52 Branch: Return with expression
0:52 add (temp float)
0:52 'i1' (global float)
0:52 'i2' (global float)
0:? Linker Objects 0:? Linker Objects
0:? 'v' (smooth in 4-component vector of float) 0:? 'v' (smooth in 4-component vector of float)
0:? 'i' (smooth in 4-component vector of float) 0:? 'i' (smooth in 4-component vector of float)
@ -81,6 +111,8 @@ ERROR: node is still EOpNull!
0:? 'factorBad' (layout(location=3 ) out 4-component vector of float) 0:? 'factorBad' (layout(location=3 ) out 4-component vector of float)
0:? 'factor' (layout(location=5 ) out 4-component vector of float) 0:? 'factor' (layout(location=5 ) out 4-component vector of float)
0:? 'vl2' (layout(location=4 ) smooth in 4-component vector of float) 0:? 'vl2' (layout(location=4 ) smooth in 4-component vector of float)
0:? 'i1' (global float)
0:? 'i2' (global float)
Linked fragment stage: Linked fragment stage:
@ -105,45 +137,75 @@ ERROR: node is still EOpNull!
0:22 'patch' (global float) 0:22 'patch' (global float)
0:22 Constant: 0:22 Constant:
0:22 3.100000 0:22 3.100000
0:36 Function Definition: foo( (global void) 0:38 Function Definition: foo( (global void)
0:36 Function Parameters: 0:38 Function Parameters:
0:38 Sequence 0:40 Sequence
0:38 Sequence 0:40 Sequence
0:38 move second child to first child (temp 2-component vector of float) 0:40 move second child to first child (temp 2-component vector of float)
0:38 'r1' (temp 2-component vector of float) 0:40 'r1' (temp 2-component vector of float)
0:38 modf (global 2-component vector of float) 0:40 modf (global 2-component vector of float)
0:38 vector swizzle (temp 2-component vector of float) 0:40 vector swizzle (temp 2-component vector of float)
0:38 'v' (smooth in 4-component vector of float) 0:40 'v' (smooth in 4-component vector of float)
0:38 Sequence 0:40 Sequence
0:38 Constant: 0:40 Constant:
0:38 0 (const int) 0:40 0 (const int)
0:38 Constant: 0:40 Constant:
0:38 1 (const int) 0:40 1 (const int)
0:38 vector swizzle (temp 2-component vector of float) 0:40 vector swizzle (temp 2-component vector of float)
0:38 'v' (smooth in 4-component vector of float) 0:40 'v' (smooth in 4-component vector of float)
0:38 Sequence 0:40 Sequence
0:38 Constant: 0:40 Constant:
0:38 2 (const int) 0:40 2 (const int)
0:38 Constant: 0:40 Constant:
0:38 3 (const int) 0:40 3 (const int)
0:39 Sequence 0:41 Sequence
0:39 move second child to first child (temp 2-component vector of float) 0:41 move second child to first child (temp 2-component vector of float)
0:39 'r2' (temp 2-component vector of float) 0:41 'r2' (temp 2-component vector of float)
0:39 modf (global 2-component vector of float) 0:41 modf (global 2-component vector of float)
0:39 vector swizzle (temp 2-component vector of float) 0:41 vector swizzle (temp 2-component vector of float)
0:39 'o' (out 4-component vector of float) 0:41 'o' (out 4-component vector of float)
0:39 Sequence 0:41 Sequence
0:39 Constant: 0:41 Constant:
0:39 0 (const int) 0:41 0 (const int)
0:39 Constant: 0:41 Constant:
0:39 1 (const int) 0:41 1 (const int)
0:39 vector swizzle (temp 2-component vector of float) 0:41 vector swizzle (temp 2-component vector of float)
0:39 'o' (out 4-component vector of float) 0:41 'o' (out 4-component vector of float)
0:39 Sequence 0:41 Sequence
0:39 Constant: 0:41 Constant:
0:39 2 (const int) 0:41 2 (const int)
0:39 Constant: 0:41 Constant:
0:39 3 (const int) 0:41 3 (const int)
0:42 move second child to first child (temp float)
0:42 direct index (temp float)
0:42 'o' (out 4-component vector of float)
0:42 Constant:
0:42 2 (const int)
0:42 Function Call: fooi( (global float)
0:47 Sequence
0:47 move second child to first child (temp float)
0:47 'i1' (global float)
0:47 Test condition and select (temp float)
0:47 Condition
0:47 'gl_FrontFacing' (gl_FrontFacing bool)
0:47 true case
0:47 Constant:
0:47 -2.000000
0:47 false case
0:47 Constant:
0:47 2.000000
0:48 Sequence
0:48 move second child to first child (temp float)
0:48 'i2' (global float)
0:48 Constant:
0:48 102.000000
0:50 Function Definition: fooi( (global float)
0:50 Function Parameters:
0:52 Sequence
0:52 Branch: Return with expression
0:52 add (temp float)
0:52 'i1' (global float)
0:52 'i2' (global float)
0:? Linker Objects 0:? Linker Objects
0:? 'v' (smooth in 4-component vector of float) 0:? 'v' (smooth in 4-component vector of float)
0:? 'i' (smooth in 4-component vector of float) 0:? 'i' (smooth in 4-component vector of float)
@ -156,4 +218,6 @@ ERROR: node is still EOpNull!
0:? 'factorBad' (layout(location=3 ) out 4-component vector of float) 0:? 'factorBad' (layout(location=3 ) out 4-component vector of float)
0:? 'factor' (layout(location=5 ) out 4-component vector of float) 0:? 'factor' (layout(location=5 ) out 4-component vector of float)
0:? 'vl2' (layout(location=4 ) smooth in 4-component vector of float) 0:? 'vl2' (layout(location=4 ) smooth in 4-component vector of float)
0:? 'i1' (global float)
0:? 'i2' (global float)

View File

@ -42,25 +42,6 @@ ERROR: node is still EOpNull!
0:24 'a' (in highp 4-component vector of float) 0:24 'a' (in highp 4-component vector of float)
0:25 Branch: Return with expression 0:25 Branch: Return with expression
0:25 'b' (temp highp 4-component vector of float) 0:25 'b' (temp highp 4-component vector of float)
0:42 Sequence
0:42 move second child to first child (temp highp int)
0:42 'a1' (global highp int)
0:42 Constant:
0:42 4 (const int)
0:43 Sequence
0:43 move second child to first child (temp highp int)
0:43 'a2' (global highp int)
0:43 Constant:
0:43 3 (const int)
0:44 Sequence
0:44 move second child to first child (temp highp int)
0:44 'a3' (global highp int)
0:44 Constant:
0:44 4 (const int)
0:45 Sequence
0:45 move second child to first child (temp highp int)
0:45 'a4' (global highp int)
0:45 'a2' (global highp int)
0:47 Sequence 0:47 Sequence
0:47 move second child to first child (temp highp int) 0:47 move second child to first child (temp highp int)
0:47 'q1' (global highp int) 0:47 'q1' (global highp int)
@ -81,15 +62,6 @@ ERROR: node is still EOpNull!
0:50 'q4' (global highp int) 0:50 'q4' (global highp int)
0:50 Constant: 0:50 Constant:
0:50 1 (const int) 0:50 1 (const int)
0:65 Sequence
0:65 move second child to first child (temp highp int)
0:65 'abdece' (global highp int)
0:65 Constant:
0:65 10 (const int)
0:66 Sequence
0:66 move second child to first child (temp highp int)
0:66 'aoeuntaoehu' (global highp int)
0:66 'abdece' (global highp int)
0:74 Sequence 0:74 Sequence
0:74 move second child to first child (temp highp float) 0:74 move second child to first child (temp highp float)
0:74 'funkyf' (global highp float) 0:74 'funkyf' (global highp float)
@ -162,16 +134,22 @@ ERROR: node is still EOpNull!
0:? Linker Objects 0:? Linker Objects
0:? 'foo' (global highp float) 0:? 'foo' (global highp float)
0:? 'goodDecl' (global highp int) 0:? 'goodDecl' (global highp int)
0:? 'a1' (global highp int) 0:? 'a1' (const highp int)
0:? 'a2' (global highp int) 0:? 4 (const int)
0:? 'a3' (global highp int) 0:? 'a2' (const highp int)
0:? 'a4' (global highp int) 0:? 3 (const int)
0:? 'a3' (const highp int)
0:? 4 (const int)
0:? 'a4' (const highp int)
0:? 3 (const int)
0:? 'q1' (global highp int) 0:? 'q1' (global highp int)
0:? 'q2' (global highp int) 0:? 'q2' (global highp int)
0:? 'q3' (global highp int) 0:? 'q3' (global highp int)
0:? 'q4' (global highp int) 0:? 'q4' (global highp int)
0:? 'abdece' (global highp int) 0:? 'abdece' (const highp int)
0:? 'aoeuntaoehu' (global highp int) 0:? 10 (const int)
0:? 'aoeuntaoehu' (const highp int)
0:? 10 (const int)
0:? 'funkyf' (global highp float) 0:? 'funkyf' (global highp float)
0:? 'funkyh' (global highp int) 0:? 'funkyh' (global highp int)
0:? 'funkyo' (global highp int) 0:? 'funkyo' (global highp int)
@ -208,25 +186,6 @@ ERROR: node is still EOpNull!
0:24 'a' (in highp 4-component vector of float) 0:24 'a' (in highp 4-component vector of float)
0:25 Branch: Return with expression 0:25 Branch: Return with expression
0:25 'b' (temp highp 4-component vector of float) 0:25 'b' (temp highp 4-component vector of float)
0:42 Sequence
0:42 move second child to first child (temp highp int)
0:42 'a1' (global highp int)
0:42 Constant:
0:42 4 (const int)
0:43 Sequence
0:43 move second child to first child (temp highp int)
0:43 'a2' (global highp int)
0:43 Constant:
0:43 3 (const int)
0:44 Sequence
0:44 move second child to first child (temp highp int)
0:44 'a3' (global highp int)
0:44 Constant:
0:44 4 (const int)
0:45 Sequence
0:45 move second child to first child (temp highp int)
0:45 'a4' (global highp int)
0:45 'a2' (global highp int)
0:47 Sequence 0:47 Sequence
0:47 move second child to first child (temp highp int) 0:47 move second child to first child (temp highp int)
0:47 'q1' (global highp int) 0:47 'q1' (global highp int)
@ -247,15 +206,6 @@ ERROR: node is still EOpNull!
0:50 'q4' (global highp int) 0:50 'q4' (global highp int)
0:50 Constant: 0:50 Constant:
0:50 1 (const int) 0:50 1 (const int)
0:65 Sequence
0:65 move second child to first child (temp highp int)
0:65 'abdece' (global highp int)
0:65 Constant:
0:65 10 (const int)
0:66 Sequence
0:66 move second child to first child (temp highp int)
0:66 'aoeuntaoehu' (global highp int)
0:66 'abdece' (global highp int)
0:74 Sequence 0:74 Sequence
0:74 move second child to first child (temp highp float) 0:74 move second child to first child (temp highp float)
0:74 'funkyf' (global highp float) 0:74 'funkyf' (global highp float)
@ -328,16 +278,22 @@ ERROR: node is still EOpNull!
0:? Linker Objects 0:? Linker Objects
0:? 'foo' (global highp float) 0:? 'foo' (global highp float)
0:? 'goodDecl' (global highp int) 0:? 'goodDecl' (global highp int)
0:? 'a1' (global highp int) 0:? 'a1' (const highp int)
0:? 'a2' (global highp int) 0:? 4 (const int)
0:? 'a3' (global highp int) 0:? 'a2' (const highp int)
0:? 'a4' (global highp int) 0:? 3 (const int)
0:? 'a3' (const highp int)
0:? 4 (const int)
0:? 'a4' (const highp int)
0:? 3 (const int)
0:? 'q1' (global highp int) 0:? 'q1' (global highp int)
0:? 'q2' (global highp int) 0:? 'q2' (global highp int)
0:? 'q3' (global highp int) 0:? 'q3' (global highp int)
0:? 'q4' (global highp int) 0:? 'q4' (global highp int)
0:? 'abdece' (global highp int) 0:? 'abdece' (const highp int)
0:? 'aoeuntaoehu' (global highp int) 0:? 10 (const int)
0:? 'aoeuntaoehu' (const highp int)
0:? 10 (const int)
0:? 'funkyf' (global highp float) 0:? 'funkyf' (global highp float)
0:? 'funkyh' (global highp int) 0:? 'funkyh' (global highp int)
0:? 'funkyo' (global highp int) 0:? 'funkyo' (global highp int)

View File

@ -42,25 +42,6 @@ ERROR: node is still EOpNull!
0:24 'a' (in highp 4-component vector of float) 0:24 'a' (in highp 4-component vector of float)
0:25 Branch: Return with expression 0:25 Branch: Return with expression
0:25 'b' (temp highp 4-component vector of float) 0:25 'b' (temp highp 4-component vector of float)
0:40 Sequence
0:40 move second child to first child (temp highp int)
0:40 'a1' (global highp int)
0:40 Constant:
0:40 4 (const int)
0:41 Sequence
0:41 move second child to first child (temp highp int)
0:41 'a2' (global highp int)
0:41 Constant:
0:41 3 (const int)
0:42 Sequence
0:42 move second child to first child (temp highp int)
0:42 'a3' (global highp int)
0:42 Constant:
0:42 4 (const int)
0:43 Sequence
0:43 move second child to first child (temp highp int)
0:43 'a4' (global highp int)
0:43 'a2' (global highp int)
0:45 Sequence 0:45 Sequence
0:45 move second child to first child (temp highp int) 0:45 move second child to first child (temp highp int)
0:45 'q1' (global highp int) 0:45 'q1' (global highp int)
@ -83,10 +64,14 @@ ERROR: node is still EOpNull!
0:48 1 (const int) 0:48 1 (const int)
0:? Linker Objects 0:? Linker Objects
0:? 'foo' (global highp float) 0:? 'foo' (global highp float)
0:? 'a1' (global highp int) 0:? 'a1' (const highp int)
0:? 'a2' (global highp int) 0:? 4 (const int)
0:? 'a3' (global highp int) 0:? 'a2' (const highp int)
0:? 'a4' (global highp int) 0:? 3 (const int)
0:? 'a3' (const highp int)
0:? 4 (const int)
0:? 'a4' (const highp int)
0:? 3 (const int)
0:? 'q1' (global highp int) 0:? 'q1' (global highp int)
0:? 'q2' (global highp int) 0:? 'q2' (global highp int)
0:? 'q3' (global highp int) 0:? 'q3' (global highp int)
@ -115,25 +100,6 @@ ERROR: node is still EOpNull!
0:24 'a' (in highp 4-component vector of float) 0:24 'a' (in highp 4-component vector of float)
0:25 Branch: Return with expression 0:25 Branch: Return with expression
0:25 'b' (temp highp 4-component vector of float) 0:25 'b' (temp highp 4-component vector of float)
0:40 Sequence
0:40 move second child to first child (temp highp int)
0:40 'a1' (global highp int)
0:40 Constant:
0:40 4 (const int)
0:41 Sequence
0:41 move second child to first child (temp highp int)
0:41 'a2' (global highp int)
0:41 Constant:
0:41 3 (const int)
0:42 Sequence
0:42 move second child to first child (temp highp int)
0:42 'a3' (global highp int)
0:42 Constant:
0:42 4 (const int)
0:43 Sequence
0:43 move second child to first child (temp highp int)
0:43 'a4' (global highp int)
0:43 'a2' (global highp int)
0:45 Sequence 0:45 Sequence
0:45 move second child to first child (temp highp int) 0:45 move second child to first child (temp highp int)
0:45 'q1' (global highp int) 0:45 'q1' (global highp int)
@ -156,10 +122,14 @@ ERROR: node is still EOpNull!
0:48 1 (const int) 0:48 1 (const int)
0:? Linker Objects 0:? Linker Objects
0:? 'foo' (global highp float) 0:? 'foo' (global highp float)
0:? 'a1' (global highp int) 0:? 'a1' (const highp int)
0:? 'a2' (global highp int) 0:? 4 (const int)
0:? 'a3' (global highp int) 0:? 'a2' (const highp int)
0:? 'a4' (global highp int) 0:? 3 (const int)
0:? 'a3' (const highp int)
0:? 4 (const int)
0:? 'a4' (const highp int)
0:? 3 (const int)
0:? 'q1' (global highp int) 0:? 'q1' (global highp int)
0:? 'q2' (global highp int) 0:? 'q2' (global highp int)
0:? 'q3' (global highp int) 0:? 'q3' (global highp int)

View File

@ -39,10 +39,10 @@ FOO
#define C int q3 = $ 1 #define C int q3 = $ 1
#define D int q4 = @ 1 #define D int q4 = @ 1
int a1 = \ 4; // ERROR const highp int a1 = \ 4; // ERROR
int a2 = @ 3; // ERROR const highp int a2 = @ 3; // ERROR
int a3 = $4; // ERROR const highp int a3 = $4; // ERROR
int a4 = a2\; // ERROR const highp int a4 = a2\; // ERROR
A; A;
B; B;
@ -62,8 +62,8 @@ D;
// anoetuh nonaetu \\\\\\ // anoetuh nonaetu \\\\\\
still in comment still in comment
int abdece = 10; const int abdece = 10;
int aoeuntaoehu = abd\ const int aoeuntaoehu = abd\
\ \
\ \
\ \

View File

@ -37,10 +37,10 @@ vec4 foo2(vec4 a)
#define C int q3 = $ 1 #define C int q3 = $ 1
#define D int q4 = @ 1 #define D int q4 = @ 1
int a1 = \ 4; // ERROR const highp int a1 = \ 4; // ERROR
int a2 = @ 3; // ERROR const highp int a2 = @ 3; // ERROR
int a3 = $4; // ERROR const highp int a3 = $4; // ERROR
int a4 = a2\; // ERROR const highp int a4 = a2\; // ERROR
A; A;
B; B;

View File

@ -4154,6 +4154,15 @@ TIntermNode* TParseContext::executeInitializer(TSourceLoc loc, TString& identifi
variable->getWritableType().getQualifier().storage = EvqConstReadOnly; variable->getWritableType().getQualifier().storage = EvqConstReadOnly;
qualifier = EvqConstReadOnly; qualifier = EvqConstReadOnly;
} }
} else {
// Non-const global variables in ES need a const initializer.
//
// "In declarations of global variables with no storage qualifier or with a const
// qualifier any initializer must be a constant expression."
if (symbolTable.atGlobalLevel() && initializer->getType().getQualifier().storage != EvqConst) {
const char* initFeature = "non-constant global initializer";
requireProfile(loc, ~EEsProfile, initFeature);
}
} }
if (qualifier == EvqConst || qualifier == EvqUniform) { if (qualifier == EvqConst || qualifier == EvqUniform) {