[Piglit] [PATCH] compatibility: test vertex color clamping in geom and tess shaders

Timothy Arceri tarceri at itsqueeze.com
Fri Jun 22 09:50:03 UTC 2018


---
 .../tes-clamp-vertex-color.shader_test        | 76 +++++++++++++++++++
 .../gs-clamp-vertex-color.shader_test         | 47 ++++++++++++
 2 files changed, 123 insertions(+)
 create mode 100644 tests/spec/arb_tessellation_shader/execution/compatibility/tes-clamp-vertex-color.shader_test
 create mode 100644 tests/spec/glsl-1.50/execution/compatibility/gs-clamp-vertex-color.shader_test

diff --git a/tests/spec/arb_tessellation_shader/execution/compatibility/tes-clamp-vertex-color.shader_test b/tests/spec/arb_tessellation_shader/execution/compatibility/tes-clamp-vertex-color.shader_test
new file mode 100644
index 000000000..9050bb1de
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/compatibility/tes-clamp-vertex-color.shader_test
@@ -0,0 +1,76 @@
+# GL_ARB_color_buffer_float provides a way to disable vertex color clamping,
+# but without it, the vertex colors must be clamped.
+#
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150 compatibility
+
+in vec4 piglit_vertex;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+}
+
+[tessellation control shader]
+#version 150 compatibility
+#extension GL_ARB_tessellation_shader: require
+
+layout(vertices = 3) out;
+
+out vec4 color[];
+
+void main() {
+	gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
+	gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 0.0);
+	gl_TessLevelInner = float[2](0.0, 0.0);
+	color[gl_InvocationID] = vec4(0, 1, 0, 1);
+}
+
+[tessellation evaluation shader]
+#version 150 compatibility
+#extension GL_ARB_tessellation_shader: require
+
+layout(triangles) in;
+
+in vec4 color[];
+
+void main() {
+	gl_Position = gl_in[0].gl_Position * gl_TessCoord[0]
+	            + gl_in[1].gl_Position * gl_TessCoord[1]
+	            + gl_in[2].gl_Position * gl_TessCoord[2];
+
+	gl_FrontColor = vec4(-2, -1, 0.5, 3);		  /* (0, 0,   0.5, 1) */
+	gl_FrontSecondaryColor = vec4(2, 0.5, 1.5, -0.5); /* (1, 0.5, 1,   0) */
+}
+
+[vertex data]
+piglit_vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+-1.0  1.0
+-1.0  1.0
+ 1.0 -1.0
+ 1.0  1.0
+
+[fragment shader]
+#version 150 compatibility
+
+uniform vec4 arg0;
+void main()
+{
+	gl_FragColor = (gl_Color + gl_SecondaryColor) * 0.5;
+}
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+patch parameter vertices 3
+draw arrays GL_PATCHES 0 6
+#probe all rgba 0.0 1.0 0.0 1.0
+#draw rect -1 -1 2 2
+probe rgba 1 1 0.5 0.25 0.75 0.5
diff --git a/tests/spec/glsl-1.50/execution/compatibility/gs-clamp-vertex-color.shader_test b/tests/spec/glsl-1.50/execution/compatibility/gs-clamp-vertex-color.shader_test
new file mode 100644
index 000000000..e7ba1d893
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/compatibility/gs-clamp-vertex-color.shader_test
@@ -0,0 +1,47 @@
+# GL_ARB_color_buffer_float provides a way to disable vertex color clamping,
+# but without it, the vertex colors must be clamped.
+#
+[require]
+GL COMPAT >= 3.2
+GLSL >= 1.50
+
+[vertex shader]
+#version 150 compatibility
+
+void main()
+{
+   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+}
+
+[geometry shader]
+#version 150 compatibility
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+varying float v;
+
+void main()
+{
+	for (int i = 0; i < 3; i++) {
+		gl_Position = gl_in[i].gl_Position;
+
+		gl_FrontColor = vec4(-2, -1, 0.5, 3);		  /* (0, 0,   0.5, 1) */
+		gl_FrontSecondaryColor = vec4(2, 0.5, 1.5, -0.5); /* (1, 0.5, 1,   0) */
+
+		EmitVertex();
+	}
+}
+
+[fragment shader]
+#version 150 compatibility
+
+uniform vec4 arg0;
+void main()
+{
+	gl_FragColor = (gl_Color + gl_SecondaryColor) * 0.5;
+}
+
+[test]
+draw rect -1 -1 2 2
+probe rgba 1 1 0.5 0.25 0.75 0.5
-- 
2.17.1



More information about the Piglit mailing list