[Piglit] [PATCH 17/18] arb_geometry_shader4: Test gl_TexCoordIn indexing.

Fabian Bieler fabianbieler at fastmail.fm
Mon Jun 10 15:26:54 PDT 2013


>From the ARB_geometry_shader4 spec (section ):
"Indices used to subscript gl_TexCoord must either be an integral constant
expressions, or this array must be re-declared by the shader with a size."

And from the GLSL 1.1 spec page 99 (page 105 of the PDF):
"Multiple modules can declare it [gl_TexCoord] with different sizes, the
maximum will be used at link time."

Presumably, this also applies to gl_TexCoordIn.
---
 .../execution/texcoord01.shader_test               | 56 ++++++++++++++++++++
 .../execution/texcoord02.shader_test               | 60 ++++++++++++++++++++++
 2 files changed, 116 insertions(+)
 create mode 100644 tests/spec/arb_geometry_shader4/execution/texcoord01.shader_test
 create mode 100644 tests/spec/arb_geometry_shader4/execution/texcoord02.shader_test

diff --git a/tests/spec/arb_geometry_shader4/execution/texcoord01.shader_test b/tests/spec/arb_geometry_shader4/execution/texcoord01.shader_test
new file mode 100644
index 0000000..70c4eb2
--- /dev/null
+++ b/tests/spec/arb_geometry_shader4/execution/texcoord01.shader_test
@@ -0,0 +1,56 @@
+# Test accessing glTexCoordIn without redeclaration but with constant indices.
+[require]
+GL >= 2.0
+GLSL >= 1.10
+GL_ARB_geometry_shader4
+
+[vertex shader]
+#version 110
+
+attribute vec4 vertex;
+
+void main()
+{
+	gl_TexCoord[0] = vertex;
+	gl_TexCoord[1] = vertex;
+	gl_TexCoord[2] = vertex;
+	gl_Position = vec4(0);
+}
+
+[geometry shader]
+#version 110
+#extension GL_ARB_geometry_shader4: enable
+
+void main()
+{
+	gl_Position = gl_TexCoordIn[0][2];
+	EmitVertex();
+	gl_Position = gl_TexCoordIn[1][1];
+	EmitVertex();
+	gl_Position = gl_TexCoordIn[2][0];
+	EmitVertex();
+}
+
+[geometry layout]
+input type GL_TRIANGLES
+output type GL_TRIANGLE_STRIP
+vertices out 3
+
+[fragment shader]
+#version 110
+
+void main()
+{
+	gl_FragColor = vec4(1.0, 1.0, 1.0, 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 1.0 1.0 1.0
diff --git a/tests/spec/arb_geometry_shader4/execution/texcoord02.shader_test b/tests/spec/arb_geometry_shader4/execution/texcoord02.shader_test
new file mode 100644
index 0000000..7a7a751
--- /dev/null
+++ b/tests/spec/arb_geometry_shader4/execution/texcoord02.shader_test
@@ -0,0 +1,60 @@
+# Test accessing glTexCoordIn with redeclaration (with explicit size) and with non-constant indices.
+[require]
+GL >= 2.0
+GLSL >= 1.10
+GL_ARB_geometry_shader4
+
+[vertex shader]
+#version 110
+
+uniform int one;
+attribute vec4 vertex;
+varying vec4 gl_TexCoord[2];
+
+void main()
+{
+	gl_TexCoord[one] = vertex;
+	gl_Position = vec4(0);
+}
+
+[geometry shader]
+#version 110
+#extension GL_ARB_geometry_shader4: enable
+
+uniform int one;
+varying in vec4 gl_TexCoordIn[][3];
+
+void main()
+{
+	gl_Position = gl_TexCoordIn[0][one];
+	EmitVertex();
+	gl_Position = gl_TexCoordIn[1][one];
+	EmitVertex();
+	gl_Position = gl_TexCoordIn[2][one];
+	EmitVertex();
+}
+
+[geometry layout]
+input type GL_TRIANGLES
+output type GL_TRIANGLE_STRIP
+vertices out 3
+
+[fragment shader]
+#version 110
+
+void main()
+{
+	gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform int one 1
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgb 1.0 1.0 1.0
-- 
1.8.1.2



More information about the Piglit mailing list