[Piglit] [PATCH 1/3] GS: Test that geometry ins/outs can have flat/smooth/noperspective qualifiers

Nicholas Mack nichmack at gmail.com
Thu Sep 12 10:47:23 PDT 2013


---
 .../gs-also-uses-smooth-flat-noperspective.geom    | 25 ++++++
 ...also-uses-smooth-flat-noperspective.shader_test | 91 ++++++++++++++++++++++
 2 files changed, 116 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom
 create mode 100644 tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test

diff --git a/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom b/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom
new file mode 100644
index 0000000..f1ab41e
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// check_link: true
+// [end config]
+
+#version 150
+
+layout(points) in;
+layout(points, max_vertices = 1) out;
+
+flat in int a[];
+noperspective in int b[];
+smooth in int c[];
+
+flat out int aa;
+noperspective out int bb;
+smooth out int cc;
+
+void main()
+{
+	aa = a[0];
+	bb = b[0];
+	cc = c[0];
+}
diff --git a/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test b/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test
new file mode 100644
index 0000000..e302806
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test
@@ -0,0 +1,91 @@
+# Test that the qualifiers 'smooth', 'flat', and 'noperspective' can appear on
+#  geometry shader ins and outs.
+#
+# From the GLSL 1.50 specification, section 4.3 ("Storage Qualifiers"):
+#
+# "Outputs from shader (out) and inputs to a shader (in) can be further
+#  qualified with one of these interpolation qualifiers:
+#	smooth
+#	flat
+#	noperspective"
+
+[require]
+GL >= 3.2
+GLSL >= 1.50
+
+[vertex shader]
+
+uniform float ref;
+
+in vec4 vertex;
+
+out vec4 pos;
+flat out float a;
+noperspective out float b;
+smooth out float c;
+
+void main()
+{
+	gl_Position = vertex;
+	pos = vertex;
+	a = ref + 1;
+	b = ref + 2;
+	c = ref + 3;
+}
+
+[geometry shader]
+
+uniform float ref;
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+in vec4 pos[];
+flat in float a[];
+noperspective in float b[];
+smooth in float c[];
+
+flat out float aa;
+noperspective out float bb;
+smooth out float cc;
+
+void main()
+{
+	for(int i = 0; i < 3; i++) {
+		gl_Position = pos[i];
+		aa = a[i] + 1;
+		bb = b[i] + 2;
+		cc = c[i] + 3;
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+
+uniform float ref;
+
+flat in float aa;
+noperspective in float bb;
+smooth in float cc;
+
+out vec4 color;
+
+void main()
+{
+	if ((aa != ref + 2) || (bb != ref + 4) || (cc != ref + 6))
+		color = vec4(1.0, 0.0, 0.0, 1.0);
+	else
+		color = vec4(0.0, 1.0, 0.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 float ref 37.29060007
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 1.0
-- 
1.8.3.1



More information about the Piglit mailing list