[Piglit] [PATCH] Test that fixed vertex functionality respects clip plane enable flags.

Paul Berry stereotype441 at gmail.com
Mon Oct 10 15:05:37 PDT 2011


This test is similar to the existing
"vs-clip-vertex-enables.shader_test", except that it tests the
behavior of fixed vertex functionality rather than a GLSL vertex
shader.
---
 .../clipping/fixed-clip-enables.shader_test        |  138 ++++++++++++++++++++
 1 files changed, 138 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/glsl-1.20/execution/clipping/fixed-clip-enables.shader_test

diff --git a/tests/spec/glsl-1.20/execution/clipping/fixed-clip-enables.shader_test b/tests/spec/glsl-1.20/execution/clipping/fixed-clip-enables.shader_test
new file mode 100644
index 0000000..1e0beba
--- /dev/null
+++ b/tests/spec/glsl-1.20/execution/clipping/fixed-clip-enables.shader_test
@@ -0,0 +1,138 @@
+# This test sets up 6 clipping planes using fixed vertex
+# functionality, which clip a rectangle to a hexagon shape.  Then it
+# tests various combinations of enables for the 6 clipping planes, and
+# verifies that they all create the correct shape.
+#
+# To verify that each enable works, the combinations of enables were
+# chosen such that:
+# - Every plane is enabled at least once and disbled at least once.
+# - Every plane is enabled and disabled in a different pattern.
+#
+# Note: Some implementations have bugs related to improper coordinate
+# transformations of clip planes (which are already adequately tested
+# by the clip-plane-transformation test), so to avoid those bugs
+# contaminating the results of this test, we don't do any coordinate
+# transformation in this test.
+
+[require]
+GLSL >= 1.20
+
+[fragment shader]
+#version 120
+void main(void)
+{
+	gl_FragColor = vec4(1, 1, 1, 1);
+}
+
+[test]
+clip plane 0 0 1 0 0.5
+clip plane 1 -1 1 0 0.8
+clip plane 2 -1 -1 0 0.8
+clip plane 3 0 -1 0 0.5
+clip plane 4 1 -1 0 0.8
+clip plane 5 1 1 0 0.8
+clear color 0.0 0.0 0.0 0.0
+
+# Test with planes 0, 2, and 4 enabled.
+enable GL_CLIP_PLANE0
+disable GL_CLIP_PLANE1
+enable GL_CLIP_PLANE2
+disable GL_CLIP_PLANE3
+enable GL_CLIP_PLANE4
+disable GL_CLIP_PLANE5
+clear
+draw rect -1 -1 2 2
+
+# Test points inside each hexagon edge
+relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
+
+# Test points outside each hexagon edge
+relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
+relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1
+relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2
+relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
+relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
+relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5
+
+# Test with planes 0, 1, 4, and 5 enabled.
+enable GL_CLIP_PLANE0
+enable GL_CLIP_PLANE1
+disable GL_CLIP_PLANE2
+disable GL_CLIP_PLANE3
+enable GL_CLIP_PLANE4
+enable GL_CLIP_PLANE5
+clear
+draw rect -1 -1 2 2
+
+# Test points inside each hexagon edge
+relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
+
+# Test points outside each hexagon edge
+relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
+relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1
+relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2
+relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
+relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
+relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5
+
+# Test with planes 0, 1, 2, and 3 enabled.
+enable GL_CLIP_PLANE0
+enable GL_CLIP_PLANE1
+enable GL_CLIP_PLANE2
+enable GL_CLIP_PLANE3
+disable GL_CLIP_PLANE4
+disable GL_CLIP_PLANE5
+clear
+draw rect -1 -1 2 2
+
+# Test points inside each hexagon edge
+relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
+
+# Test points outside each hexagon edge
+relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
+relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1
+relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2
+relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0) # clipped by plane 3
+relative probe rgba (0.2, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 4
+relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5
+
+# Test with planes 4 and 5 enabled.
+disable GL_CLIP_PLANE0
+disable GL_CLIP_PLANE1
+disable GL_CLIP_PLANE2
+disable GL_CLIP_PLANE3
+enable GL_CLIP_PLANE4
+enable GL_CLIP_PLANE5
+clear
+draw rect -1 -1 2 2
+
+# Test points inside each hexagon edge
+relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
+
+# Test points outside each hexagon edge
+relative probe rgba (0.5, 0.2) (1.0, 1.0, 1.0, 1.0) # clipped by plane 0
+relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1
+relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2
+relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
+relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
+relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5
-- 
1.7.6.4



More information about the Piglit mailing list