[Piglit] [PATCH] Add 3 more test for arb_cull_distance

Tobias Klausmann tobias.johannes.klausmann at mni.thm.de
Sun Jan 25 21:13:22 PST 2015


These three tests are testing the actual culling.
Short description:
If a positive value is supplied to gl_CullDistance, the vertex is inside the
cull volume. If a negative value is supplied, the vertex is outside the cull
volume and is discarded.

Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de>
---
 ...-distance-vertex-inside-cull-volume.shader_test | 41 ++++++++++++++++++++++
 .../vs-cull-distance-vertex-on-plane.shader_test   | 41 ++++++++++++++++++++++
 ...distance-vertex-outside-cull-volume.shader_test | 41 ++++++++++++++++++++++
 3 files changed, 123 insertions(+)
 create mode 100644 tests/spec/arb_cull_distance/vs-cull-distance-vertex-inside-cull-volume.shader_test
 create mode 100644 tests/spec/arb_cull_distance/vs-cull-distance-vertex-on-plane.shader_test
 create mode 100644 tests/spec/arb_cull_distance/vs-cull-distance-vertex-outside-cull-volume.shader_test

diff --git a/tests/spec/arb_cull_distance/vs-cull-distance-vertex-inside-cull-volume.shader_test b/tests/spec/arb_cull_distance/vs-cull-distance-vertex-inside-cull-volume.shader_test
new file mode 100644
index 0000000..5dfa194
--- /dev/null
+++ b/tests/spec/arb_cull_distance/vs-cull-distance-vertex-inside-cull-volume.shader_test
@@ -0,0 +1,41 @@
+# [description]
+# Use one gl_CullDistance values to _not_ "cull" away a vertex with a positive
+# value supplied to gl_CullDistance.
+#
+# The gl_CullDistance variable provides a mechanism for controlling user
+# culling. The element gl_CullDistance[i] specifies a cull distance for each
+# plane i. A distance of 0.0 means that the vertex is on the plane, a positive
+# distance means that the vertex is insider the cull volume, and a negative
+# distance means that the point is outside the cull volume. Primitives whose
+# vertices all have a negative clip distance for plane i will be discarded. 
+
+[require]
+GLSL >= 1.30
+GL_ARB_cull_distance
+
+[vertex shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+
+out float gl_CullDistance[1];
+
+void main(void)
+{
+	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+	gl_CullDistance[0] = 1;
+}
+
+[fragment shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+
+void main(void)
+{
+	gl_FragColor = vec4(0, 1, 0, 1);
+}
+
+[test]
+clear color 1.0 0.0 0.0 1.0
+clear
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_cull_distance/vs-cull-distance-vertex-on-plane.shader_test b/tests/spec/arb_cull_distance/vs-cull-distance-vertex-on-plane.shader_test
new file mode 100644
index 0000000..40b74ce
--- /dev/null
+++ b/tests/spec/arb_cull_distance/vs-cull-distance-vertex-on-plane.shader_test
@@ -0,0 +1,41 @@
+# [description]
+# Use one gl_CullDistance values to _not_ "cull" away a vertex with it on
+# the plane (gl_CullDistance=0).
+#
+# The gl_CullDistance variable provides a mechanism for controlling user
+# culling. The element gl_CullDistance[i] specifies a cull distance for each
+# plane i. A distance of 0.0 means that the vertex is on the plane, a positive
+# distance means that the vertex is insider the cull volume, and a negative
+# distance means that the point is outside the cull volume. Primitives whose
+# vertices all have a negative clip distance for plane i will be discarded. 
+
+[require]
+GLSL >= 1.30
+GL_ARB_cull_distance
+
+[vertex shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+
+out float gl_CullDistance[1];
+
+void main(void)
+{
+	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+	gl_CullDistance[0] = 0;
+}
+
+[fragment shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+
+void main(void)
+{
+	gl_FragColor = vec4(0, 1, 0, 1);
+}
+
+[test]
+clear color 1.0 0.0 0.0 1.0
+clear
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_cull_distance/vs-cull-distance-vertex-outside-cull-volume.shader_test b/tests/spec/arb_cull_distance/vs-cull-distance-vertex-outside-cull-volume.shader_test
new file mode 100644
index 0000000..5f71dd3
--- /dev/null
+++ b/tests/spec/arb_cull_distance/vs-cull-distance-vertex-outside-cull-volume.shader_test
@@ -0,0 +1,41 @@
+# [description]
+# Use one gl_CullDistance values to "cull" away a vertex with a negative value
+# supplied to gl_CullDistance.
+#
+# The gl_CullDistance variable provides a mechanism for controlling user
+# culling. The element gl_CullDistance[i] specifies a cull distance for each
+# plane i. A distance of 0.0 means that the vertex is on the plane, a positive
+# distance means that the vertex is insider the cull volume, and a negative
+# distance means that the point is outside the cull volume. Primitives whose
+# vertices all have a negative clip distance for plane i will be discarded. 
+
+[require]
+GLSL >= 1.30
+GL_ARB_cull_distance
+
+[vertex shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+
+out float gl_CullDistance[1];
+
+void main(void)
+{
+	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+	gl_CullDistance[0] = -1;
+}
+
+[fragment shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+
+void main(void)
+{
+	gl_FragColor = vec4(1, 0, 0, 1);
+}
+
+[test]
+clear color 0.0 1.0 0.0 1.0
+clear
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.2.2



More information about the Piglit mailing list