[Piglit] [PATCH 2/5] GLSL 1.40: Add some simple UBO rendering tests.

Eric Anholt eric at anholt.net
Thu Jul 26 16:23:45 PDT 2012


---
 tests/all.tests                                    |    3 ++
 .../glsl-1.40/uniform_buffer/fs-basic.shader_test  |   36 ++++++++++++++
 .../glsl-1.40/uniform_buffer/fs-bools.shader_test  |   42 ++++++++++++++++
 .../fs-float-array-const-index.shader_test         |   39 +++++++++++++++
 .../fs-float-array-variable-index.shader_test      |   46 ++++++++++++++++++
 .../glsl-1.40/uniform_buffer/fs-floats.shader_test |   42 ++++++++++++++++
 .../uniform_buffer/fs-mat4-row-major.shader_test   |   36 ++++++++++++++
 .../glsl-1.40/uniform_buffer/fs-mat4.shader_test   |   36 ++++++++++++++
 .../glsl-1.40/uniform_buffer/fs-struct.shader_test |   44 +++++++++++++++++
 .../uniform_buffer/fs-two-members.shader_test      |   38 +++++++++++++++
 .../glsl-1.40/uniform_buffer/vs-basic.shader_test  |   40 ++++++++++++++++
 .../glsl-1.40/uniform_buffer/vs-bools.shader_test  |   46 ++++++++++++++++++
 .../vs-float-array-const-index.shader_test         |   43 +++++++++++++++++
 .../vs-float-array-variable-index.shader_test      |   50 ++++++++++++++++++++
 .../glsl-1.40/uniform_buffer/vs-floats.shader_test |   46 ++++++++++++++++++
 .../uniform_buffer/vs-mat4-row-major.shader_test   |   40 ++++++++++++++++
 .../glsl-1.40/uniform_buffer/vs-mat4.shader_test   |   40 ++++++++++++++++
 .../glsl-1.40/uniform_buffer/vs-struct.shader_test |   48 +++++++++++++++++++
 .../uniform_buffer/vs-two-members.shader_test      |   42 ++++++++++++++++
 19 files changed, 757 insertions(+)
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/fs-basic.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/fs-bools.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/fs-float-array-const-index.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/fs-float-array-variable-index.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/fs-floats.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/fs-mat4-row-major.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/fs-mat4.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/fs-struct.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/fs-two-members.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/vs-basic.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/vs-bools.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/vs-float-array-const-index.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/vs-float-array-variable-index.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/vs-floats.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/vs-mat4-row-major.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/vs-mat4.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/vs-struct.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/vs-two-members.shader_test

diff --git a/tests/all.tests b/tests/all.tests
index ee08767..ff6f693 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1892,6 +1892,9 @@ spec['ARB_uniform_buffer_object'] = arb_uniform_buffer_object
 import_glsl_parser_tests(spec['ARB_uniform_buffer_object'],
 			 os.path.join(testsDir, 'spec', 'arb_uniform_buffer_object'),
 			 [''])
+add_shader_test_dir(spec['ARB_uniform_buffer_object'],
+	            os.path.join(testsDir, 'spec', 'arb_uniform_buffer_object'),
+		    recursive=True)
 arb_uniform_buffer_object['bindbuffer-general-point'] = concurrent_test('arb_uniform_buffer_object-bindbuffer-general-point')
 arb_uniform_buffer_object['bindbuffer-gen-name'] = concurrent_test('arb_uniform_buffer_object-bindbuffer-gen-name')
 arb_uniform_buffer_object['buffer-targets'] = concurrent_test('arb_uniform_buffer_object-buffer-targets')
diff --git a/tests/spec/glsl-1.40/uniform_buffer/fs-basic.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-basic.shader_test
new file mode 100644
index 0000000..42028a9
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/fs-basic.shader_test
@@ -0,0 +1,36 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+in vec4 vertex;
+
+void main()
+{
+	gl_Position = vertex;
+}
+
+[fragment shader]
+#version 140
+
+uniform ubo1 {
+	vec4 color;
+};
+
+void main()
+{
+	gl_FragColor = color;
+}
+
+[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.40/uniform_buffer/fs-bools.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-bools.shader_test
new file mode 100644
index 0000000..99e6b45
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/fs-bools.shader_test
@@ -0,0 +1,42 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+in vec4 vertex;
+
+void main()
+{
+	gl_Position = vertex;
+}
+
+[fragment shader]
+#version 140
+
+uniform ubo1 {
+	bool r;
+	bool g;
+	bool b;
+	bool a;
+};
+
+void main()
+{
+	gl_FragColor = vec4(r, g, b, a);
+}
+
+[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.40/uniform_buffer/fs-float-array-const-index.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-float-array-const-index.shader_test
new file mode 100644
index 0000000..9b7876a
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/fs-float-array-const-index.shader_test
@@ -0,0 +1,39 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+in vec4 vertex;
+
+void main()
+{
+	gl_Position = vertex;
+}
+
+[fragment shader]
+#version 140
+
+uniform ubo1 {
+	float f[4];
+};
+
+void main()
+{
+	gl_FragColor = vec4(f[0], f[1], f[2], f[3]);
+}
+
+[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.40/uniform_buffer/fs-float-array-variable-index.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-float-array-variable-index.shader_test
new file mode 100644
index 0000000..93bf6ee
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/fs-float-array-variable-index.shader_test
@@ -0,0 +1,46 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+in vec4 vertex;
+
+void main()
+{
+	gl_Position = vertex;
+}
+
+[fragment shader]
+#version 140
+
+uniform int ri, gi, bi, ai;
+
+uniform ubo1 {
+	float f[4];
+};
+
+void main()
+{
+	gl_FragColor = vec4(f[ri], f[gi], f[bi], f[ai]);
+}
+
+[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.40/uniform_buffer/fs-floats.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-floats.shader_test
new file mode 100644
index 0000000..738d982
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/fs-floats.shader_test
@@ -0,0 +1,42 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+in vec4 vertex;
+
+void main()
+{
+	gl_Position = vertex;
+}
+
+[fragment shader]
+#version 140
+
+uniform ubo1 {
+	float r;
+	float g;
+	float b;
+	float a;
+};
+
+void main()
+{
+	gl_FragColor = vec4(r, g, b, a);
+}
+
+[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.40/uniform_buffer/fs-mat4-row-major.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-mat4-row-major.shader_test
new file mode 100644
index 0000000..3fb3fce
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/fs-mat4-row-major.shader_test
@@ -0,0 +1,36 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+in vec4 vertex;
+
+void main()
+{
+	gl_Position = vertex;
+}
+
+[fragment shader]
+#version 140
+
+uniform ubo1 {
+	layout(row_major) mat4 m;
+};
+
+void main()
+{
+	gl_FragColor = m[0] + m[1] + m[2] + m[3];
+}
+
+[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.40/uniform_buffer/fs-mat4.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-mat4.shader_test
new file mode 100644
index 0000000..9c7585b
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/fs-mat4.shader_test
@@ -0,0 +1,36 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+in vec4 vertex;
+
+void main()
+{
+	gl_Position = vertex;
+}
+
+[fragment shader]
+#version 140
+
+uniform ubo1 {
+	mat4 m;
+};
+
+void main()
+{
+	gl_FragColor = m[0] + m[1] + m[2] + m[3];
+}
+
+[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.40/uniform_buffer/fs-struct.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-struct.shader_test
new file mode 100644
index 0000000..a7cd194
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/fs-struct.shader_test
@@ -0,0 +1,44 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+in vec4 vertex;
+
+void main()
+{
+	gl_Position = vertex;
+}
+
+[fragment shader]
+#version 140
+
+uniform ubo1 {
+	struct S {
+		float r;
+		float g;
+		float b;
+		float a;
+	} s;
+};
+
+void main()
+{
+	gl_FragColor = vec4(s.r, s.g, s.b, s.a);
+}
+
+[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.40/uniform_buffer/fs-two-members.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-two-members.shader_test
new file mode 100644
index 0000000..1ad730c
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/fs-two-members.shader_test
@@ -0,0 +1,38 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+in vec4 vertex;
+
+void main()
+{
+	gl_Position = vertex;
+}
+
+[fragment shader]
+#version 140
+
+uniform ubo1 {
+	vec4 color1;
+	vec4 color2;
+};
+
+void main()
+{
+	gl_FragColor = color1 + color2;
+}
+
+[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
diff --git a/tests/spec/glsl-1.40/uniform_buffer/vs-basic.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-basic.shader_test
new file mode 100644
index 0000000..cf5272b
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/vs-basic.shader_test
@@ -0,0 +1,40 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+uniform ubo1 {
+	vec4 color;
+};
+
+in vec4 vertex;
+out vec4 v;
+
+void main()
+{
+	gl_Position = vertex;
+	v = color;
+}
+
+[fragment shader]
+#version 140
+
+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.40/uniform_buffer/vs-bools.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-bools.shader_test
new file mode 100644
index 0000000..9fe4b5e
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/vs-bools.shader_test
@@ -0,0 +1,46 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+uniform ubo1 {
+	bool r;
+	bool g;
+	bool b;
+	bool a;
+};
+
+in vec4 vertex;
+out vec4 v;
+
+void main()
+{
+	gl_Position = vertex;
+	v = vec4(r, g, b, a);
+}
+
+[fragment shader]
+#version 140
+
+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.40/uniform_buffer/vs-float-array-const-index.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-float-array-const-index.shader_test
new file mode 100644
index 0000000..16aaa29
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/vs-float-array-const-index.shader_test
@@ -0,0 +1,43 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+uniform ubo1 {
+	float f[4];
+};
+
+in vec4 vertex;
+out vec4 v;
+
+void main()
+{
+	gl_Position = vertex;
+	v = vec4(f[0], f[1], f[2], f[3]);
+}
+
+[fragment shader]
+#version 140
+
+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.40/uniform_buffer/vs-float-array-variable-index.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-float-array-variable-index.shader_test
new file mode 100644
index 0000000..723fbd5
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/vs-float-array-variable-index.shader_test
@@ -0,0 +1,50 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+uniform int ri, gi, bi, ai;
+
+uniform ubo1 {
+	float f[4];
+};
+
+in vec4 vertex;
+out vec4 v;
+
+void main()
+{
+	gl_Position = vertex;
+	v = vec4(f[ri], f[gi], f[bi], f[ai]);
+}
+
+[fragment shader]
+#version 140
+
+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.40/uniform_buffer/vs-floats.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-floats.shader_test
new file mode 100644
index 0000000..81c384c
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/vs-floats.shader_test
@@ -0,0 +1,46 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+uniform ubo1 {
+	float r;
+	float g;
+	float b;
+	float a;
+};
+
+in vec4 vertex;
+out vec4 v;
+
+void main()
+{
+	gl_Position = vertex;
+	v = vec4(r, g, b, a);
+}
+
+[fragment shader]
+#version 140
+
+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.40/uniform_buffer/vs-mat4-row-major.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-mat4-row-major.shader_test
new file mode 100644
index 0000000..47e9823
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/vs-mat4-row-major.shader_test
@@ -0,0 +1,40 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+uniform ubo1 {
+	layout(row_major) mat4 m;
+};
+
+in vec4 vertex;
+out vec4 v;
+
+void main()
+{
+	gl_Position = vertex;
+	v = m[0] + m[1] + m[2] + m[3];
+}
+
+[fragment shader]
+#version 140
+
+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.40/uniform_buffer/vs-mat4.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-mat4.shader_test
new file mode 100644
index 0000000..7cc802f
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/vs-mat4.shader_test
@@ -0,0 +1,40 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+uniform ubo1 {
+	mat4 m;
+};
+
+in vec4 vertex;
+out vec4 v;
+
+void main()
+{
+	gl_Position = vertex;
+	v = m[0] + m[1] + m[2] + m[3];
+}
+
+[fragment shader]
+#version 140
+
+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.40/uniform_buffer/vs-struct.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-struct.shader_test
new file mode 100644
index 0000000..4ed4181
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/vs-struct.shader_test
@@ -0,0 +1,48 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+uniform ubo1 {
+	struct S {
+		float r;
+		float g;
+		float b;
+		float a;
+	} s;
+};
+
+in vec4 vertex;
+out vec4 v;
+
+void main()
+{
+	gl_Position = vertex;
+	v = vec4(s.r, s.g, s.b, s.a);
+}
+
+[fragment shader]
+#version 140
+
+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.40/uniform_buffer/vs-two-members.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-two-members.shader_test
new file mode 100644
index 0000000..627b309
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/vs-two-members.shader_test
@@ -0,0 +1,42 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+uniform ubo1 {
+	vec4 color1;
+	vec4 color2;
+};
+
+in vec4 vertex;
+out vec4 v;
+
+void main()
+{
+	gl_Position = vertex;
+	v = color1 + color2;
+}
+
+[fragment shader]
+#version 140
+
+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.7.10.4



More information about the Piglit mailing list