[Piglit] [PATCH 3/3] glsl-1.50: Port over basic UBO tests from glsl 1.40 VS to glsl 1.50 GS

Eric Anholt eric at anholt.net
Mon Jun 17 13:34:50 PDT 2013


gs-struct-array-complicated is currently crashing in Mesa, and
gs-struct-pad is broken like it is for VS/FS.
---
 .../uniform_buffer/gs-array-copy.shader_test       |  64 +++++++++
 .../glsl-1.50/uniform_buffer/gs-basic.shader_test  |  57 ++++++++
 .../glsl-1.50/uniform_buffer/gs-bools.shader_test  |  63 +++++++++
 .../gs-float-array-const-index.shader_test         |  60 +++++++++
 .../gs-float-array-variable-index.shader_test      |  67 ++++++++++
 .../glsl-1.50/uniform_buffer/gs-floats.shader_test |  63 +++++++++
 .../uniform_buffer/gs-mat4-row-major.shader_test   |  57 ++++++++
 .../glsl-1.50/uniform_buffer/gs-mat4.shader_test   |  57 ++++++++
 .../gs-struct-copy-complicated.shader_test         | 144 +++++++++++++++++++++
 .../uniform_buffer/gs-struct-copy.shader_test      |  66 ++++++++++
 .../uniform_buffer/gs-struct-pad.shader_test       |  70 ++++++++++
 .../glsl-1.50/uniform_buffer/gs-struct.shader_test |  65 ++++++++++
 .../uniform_buffer/gs-two-members.shader_test      |  59 +++++++++
 13 files changed, 892 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/uniform_buffer/gs-array-copy.shader_test
 create mode 100644 tests/spec/glsl-1.50/uniform_buffer/gs-basic.shader_test
 create mode 100644 tests/spec/glsl-1.50/uniform_buffer/gs-bools.shader_test
 create mode 100644 tests/spec/glsl-1.50/uniform_buffer/gs-float-array-const-index.shader_test
 create mode 100644 tests/spec/glsl-1.50/uniform_buffer/gs-float-array-variable-index.shader_test
 create mode 100644 tests/spec/glsl-1.50/uniform_buffer/gs-floats.shader_test
 create mode 100644 tests/spec/glsl-1.50/uniform_buffer/gs-mat4-row-major.shader_test
 create mode 100644 tests/spec/glsl-1.50/uniform_buffer/gs-mat4.shader_test
 create mode 100644 tests/spec/glsl-1.50/uniform_buffer/gs-struct-copy-complicated.shader_test
 create mode 100644 tests/spec/glsl-1.50/uniform_buffer/gs-struct-copy.shader_test
 create mode 100644 tests/spec/glsl-1.50/uniform_buffer/gs-struct-pad.shader_test
 create mode 100644 tests/spec/glsl-1.50/uniform_buffer/gs-struct.shader_test
 create mode 100644 tests/spec/glsl-1.50/uniform_buffer/gs-two-members.shader_test

diff --git a/tests/spec/glsl-1.50/uniform_buffer/gs-array-copy.shader_test b/tests/spec/glsl-1.50/uniform_buffer/gs-array-copy.shader_test
new file mode 100644
index 0000000..5c53504
--- /dev/null
+++ b/tests/spec/glsl-1.50/uniform_buffer/gs-array-copy.shader_test
@@ -0,0 +1,64 @@
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+	vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform int j;
+uniform ubo1 {
+	vec4 colors[4];
+};
+
+in vec4 vertex_to_gs[3];
+out vec4 v;
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = vertex_to_gs[i];
+		vec4 temp[4] = colors;
+		temp[0] = vec4(1.0, 0.0, 0.0, 0.0);
+		v = temp[j];
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150
+
+in vec4 v;
+
+void main()
+{
+	gl_FragColor = v;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform int j 1
+uniform vec4 colors[0] 0.0 0.0 0.0 0.0
+uniform vec4 colors[1] 0.0 1.0 0.0 0.0
+uniform vec4 colors[2] 0.0 1.0 1.0 0.0
+uniform vec4 colors[3] 1.0 0.0 1.0 0.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/glsl-1.50/uniform_buffer/gs-basic.shader_test b/tests/spec/glsl-1.50/uniform_buffer/gs-basic.shader_test
new file mode 100644
index 0000000..4af0730
--- /dev/null
+++ b/tests/spec/glsl-1.50/uniform_buffer/gs-basic.shader_test
@@ -0,0 +1,57 @@
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+	vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform ubo1 {
+	vec4 color;
+};
+
+in vec4 vertex_to_gs[3];
+out vec4 v;
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = vertex_to_gs[i];
+		v = color;
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150
+
+in vec4 v;
+
+void main()
+{
+	gl_FragColor = v;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform vec4 color 0.0 1.0 0.0 0.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/glsl-1.50/uniform_buffer/gs-bools.shader_test b/tests/spec/glsl-1.50/uniform_buffer/gs-bools.shader_test
new file mode 100644
index 0000000..221abe8
--- /dev/null
+++ b/tests/spec/glsl-1.50/uniform_buffer/gs-bools.shader_test
@@ -0,0 +1,63 @@
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+	vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform ubo1 {
+	bool r;
+	bool g;
+	bool b;
+	bool a;
+};
+
+in vec4 vertex_to_gs[3];
+out vec4 v;
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = vertex_to_gs[i];
+		v = vec4(r, g, b, a);
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150
+
+in vec4 v;
+
+void main()
+{
+	gl_FragColor = v;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform int r 0
+uniform int g 1
+uniform int b 2
+uniform int a 0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 1.0 0.0
diff --git a/tests/spec/glsl-1.50/uniform_buffer/gs-float-array-const-index.shader_test b/tests/spec/glsl-1.50/uniform_buffer/gs-float-array-const-index.shader_test
new file mode 100644
index 0000000..5506f68
--- /dev/null
+++ b/tests/spec/glsl-1.50/uniform_buffer/gs-float-array-const-index.shader_test
@@ -0,0 +1,60 @@
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+	vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform ubo1 {
+	float f[4];
+};
+
+in vec4 vertex_to_gs[3];
+out vec4 v;
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = vertex_to_gs[i];
+		v = vec4(f[0], f[1], f[2], f[3]);
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150
+
+in vec4 v;
+
+void main()
+{
+	gl_FragColor = v;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform float f[0] 0.0
+uniform float f[1] 1.0
+uniform float f[2] 0.0
+uniform float f[3] 0.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/glsl-1.50/uniform_buffer/gs-float-array-variable-index.shader_test b/tests/spec/glsl-1.50/uniform_buffer/gs-float-array-variable-index.shader_test
new file mode 100644
index 0000000..a3c6032
--- /dev/null
+++ b/tests/spec/glsl-1.50/uniform_buffer/gs-float-array-variable-index.shader_test
@@ -0,0 +1,67 @@
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+	vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform int ri, gi, bi, ai;
+
+uniform ubo1 {
+	float f[4];
+};
+
+in vec4 vertex_to_gs[3];
+out vec4 v;
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = vertex_to_gs[i];
+		v = vec4(f[ri], f[gi], f[bi], f[ai]);
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150
+
+in vec4 v;
+
+void main()
+{
+	gl_FragColor = v;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform int ri 0
+uniform int gi 1
+uniform int bi 2
+uniform int ai 3
+
+uniform float f[0] 0.0
+uniform float f[1] 1.0
+uniform float f[2] 0.0
+uniform float f[3] 0.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/glsl-1.50/uniform_buffer/gs-floats.shader_test b/tests/spec/glsl-1.50/uniform_buffer/gs-floats.shader_test
new file mode 100644
index 0000000..02be6c6
--- /dev/null
+++ b/tests/spec/glsl-1.50/uniform_buffer/gs-floats.shader_test
@@ -0,0 +1,63 @@
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+	vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform ubo1 {
+	float r;
+	float g;
+	float b;
+	float a;
+};
+
+in vec4 vertex_to_gs[3];
+out vec4 v;
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = vertex_to_gs[i];
+		v = vec4(r, g, b, a);
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150
+
+in vec4 v;
+
+void main()
+{
+	gl_FragColor = v;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform float r 0.0
+uniform float g 1.0
+uniform float b 0.0
+uniform float a 0.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/glsl-1.50/uniform_buffer/gs-mat4-row-major.shader_test b/tests/spec/glsl-1.50/uniform_buffer/gs-mat4-row-major.shader_test
new file mode 100644
index 0000000..7ee7813
--- /dev/null
+++ b/tests/spec/glsl-1.50/uniform_buffer/gs-mat4-row-major.shader_test
@@ -0,0 +1,57 @@
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+	vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform ubo1 {
+	layout(row_major) mat4 m;
+};
+
+in vec4 vertex_to_gs[3];
+out vec4 v;
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = vertex_to_gs[i];
+		v = m[0] + m[1] + m[2] + m[3];
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150
+
+in vec4 v;
+
+void main()
+{
+	gl_FragColor = v;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform mat4 m 0.25 0.0 0.0 0.0   0.0 0.0 0.75 0.0   0.0 0.5 0.0 0.0   0.0 0.0 0.0 1.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.25 0.5 0.75 1.0
diff --git a/tests/spec/glsl-1.50/uniform_buffer/gs-mat4.shader_test b/tests/spec/glsl-1.50/uniform_buffer/gs-mat4.shader_test
new file mode 100644
index 0000000..d2e1c61
--- /dev/null
+++ b/tests/spec/glsl-1.50/uniform_buffer/gs-mat4.shader_test
@@ -0,0 +1,57 @@
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+	vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform ubo1 {
+	mat4 m;
+};
+
+in vec4 vertex_to_gs[3];
+out vec4 v;
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = vertex_to_gs[i];
+		v = m[0] + m[1] + m[2] + m[3];
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150
+
+in vec4 v;
+
+void main()
+{
+	gl_FragColor = v;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform mat4 m 0.25 0.0 0.0 0.0   0.0 0.0 0.75 0.0   0.0 0.5 0.0 0.0   0.0 0.0 0.0 1.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.25 0.5 0.75 1.0
diff --git a/tests/spec/glsl-1.50/uniform_buffer/gs-struct-copy-complicated.shader_test b/tests/spec/glsl-1.50/uniform_buffer/gs-struct-copy-complicated.shader_test
new file mode 100644
index 0000000..f518377
--- /dev/null
+++ b/tests/spec/glsl-1.50/uniform_buffer/gs-struct-copy-complicated.shader_test
@@ -0,0 +1,144 @@
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+	vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+struct S2 {
+	vec2 v2;
+	mat2 m22[2];
+};
+
+uniform ubo1 {
+	struct S {
+		S2 arr[2];
+		vec3 v3;
+		bool b;
+	} s[2];
+};
+
+in vec4 vertex_to_gs[3];
+out vec4 v;
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = vertex_to_gs[i];
+
+		S temp[2] = s;
+
+		/* Try to prevent copy propagation */
+		temp[0].arr[0].v2 = vec2(0.01, 0.02);
+
+		v = vec4(0, 1, 0, 0);
+
+		if (temp[0].arr[0].v2 != vec2(0.01, 0.02))
+			v = vec4(0.02, 0, temp[0].arr[0].v2);
+		else if (temp[0].arr[0].m22[0][0] != vec2(0.03, 0.04))
+			v = vec4(0.04, 0, temp[0].arr[0].m22[0][0]);
+		else if (temp[0].arr[0].m22[0][1] != vec2(0.05, 0.06))
+			v = vec4(0.06, 0, temp[0].arr[0].m22[0][1]);
+		else if (temp[0].arr[0].m22[1][0] != vec2(0.07, 0.08))
+			v = vec4(0.08, 0, temp[0].arr[0].m22[1][0]);
+		else if (temp[0].arr[0].m22[1][1] != vec2(0.09, 0.10))
+			v = vec4(0.10, 0, temp[0].arr[0].m22[1][1]);
+
+		else if (temp[0].arr[1].v2 != vec2(0.21, 0.22))
+			v = vec4(0.22, 0, temp[0].arr[1].v2);
+		else if (temp[0].arr[1].m22[0][0] != vec2(0.23, 0.24))
+			v = vec4(0.24, 0, temp[0].arr[1].m22[0][0]);
+		else if (temp[0].arr[1].m22[0][1] != vec2(0.25, 0.26))
+			v = vec4(0.26, 0, temp[0].arr[1].m22[0][1]);
+		else if (temp[0].arr[1].m22[1][0] != vec2(0.27, 0.28))
+			v = vec4(0.28, 0, temp[0].arr[1].m22[1][0]);
+		else if (temp[0].arr[1].m22[1][1] != vec2(0.29, 0.30))
+			v = vec4(0.30, 0, temp[0].arr[1].m22[1][1]);
+
+		else if (temp[0].v3 != vec3(0.31, 0.32, 0.33))
+			v = vec4(0.32, temp[0].v3);
+		else if (temp[0].b != false)
+			v = vec4(0.34, 0, 0, temp[0].b);
+
+		else if (temp[1].arr[0].v2 != vec2(0.41, 0.42))
+			v = vec4(0.42, 0, temp[1].arr[0].v2);
+		else if (temp[1].arr[0].m22[0][0] != vec2(0.43, 0.44))
+			v = vec4(0.44, 0, temp[1].arr[0].m22[0][0]);
+		else if (temp[1].arr[0].m22[0][1] != vec2(0.45, 0.46))
+			v = vec4(0.46, 0, temp[1].arr[0].m22[0][1]);
+		else if (temp[1].arr[0].m22[1][0] != vec2(0.47, 0.48))
+			v = vec4(0.48, 0, temp[1].arr[0].m22[1][0]);
+		else if (temp[1].arr[0].m22[1][1] != vec2(0.49, 0.50))
+			v = vec4(0.50, 0, temp[1].arr[0].m22[1][1]);
+
+		else if (temp[1].arr[1].v2 != vec2(0.61, 0.62))
+			v = vec4(0.62, 0, temp[1].arr[1].v2);
+		else if (temp[1].arr[1].m22[0][0] != vec2(0.63, 0.64))
+			v = vec4(0.64, 0, temp[1].arr[1].m22[0][0]);
+		else if (temp[1].arr[1].m22[0][1] != vec2(0.65, 0.66))
+			v = vec4(0.66, 0, temp[1].arr[1].m22[0][1]);
+		else if (temp[1].arr[1].m22[1][0] != vec2(0.67, 0.68))
+			v = vec4(0.68, 0, temp[1].arr[1].m22[1][0]);
+		else if (temp[1].arr[1].m22[1][1] != vec2(0.69, 0.70))
+			v = vec4(0.70, 0, temp[1].arr[1].m22[1][1]);
+
+		else if (temp[1].v3 != vec3(0.71, 0.72, 0.73))
+			v = vec4(0.72, temp[1].v3);
+		else if (temp[1].b != true)
+			v = vec4(0.74, 0, 0, temp[1].b);
+
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150
+
+in vec4 v;
+
+void main()
+{
+	gl_FragColor = v;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform vec2 s[0].arr[0].v2 0.99 0.99
+uniform mat2 s[0].arr[0].m22[0] 0.03 0.04 0.05 0.06
+uniform mat2 s[0].arr[0].m22[1] 0.07 0.08 0.09 0.10
+uniform vec2 s[0].arr[1].v2 0.21 0.22
+uniform mat2 s[0].arr[1].m22[0] 0.23 0.24 0.25 0.26
+uniform mat2 s[0].arr[1].m22[1] 0.27 0.28 0.29 0.30
+uniform vec3 s[0].v3 0.31 0.32 0.33
+uniform int s[0].b 0
+
+uniform vec2 s[1].arr[0].v2 0.41 0.42
+uniform mat2 s[1].arr[0].m22[0] 0.43 0.44 0.45 0.46
+uniform mat2 s[1].arr[0].m22[1] 0.47 0.48 0.49 0.50
+uniform vec2 s[1].arr[1].v2 0.61 0.62
+uniform mat2 s[1].arr[1].m22[0] 0.63 0.64 0.65 0.66
+uniform mat2 s[1].arr[1].m22[1] 0.67 0.68 0.69 0.70
+uniform vec3 s[1].v3 0.71 0.72 0.73
+uniform int s[1].b 2
+
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/glsl-1.50/uniform_buffer/gs-struct-copy.shader_test b/tests/spec/glsl-1.50/uniform_buffer/gs-struct-copy.shader_test
new file mode 100644
index 0000000..ec47721
--- /dev/null
+++ b/tests/spec/glsl-1.50/uniform_buffer/gs-struct-copy.shader_test
@@ -0,0 +1,66 @@
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+	vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform ubo1 {
+	struct S {
+		vec4 a, b, c, d;
+	} colors;
+};
+
+in vec4 vertex_to_gs[3];
+out vec4 v;
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = vertex_to_gs[i];
+
+		S temp = colors;
+		temp.c = vec4(0.0); /* try, but fail, to prevent copy prop */
+		v = temp.a + temp.b + temp.c + temp.d;
+
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150
+
+in vec4 v;
+
+void main()
+{
+	gl_FragColor = v;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform vec4 colors.a 0.0 0.0 0.0 0.0
+uniform vec4 colors.b 0.0 1.0 0.0 0.0
+uniform vec4 colors.c 1.0 0.0 0.0 0.0
+uniform vec4 colors.d 0.0 0.0 0.0 0.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/glsl-1.50/uniform_buffer/gs-struct-pad.shader_test b/tests/spec/glsl-1.50/uniform_buffer/gs-struct-pad.shader_test
new file mode 100644
index 0000000..c0e91a0
--- /dev/null
+++ b/tests/spec/glsl-1.50/uniform_buffer/gs-struct-pad.shader_test
@@ -0,0 +1,70 @@
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+	vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform ubo1 {
+	struct S {
+		struct S1 {
+			float r;
+		} s1;
+
+		struct S2 {
+			float g;
+			float b;
+			float a;
+		} s2;
+	} s;
+};
+
+in vec4 vertex_to_gs[3];
+out vec4 v;
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = vertex_to_gs[i];
+		v = vec4(s.s1.r, s.s2.g, s.s2.b, s.s2.a);
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150
+
+in vec4 v;
+
+void main()
+{
+	gl_FragColor = v;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform float s.s1.r 0.0
+uniform float s.s2.g 1.0
+uniform float s.s2.b 0.0
+uniform float s.s2.a 0.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/glsl-1.50/uniform_buffer/gs-struct.shader_test b/tests/spec/glsl-1.50/uniform_buffer/gs-struct.shader_test
new file mode 100644
index 0000000..1c63843
--- /dev/null
+++ b/tests/spec/glsl-1.50/uniform_buffer/gs-struct.shader_test
@@ -0,0 +1,65 @@
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+	vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform ubo1 {
+	struct S {
+		float r;
+		float g;
+		float b;
+		float a;
+	} s;
+};
+
+in vec4 vertex_to_gs[3];
+out vec4 v;
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = vertex_to_gs[i];
+		v = vec4(s.r, s.g, s.b, s.a);
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150
+
+in vec4 v;
+
+void main()
+{
+	gl_FragColor = v;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform float s.r 0.0
+uniform float s.g 1.0
+uniform float s.b 0.0
+uniform float s.a 0.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/glsl-1.50/uniform_buffer/gs-two-members.shader_test b/tests/spec/glsl-1.50/uniform_buffer/gs-two-members.shader_test
new file mode 100644
index 0000000..25bee8f
--- /dev/null
+++ b/tests/spec/glsl-1.50/uniform_buffer/gs-two-members.shader_test
@@ -0,0 +1,59 @@
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+	vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform ubo1 {
+	vec4 color1;
+	vec4 color2;
+};
+
+in vec4 vertex_to_gs[3];
+out vec4 v;
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = vertex_to_gs[i];
+		v = color1 + color2;
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150
+
+in vec4 v;
+
+void main()
+{
+	gl_FragColor = v;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform vec4 color1 0.5 0.0 0.0 0.0
+uniform vec4 color2 0.0 0.75 0.0 0.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.5 0.75 0.0 0.0
-- 
1.8.3.rc0



More information about the Piglit mailing list