gl-3.2-compat: test gl_TexCoord[] built-in with geometry shaders

Submitted by Timothy Arceri on May 22, 2018, 12:30 a.m.

Details

Message ID 20180522003019.5185-1-tarceri@itsqueeze.com
State New
Headers show
Series "gl-3.2-compat: test gl_TexCoord[] built-in with geometry shaders" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Timothy Arceri May 22, 2018, 12:30 a.m.
---
 .../texcoord-array-2.shader_test              | 65 ++++++++++++++++++
 .../compatibility/texcoord-array.shader_test  | 66 +++++++++++++++++++
 2 files changed, 131 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/execution/compatibility/texcoord-array-2.shader_test
 create mode 100644 tests/spec/glsl-1.50/execution/compatibility/texcoord-array.shader_test

Patch hide | download patch | download mbox

diff --git a/tests/spec/glsl-1.50/execution/compatibility/texcoord-array-2.shader_test b/tests/spec/glsl-1.50/execution/compatibility/texcoord-array-2.shader_test
new file mode 100644
index 000000000..ec910524c
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/compatibility/texcoord-array-2.shader_test
@@ -0,0 +1,65 @@ 
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+
+[vertex shader]
+#version 150 compatibility
+
+out gl_PerVertex {
+	vec4 gl_Position;
+	vec4 gl_TexCoord[5];
+};
+
+void main()
+{
+	/* 0.05, 0.05, 0.10, 0.15, 0.20 */
+	for (int i = 0; i < 5; i++)
+		gl_TexCoord[i] = vec4(float(i) * 0.05);
+
+	gl_Position = gl_Vertex;
+}
+
+[geometry shader]
+#version 150 compatibility
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+in gl_PerVertex {
+	vec4 gl_Position;
+	vec4 gl_TexCoord[5];
+} gl_in[];
+
+out vec4 gl_TexCoord[5];
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = gl_in[i].gl_Position;
+
+		for (int j = 0; j < 5; j++) {
+			gl_TexCoord[j] = gl_in[i].gl_TexCoord[j];
+		}
+
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 110
+
+varying vec4 gl_TexCoord[5];
+void main()
+{
+	vec4 result = vec4(0.0);
+
+	for (int i = 0; i < 4; i++)
+		result += gl_TexCoord[i];
+
+	/* 0.00 + 0.05 + 0.10 + 0.15 = 0.30 */
+	gl_FragColor = result;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe rgba 1 1 0.3 0.3 0.3 0.3
diff --git a/tests/spec/glsl-1.50/execution/compatibility/texcoord-array.shader_test b/tests/spec/glsl-1.50/execution/compatibility/texcoord-array.shader_test
new file mode 100644
index 000000000..fae6cff63
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/compatibility/texcoord-array.shader_test
@@ -0,0 +1,66 @@ 
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+
+[vertex shader]
+#version 150 compatibility
+
+uniform int n;
+
+out gl_PerVertex {
+	vec4 gl_Position;
+	vec4 gl_TexCoord[5];
+};
+
+void main()
+{
+	for (int i = 0; i < n; i++) {
+		gl_TexCoord[i] = vec4(0.5, 0.5, 0.5, 0.5) * float(i);
+	}
+	gl_Position = gl_Vertex;
+}
+
+[geometry shader]
+#version 150 compatibility
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+uniform int n;
+
+in gl_PerVertex {
+	vec4 gl_Position;
+	vec4 gl_TexCoord[5];
+} gl_in[];
+
+out vec4 gl_TexCoord[5];
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = gl_in[i].gl_Position;
+
+		for (int j = 0; j < n; j++) {
+			gl_TexCoord[j] = gl_in[i].gl_TexCoord[j];
+		}
+
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150 compatibility
+
+uniform int index;
+in vec4 gl_TexCoord[5];
+
+void main()
+{
+	gl_FragColor = gl_TexCoord[index];
+}
+
+[test]
+uniform int index 1
+uniform int n 4
+draw rect -1 -1 2 2
+probe rgba 1 1 0.5 0.5 0.5 0.5