[Piglit] [PATCH 15/18] arb_geometry_shader4: Add basic 2d array tests.

Fabian Bieler fabianbieler at fastmail.fm
Fri May 31 04:49:23 PDT 2013


Test basic indexing operations with 2d arrays.
---
 .../arb_geometry_shader4/compiler/2darray01.geom   | 63 +++++++++++++++++++
 .../linker/2darray01.shader_test                   | 70 ++++++++++++++++++++++
 2 files changed, 133 insertions(+)
 create mode 100644 tests/spec/arb_geometry_shader4/compiler/2darray01.geom
 create mode 100644 tests/spec/arb_geometry_shader4/linker/2darray01.shader_test

diff --git a/tests/spec/arb_geometry_shader4/compiler/2darray01.geom b/tests/spec/arb_geometry_shader4/compiler/2darray01.geom
new file mode 100644
index 0000000..953d8af
--- /dev/null
+++ b/tests/spec/arb_geometry_shader4/compiler/2darray01.geom
@@ -0,0 +1,63 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.20
+// require_extensions: GL_ARB_geometry_shader4
+// [end config]
+
+#version 120
+#extension GL_ARB_geometry_shader4: enable
+
+uniform int zero;
+
+varying in float gs_input1[][6];
+varying in float gs_input2[gl_VerticesIn][6];
+
+varying out float scalar;
+varying out float array[6];
+
+float fs(float input_)
+{
+	return input_;
+}
+
+float fa(float input_[6])
+{
+	return input_[zero];
+}
+
+void main()
+{
+	//check implicitly sized input
+	{
+	//check assignments to local variables
+	float a1[] = gs_input1[zero];
+	float a2[6] = gs_input1[zero];
+	float s = gs_input1[zero][zero];
+
+	//check passing as function parameters
+	fa(gs_input1[zero]);
+	fs(gs_input1[zero][zero]);
+
+	//check assignments to output variables
+	array = gs_input1[zero];
+	scalar = gs_input1[zero][zero];
+	}
+
+
+	//check explicitly sized input
+	{
+	//check assignments to local variables
+	float a1[] = gs_input2[zero];
+	float a2[6] = gs_input2[zero];
+	float s = gs_input2[zero][zero];
+
+	//check passing as function parameters
+	fa(gs_input2[zero]);
+	fs(gs_input2[zero][zero]);
+
+	//check assignments to output variables
+	array = gs_input2[zero];
+	scalar = gs_input2[zero][zero];
+	}
+}
+
diff --git a/tests/spec/arb_geometry_shader4/linker/2darray01.shader_test b/tests/spec/arb_geometry_shader4/linker/2darray01.shader_test
new file mode 100644
index 0000000..42362f2
--- /dev/null
+++ b/tests/spec/arb_geometry_shader4/linker/2darray01.shader_test
@@ -0,0 +1,70 @@
+#Basic test of gs 2d input arrays
+[require]
+GL >= 2.0
+GLSL >= 1.20
+GL_ARB_geometry_shader4
+
+[vertex shader]
+#version 120
+
+attribute vec4 vertex;
+
+varying float gs_input[6];
+
+void main()
+{
+	for (int i = 0; i < 6; i++)
+		gs_input[i] = 0.5;
+	gl_Position = vertex;
+}
+
+[geometry shader]
+#version 120
+#extension GL_ARB_geometry_shader4: enable
+
+uniform int zero;
+
+varying in float gs_input[][6];
+
+varying out float scalar;
+varying out float array[6];
+
+void main()
+{
+	for (int i = 0; i < gl_VerticesIn; i++) {
+		array = gs_input[zero];
+		scalar = gs_input[zero][zero];
+
+		gl_Position = gl_PositionIn[i];
+		EmitVertex();
+	}
+}
+
+[geometry layout]
+input type GL_TRIANGLES
+output type GL_TRIANGLE_STRIP
+vertices out 3
+
+[fragment shader]
+#version 120
+
+const int gs_VerticesIn = 3;
+
+varying float scalar;
+varying float array[6];
+
+void main()
+{
+  gl_FragColor = vec4(scalar, array[0], 0.5, 1.0);
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgb 0.5 0.5 0.5
-- 
1.8.1.2



More information about the Piglit mailing list