Improve robustness of extension checking, and its intersection with ES 100 features.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23388 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2013-10-04 21:09:36 +00:00
parent c6b7e6350b
commit 816e9bc90b
13 changed files with 365 additions and 92 deletions

45
Test/100.frag Normal file
View File

@@ -0,0 +1,45 @@
#version 100
int a[3] = { 2, 3, 4, }; // ERROR
int uint;
attribute vec4 v[3]; // ERROR
float f = 2; // ERROR
uniform block { // ERROR
int x;
};
void foo(float);
void main()
{
foo(3); // ERROR
int s = 1 << 4; // ERROR
s = 16 >> 2; // ERROR
if (a == a); // ERROR
int b, c;
b = c & 4; // ERROR
b = c % 4; // ERROR
b = c | 4; // ERROR
b >>= 2; // ERROR
b <<= 2; // ERROR
b %= 3; // ERROR
struct S {
float f;
float a[10];
} s1, s2;
s1 = s2; // ERROR
if (s1 == s2); // ERROR
if (s1 != s2); // ERROR
switch(b) { // ERROR
}
}
invariant gl_FragColor;
float fa[]; // ERROR

View File

@@ -21,7 +21,7 @@ void main()
gu[2] = 4.0; // ERROR, overflow
}
g4 = foo(g5);
g4 = foo(g5); // ERROR
g5 = g4; // ERROR
gu = g4; // ERROR

View File

@@ -0,0 +1,100 @@
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: '=' : cannot convert from 'const int' to '3-element array of mediump int'
ERROR: 0:7: 'attribute' : not supported in this stage: fragment
ERROR: 0:7: 'float' : type requires declaration of default precision qualifier
ERROR: 0:9: '=' : cannot convert from 'const int' to 'mediump float'
ERROR: 0:11: 'uniform block' : not supported for this version or the enabled extensions
ERROR: 0:19: 'foo' : no matching overloaded function found
ERROR: 0:20: 'bit shift left' : not supported for this version or the enabled extensions
ERROR: 0:21: 'bit shift right' : not supported for this version or the enabled extensions
ERROR: 0:22: 'array comparison' : not supported for this version or the enabled extensions
ERROR: 0:24: 'bitwise and' : not supported for this version or the enabled extensions
ERROR: 0:25: '%' : not supported for this version or the enabled extensions
ERROR: 0:26: 'bitwise inclusive or' : not supported for this version or the enabled extensions
ERROR: 0:27: 'bit-shift right assign' : not supported for this version or the enabled extensions
ERROR: 0:28: 'bit-shift left assign' : not supported for this version or the enabled extensions
ERROR: 0:29: '%=' : not supported for this version or the enabled extensions
ERROR: 0:36: 'array assignment' : not supported for this version or the enabled extensions
ERROR: 0:37: 'array comparison' : not supported for this version or the enabled extensions
ERROR: 0:38: 'array comparison' : not supported for this version or the enabled extensions
ERROR: 0:40: 'switch' : Reserved word.
ERROR: 0:40: 'switch statements' : not supported for this version or the enabled extensions
ERROR: 0:45: '' : array size required
ERROR: 23 compilation errors. No code generated.
ERROR: node is still EOpNull!
0:17 Function Definition: main( (void)
0:17 Function Parameters:
0:19 Sequence
0:19 Constant:
0:19 0.000000
0:20 Sequence
0:20 move second child to first child (mediump int)
0:20 's' (mediump int)
0:20 Constant:
0:20 16 (const int)
0:21 move second child to first child (mediump int)
0:21 's' (mediump int)
0:21 Constant:
0:21 4 (const int)
0:22 Test condition and select (void)
0:22 Condition
0:22 Compare Equal (bool)
0:22 'a' (3-element array of mediump int)
0:22 'a' (3-element array of mediump int)
0:22 true case is null
0:24 move second child to first child (mediump int)
0:24 'b' (mediump int)
0:24 bitwise and (mediump int)
0:24 'c' (mediump int)
0:24 Constant:
0:24 4 (const int)
0:25 move second child to first child (mediump int)
0:25 'b' (mediump int)
0:25 mod (mediump int)
0:25 'c' (mediump int)
0:25 Constant:
0:25 4 (const int)
0:26 move second child to first child (mediump int)
0:26 'b' (mediump int)
0:26 inclusive-or (mediump int)
0:26 'c' (mediump int)
0:26 Constant:
0:26 4 (const int)
0:27 right shift second child into first child (mediump int)
0:27 'b' (mediump int)
0:27 Constant:
0:27 2 (const int)
0:28 left shift second child into first child (mediump int)
0:28 'b' (mediump int)
0:28 Constant:
0:28 2 (const int)
0:29 mod second child into first child (mediump int)
0:29 'b' (mediump int)
0:29 Constant:
0:29 3 (const int)
0:36 move second child to first child (structure)
0:36 's1' (structure)
0:36 's2' (structure)
0:37 Test condition and select (void)
0:37 Condition
0:37 Compare Equal (bool)
0:37 's1' (structure)
0:37 's2' (structure)
0:37 true case is null
0:38 Test condition and select (void)
0:38 Condition
0:38 Compare Not Equal (bool)
0:38 's1' (structure)
0:38 's2' (structure)
0:38 true case is null
0:40 'b' (mediump int)
0:? Linker Objects
0:? 'a' (3-element array of mediump int)
0:? 'uint' (mediump int)
0:? 'v' (smooth in 3-element array of mediump 4-component vector of float)
0:? 'f' (mediump float)
0:? '__anon__0' (layout(shared ) uniform block)
0:? 'fa' (unsized array of mediump float)

View File

@@ -4,14 +4,18 @@ ERROR: 0:9: 'arrayed type' : not supported for this version or the enabled exten
ERROR: 0:9: 'arrayed type' : not supported for this version or the enabled extensions
ERROR: 0:11: 'arrayed constructor' : not supported for this version or the enabled extensions
ERROR: 0:21: '[' : array index out of range '2'
ERROR: 0:24: 'array assignment' : not supported for this version or the enabled extensions
ERROR: 0:25: 'array assignment' : not supported for this version or the enabled extensions
ERROR: 0:25: 'assign' : cannot convert from '4-element array of mediump float' to '5-element array of mediump float'
ERROR: 0:26: 'array assignment' : not supported for this version or the enabled extensions
ERROR: 0:26: 'assign' : cannot convert from '4-element array of mediump float' to 'unsized array of mediump float'
ERROR: 0:28: 'foo' : no matching overloaded function found
ERROR: 0:31: 'arrayed constructor' : not supported for this version or the enabled extensions
ERROR: 0:31: 'array comparison' : not supported for this version or the enabled extensions
ERROR: 0:35: '[' : array index out of range '5'
ERROR: 0:38: '[' : array index out of range '1000'
ERROR: 0:39: '[' : array index out of range '-1'
ERROR: 13 compilation errors. No code generated.
ERROR: 17 compilation errors. No code generated.
ERROR: node is still EOpNull!
0:9 Function Definition: foo(f1[5]; (4-element array of mediump float)
@@ -86,9 +90,9 @@ ERROR: node is still EOpNull!
0:35 5.000000
0:36 Function Call: foo(f1[5]; (4-element array of mediump float)
0:36 'u' (5-element array of mediump float)
0:38 move second child to first child (4-component vector of float)
0:38 direct index (fragColor 4-component vector of float)
0:38 'gl_FragData' (fragColor 32-element array of 4-component vector of float)
0:38 move second child to first child (mediump 4-component vector of float)
0:38 direct index (fragColor mediump 4-component vector of float)
0:38 'gl_FragData' (fragColor 32-element array of mediump 4-component vector of float)
0:38 Constant:
0:38 1000 (const int)
0:38 Constant:
@@ -96,9 +100,9 @@ ERROR: node is still EOpNull!
0:38 1.000000
0:38 1.000000
0:38 1.000000
0:39 move second child to first child (4-component vector of float)
0:39 direct index (fragColor 4-component vector of float)
0:39 'gl_FragData' (fragColor 32-element array of 4-component vector of float)
0:39 move second child to first child (mediump 4-component vector of float)
0:39 direct index (fragColor mediump 4-component vector of float)
0:39 'gl_FragData' (fragColor 32-element array of mediump 4-component vector of float)
0:39 Constant:
0:39 -1 (const int)
0:39 Constant:
@@ -106,9 +110,9 @@ ERROR: node is still EOpNull!
0:39 1.000000
0:39 1.000000
0:39 1.000000
0:40 move second child to first child (4-component vector of float)
0:40 direct index (fragColor 4-component vector of float)
0:40 'gl_FragData' (fragColor 32-element array of 4-component vector of float)
0:40 move second child to first child (mediump 4-component vector of float)
0:40 direct index (fragColor mediump 4-component vector of float)
0:40 'gl_FragData' (fragColor 32-element array of mediump 4-component vector of float)
0:40 Constant:
0:40 3 (const int)
0:40 Constant:

View File

@@ -7,6 +7,7 @@ versionsClean.frag
versionsClean.vert
versionsErrors.frag
versionsErrors.vert
100.frag
120.vert
120.frag
130.frag