Semantic checks for .length(), switch/case/default, and multidimensional arrays.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22175 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2013-06-26 05:54:40 +00:00
parent ef84d10e4c
commit e369bfccfe
9 changed files with 144 additions and 71 deletions

View File

@@ -1,15 +1,15 @@
#version 120
in vec4 i;
out vec4 o;
in vec4 i; // ERROR
out vec4 o; // ERROR
attribute vec2 attv2;
attribute vec4 attv4;
uniform sampler2D s2D;
invariant varying vec2 centTexCoord;
invariant gl_Position;
centroid gl_Position;
centroid centroid foo;
centroid gl_Position; // ERROR
centroid centroid foo; // ERROR
invariant gl_Position, gl_PointSize;
void main()
@@ -22,11 +22,29 @@ void main()
gl_Position = b[b.length()-1];
float f[];
int a = f.length();
int a1 = f.length(); // ERROR
float f[7];
int aa = f.length();
int a2 = f.length; // ERROR
int a3 = f.length(a); // ERROR
int a4 = f.flizbit; // ERROR
int a4 = f.flizbit(); // ERROR
float md[2][4]; // ERROR
float[2] md2[4]; // ERROR
float[2][4] md3; // ERROR
float md5, md6[2][3]; // ERROR
float[2] md4, md7[4]; // ERROR
float md9[2][3] = float[2][3](1, 2, 3, 4, 5, 6); // ERROR
float md10, md11[2][3] = float[2][3](1, 2, 3, 4, 5, 6); // ERROR
gl_PointSize = 3.8;
}
uniform float initted = 3.4;
uniform float initted = 3.4; // okay
const float concall = sin(0.3);
int[2][3] foo( // ERROR
float[2][3] a, // ERROR
float[2] b[3], // ERROR
float c[2][3]); // ERROR

View File

@@ -97,5 +97,11 @@ void main()
atanh(c3D);
}
uniform multi {
int[2] a[3]; // ERROR
int[2][3] b; // ERROR
int c[2][3]; // ERROR
} multiInst[2][3]; // ERROR
float imageBuffer; // ERROR, reserved
float uimage2DRect; // ERROR, reserved

View File

@@ -8,37 +8,39 @@ void main()
float f;
int a[2];
switch(f) { // ERROR
switch(f) { // ERROR
}
switch(a) { // ERROR
switch(a) { // ERROR
}
switch(c)
{
}
switch(c)
switch(c) // ERROR, not enough stuff after last label
{
case 2: // ERROR, not enough stuff
case 2:
}
switch(c)
{
f = sin(x); // ERRROR
case 2: // ERROR, not enough stuff
f = sin(x); // ERRROR
case 2:
f = cos(x);
break;
}
switch (c) {
default:
break;
case 1:
f = sin(x);
break;
case 2:
f = cos(x);
break;
default:
default: // ERROR, 2nd default
f = tan(x);
}
@@ -58,7 +60,31 @@ void main()
break;
default:
f = tan(x);
case 1: // ERROR, 2nd 'case 1'
break;
case 3.8: // ERROR, non-int
break;
case c: // ERROR, non-constant
break;
}
break; // ERROR
switch (c) { // a no-error normal switch
case 1:
f = sin(x);
break;
case 2:
switch (d) {
case 1:
f = x * x * x;
break;
case 2:
f = x * x;
break;
}
break;
default:
f = tan(x);
}
break; // ERROR
}