Simultaneously fix only known memory leak and take the next step in supporting arrays of arrays. Improved several minor things along the way.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20514 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2013-02-11 00:54:44 +00:00
parent 6968b823ef
commit dadf945fd7
14 changed files with 274 additions and 109 deletions

57
Test/array.frag Normal file
View File

@@ -0,0 +1,57 @@
#version 130
float gu[];
float g4[4];
float g5[5];
uniform int a;
float[4] foo(float a[5])
{
return float[](a[0], a[1], a[2], a[3]);
}
void bar(float[5]) {}
void main()
{
{
float gu[2]; // okay, new scope
gu[2] = 4.0; // ERROR, overflow
}
gu[2] = 4.0; // okay
gu[3] = 3.0;
gu[a] = 5.0; // ERROR
g4 = foo(g5);
g5 = g4; // ERROR
gu = g4; // ERROR
foo(gu); // ERROR
bar(g5);
if (float[4](1.0, 2.0, 3.0, 4.0) == g4)
gu[0] = 2.0;
float u[];
u[2] = 3.0; // okay
float u[5];
u[5] = 5.0; // ERROR
foo(u); // okay
gl_FragData[1000] = vec4(1.0); // ERROR
gl_FragData[-1] = vec4(1.0); // ERROR
gl_FragData[3] = vec4(1.0);
const int ca[] = int[](3, 2);
int sum = ca[0];
sum += ca[1];
sum += ca[2]; // ERROR
const int ca3[3] = int[](3, 2); // ERROR
int ica[] = int[](3, 2);
int ica3[3] = int[](3, 2); // ERROR
}

48
Test/array100.frag Normal file
View File

@@ -0,0 +1,48 @@
#version 100
float gu[];
float g4[4];
float g5[5];
uniform int a;
float[4] foo(float[5] a) // ERROR // ERROR
{
return float[](a[0], a[1], a[2], a[3]); // ERROR
}
void bar(float[5]) {}
void main()
{
{
float gu[2]; // okay, new scope
gu[2] = 4.0; // ERROR, overflow
}
gu[2] = 4.0; // okay
gu[3] = 3.0;
gu[a] = 5.0; // ERROR
g4 = foo(g5);
g5 = g4; // ERROR
gu = g4; // ERROR
foo(gu); // ERROR
bar(g5);
if (float[4](1.0, 2.0, 3.0, 4.0) == g4) // ERROR
gu[0] = 2.0;
float u[];
u[2] = 3.0; // okay
float u[5];
u[5] = 5.0; // ERROR
foo(u); // okay
gl_FragData[1000] = vec4(1.0); // ERROR
gl_FragData[-1] = vec4(1.0); // ERROR
gl_FragData[3] = vec4(1.0);
}

View File

@@ -17,3 +17,5 @@ cppIndent.vert
cppNest.vert
cppComplexExpr.vert
pointCoord.frag
array.frag
array100.frag