[Piglit] [PATCH] Add more ARB_cull_distance tests

Kristian Høgsberg hoegsberg at gmail.com
Fri May 13 21:56:43 UTC 2016


From: Kristian Høgsberg Kristensen <kristian.h.kristensen at intel.com>

This adds a handful simpler tests for ARB_cull_distance. Instead of the
uncessarily complicated math in the old tests, we just set the distances
based on gl_VertexID. That way we can reliably select which triangles to
cull and/or clip and where we clip them.

We also replace fs-cull-and-clip-distance-exceed-max.shader_test with a
C test so we can properly catch the specified compile or link error when
one of the array sizes or the sum of their sizes exceed the limits.
---
 tests/spec/arb_cull_distance/CMakeLists.gl.txt     |   2 +-
 .../arb_cull_distance/basic-cull-1.shader_test     |  37 +++++++
 .../arb_cull_distance/basic-cull-2.shader_test     |  38 +++++++
 .../arb_cull_distance/basic-cull-3.shader_test     |  38 +++++++
 .../arb_cull_distance/basic-cull-4.shader_test     |  35 +++++++
 .../spec/arb_cull_distance/clip-cull-1.shader_test |  37 +++++++
 .../spec/arb_cull_distance/clip-cull-2.shader_test |  46 +++++++++
 .../spec/arb_cull_distance/clip-cull-3.shader_test |  48 +++++++++
 .../spec/arb_cull_distance/clip-cull-4.shader_test |  48 +++++++++
 tests/spec/arb_cull_distance/exceed-limits.c       | 110 +++++++++++++++++++++
 ...s-cull-and-clip-distance-exceed-max.shader_test |  39 --------
 ...e-vertex-inside-outside-cull-volume.shader_test |  55 -----------
 ...side-cull-volume-inside-clip-volume.shader_test |  58 -----------
 13 files changed, 438 insertions(+), 153 deletions(-)
 create mode 100644 tests/spec/arb_cull_distance/basic-cull-1.shader_test
 create mode 100644 tests/spec/arb_cull_distance/basic-cull-2.shader_test
 create mode 100644 tests/spec/arb_cull_distance/basic-cull-3.shader_test
 create mode 100644 tests/spec/arb_cull_distance/basic-cull-4.shader_test
 create mode 100644 tests/spec/arb_cull_distance/clip-cull-1.shader_test
 create mode 100644 tests/spec/arb_cull_distance/clip-cull-2.shader_test
 create mode 100644 tests/spec/arb_cull_distance/clip-cull-3.shader_test
 create mode 100644 tests/spec/arb_cull_distance/clip-cull-4.shader_test
 create mode 100644 tests/spec/arb_cull_distance/exceed-limits.c
 delete mode 100644 tests/spec/arb_cull_distance/fs-cull-and-clip-distance-exceed-max.shader_test
 delete mode 100644 tests/spec/arb_cull_distance/vs-cull-distance-vertex-inside-outside-cull-volume.shader_test
 delete mode 100644 tests/spec/arb_cull_distance/vs-cull-distance-vertex-outside-cull-volume-inside-clip-volume.shader_test

diff --git a/tests/spec/arb_cull_distance/CMakeLists.gl.txt b/tests/spec/arb_cull_distance/CMakeLists.gl.txt
index 0a2d4a2..1d2fe1d 100644
--- a/tests/spec/arb_cull_distance/CMakeLists.gl.txt
+++ b/tests/spec/arb_cull_distance/CMakeLists.gl.txt
@@ -10,4 +10,4 @@ link_libraries (
 )
 
 piglit_add_executable (arb_cull_distance-max-distances max-distances.c)
-
+piglit_add_executable (arb_cull_distance-exceed-limits exceed-limits.c)
diff --git a/tests/spec/arb_cull_distance/basic-cull-1.shader_test b/tests/spec/arb_cull_distance/basic-cull-1.shader_test
new file mode 100644
index 0000000..436e8a0
--- /dev/null
+++ b/tests/spec/arb_cull_distance/basic-cull-1.shader_test
@@ -0,0 +1,37 @@
+# Cull triangle 0
+
+[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_Vertex;
+
+	gl_CullDistance[0] = gl_VertexID - 3;
+}
+
+[fragment shader]
+#version 130
+
+void main(void)
+{
+	gl_FragColor = vec4(0, 0, 1, 1);
+}
+
+[test]
+clear color 0.0 1.0 0.0 1.0
+clear
+draw rect -1 -1 2 2
+
+# Bottom left corner is green because triangle 0 was culled
+relative probe rgba (0.100, 0.100) (0.0, 1.0, 0.0, 1.0)
+
+# Top right corner is blue because triangle 1 was not culled
+relative probe rgba (0.900, 0.900) (0.0, 0.0, 1.0, 1.0)
diff --git a/tests/spec/arb_cull_distance/basic-cull-2.shader_test b/tests/spec/arb_cull_distance/basic-cull-2.shader_test
new file mode 100644
index 0000000..deec96f
--- /dev/null
+++ b/tests/spec/arb_cull_distance/basic-cull-2.shader_test
@@ -0,0 +1,38 @@
+# Cull triangle 0 using cull distance 0. Set cull distance 1 to always accept.
+
+[require]
+GLSL >= 1.30
+GL_ARB_cull_distance
+
+[vertex shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+
+out float gl_CullDistance[2];
+
+void main(void)
+{
+	gl_Position = gl_Vertex;
+
+	gl_CullDistance[0] = gl_VertexID - 3;
+	gl_CullDistance[1] = 5.0;
+}
+
+[fragment shader]
+#version 130
+
+void main(void)
+{
+	gl_FragColor = vec4(0, 0, 1, 1);
+}
+
+[test]
+clear color 0.0 1.0 0.0 1.0
+clear
+draw rect -1 -1 2 2
+
+# Bottom left corner is green because triangle 0 was culled
+relative probe rgba (0.100, 0.100) (0.0, 1.0, 0.0, 1.0)
+
+# Top right corner is blue because triangle 1 was not culled
+relative probe rgba (0.900, 0.900) (0.0, 0.0, 1.0, 1.0)
diff --git a/tests/spec/arb_cull_distance/basic-cull-3.shader_test b/tests/spec/arb_cull_distance/basic-cull-3.shader_test
new file mode 100644
index 0000000..8078754
--- /dev/null
+++ b/tests/spec/arb_cull_distance/basic-cull-3.shader_test
@@ -0,0 +1,38 @@
+# Use a second cull distance and set it to always reject.
+
+[require]
+GLSL >= 1.30
+GL_ARB_cull_distance
+
+[vertex shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+
+out float gl_CullDistance[2];
+
+void main(void)
+{
+	gl_Position = gl_Vertex;
+
+	gl_CullDistance[0] = gl_VertexID - 3;
+	gl_CullDistance[1] = -5.0;
+}
+
+[fragment shader]
+#version 130
+
+void main(void)
+{
+	gl_FragColor = vec4(0, 0, 1, 1);
+}
+
+[test]
+clear color 0.0 1.0 0.0 1.0
+clear
+draw rect -1 -1 2 2
+
+# Bottom left corner is green because triangle 0 was culled
+relative probe rgba (0.100, 0.100) (0.0, 1.0, 0.0, 1.0)
+
+# Top right corner is green because triangle 1 was culled
+relative probe rgba (0.900, 0.900) (0.0, 1.0, 0.0, 1.0)
diff --git a/tests/spec/arb_cull_distance/basic-cull-4.shader_test b/tests/spec/arb_cull_distance/basic-cull-4.shader_test
new file mode 100644
index 0000000..b9c413c
--- /dev/null
+++ b/tests/spec/arb_cull_distance/basic-cull-4.shader_test
@@ -0,0 +1,35 @@
+# Cull triangle 0 with cull distance 0, cull triangle 1 with cull distance 1
+
+[require]
+GLSL >= 1.30
+GL_ARB_cull_distance
+
+[vertex shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+
+out float gl_CullDistance[2];
+
+void main(void)
+{
+	gl_Position = gl_Vertex;
+
+	gl_CullDistance[0] = gl_VertexID - 3;
+	gl_CullDistance[1] = 0.5 - gl_VertexID;
+}
+
+[fragment shader]
+#version 130
+
+void main(void)
+{
+	gl_FragColor = vec4(0, 0, 1, 1);
+}
+
+[test]
+clear color 0.0 1.0 0.0 1.0
+clear
+draw rect -1 -1 2 2
+
+# Both triangles culled, all should be green.
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_cull_distance/clip-cull-1.shader_test b/tests/spec/arb_cull_distance/clip-cull-1.shader_test
new file mode 100644
index 0000000..8b94f78
--- /dev/null
+++ b/tests/spec/arb_cull_distance/clip-cull-1.shader_test
@@ -0,0 +1,37 @@
+# Use a clip and cull distances. Always accept.
+
+[require]
+GLSL >= 1.30
+GL_ARB_cull_distance
+
+[vertex shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+
+out float gl_CullDistance[1];
+out float gl_ClipDistance[1];
+
+void main(void)
+{
+	gl_Position = gl_Vertex;
+
+	gl_CullDistance[0] = 5.0;
+	gl_ClipDistance[0] = 5.0;
+}
+
+[fragment shader]
+#version 130
+
+void main(void)
+{
+	gl_FragColor = vec4(0, 0, 1, 1);
+}
+
+[test]
+clear color 0.0 1.0 0.0 1.0
+clear
+enable GL_CLIP_PLANE0
+draw rect -1 -1 2 2
+
+# All blue, nothing clipped or culled
+probe all rgba 0.0 0.0 1.0 1.0
diff --git a/tests/spec/arb_cull_distance/clip-cull-2.shader_test b/tests/spec/arb_cull_distance/clip-cull-2.shader_test
new file mode 100644
index 0000000..765799e
--- /dev/null
+++ b/tests/spec/arb_cull_distance/clip-cull-2.shader_test
@@ -0,0 +1,46 @@
+# Use a clip and cull distances. Never cull, clip triangle 0 between
+# vertices 0 and 1.
+
+[require]
+GLSL >= 1.30
+GL_ARB_cull_distance
+
+[vertex shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+
+out float gl_CullDistance[1];
+out float gl_ClipDistance[1];
+
+void main(void)
+{
+	gl_Position = gl_Vertex;
+
+	gl_CullDistance[0] = 5.0;
+	gl_ClipDistance[0] = gl_VertexID - 1;
+}
+
+[fragment shader]
+#version 130
+
+void main(void)
+{
+	gl_FragColor = vec4(0, 0, 1, 1);
+}
+
+[test]
+clear color 0.0 1.0 0.0 1.0
+clear
+enable GL_CLIP_PLANE0
+draw rect -1 -1 2 2
+
+# Bottom left corner is green because triangle 0 was clipped between
+# vertex 0 and 1.
+relative probe rgba (0.100, 0.100) (0.0, 1.0, 0.0, 1.0)
+
+# Top left corner is blue because triangle 0 was clipped between
+# vertex 0 and 1.
+relative probe rgba (0.100, 0.900) (0.0, 0.0, 1.0, 1.0)
+
+# Top right corner is blue because triangle 1 was not culled or clipped
+relative probe rgba (0.900, 0.900) (0.0, 0.0, 1.0, 1.0)
diff --git a/tests/spec/arb_cull_distance/clip-cull-3.shader_test b/tests/spec/arb_cull_distance/clip-cull-3.shader_test
new file mode 100644
index 0000000..8db09ba
--- /dev/null
+++ b/tests/spec/arb_cull_distance/clip-cull-3.shader_test
@@ -0,0 +1,48 @@
+# Use clip and cull distances. Clip triangle 0 between vertices 0 and
+# 1, cull triangle 0.
+
+[require]
+GLSL >= 1.30
+GL_ARB_cull_distance
+
+[vertex shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+
+out float gl_CullDistance[1];
+out float gl_ClipDistance[1];
+
+void main(void)
+{
+	gl_Position = gl_Vertex;
+
+	gl_CullDistance[0] = gl_VertexID - 3;
+	gl_ClipDistance[0] = gl_VertexID - 1;
+}
+
+[fragment shader]
+#version 130
+
+void main(void)
+{
+	gl_FragColor = vec4(0, 0, 1, 1);
+}
+
+[test]
+clear color 0.0 1.0 0.0 1.0
+clear
+enable GL_CLIP_PLANE0
+draw rect -1 -1 2 2
+
+# Bottom left corner is green because triangle 0 was culled
+relative probe rgba (0.100, 0.100) (0.0, 1.0, 0.0, 1.0)
+
+# Top left corner is green below diagonal because triangle 0 was culled
+relative probe rgba (0.050, 0.900) (0.0, 1.0, 0.0, 1.0)
+
+# Top left corner is blue above diagonal because triangle 1 was not
+# culled or clipped.
+relative probe rgba (0.100, 0.950) (0.0, 0.0, 1.0, 1.0)
+
+# Top right corner is blue because triangle 1 was not culled or clipped
+relative probe rgba (0.900, 0.900) (0.0, 0.0, 1.0, 1.0)
diff --git a/tests/spec/arb_cull_distance/clip-cull-4.shader_test b/tests/spec/arb_cull_distance/clip-cull-4.shader_test
new file mode 100644
index 0000000..04d8503
--- /dev/null
+++ b/tests/spec/arb_cull_distance/clip-cull-4.shader_test
@@ -0,0 +1,48 @@
+# Use clip and cull distances. Clip triangle 0 between vertices 0 and
+# 1, cull triangle 1
+
+[require]
+GLSL >= 1.30
+GL_ARB_cull_distance
+
+[vertex shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+
+out float gl_CullDistance[1];
+out float gl_ClipDistance[1];
+
+void main(void)
+{
+	gl_Position = gl_Vertex;
+
+	gl_CullDistance[0] = 0.5 - gl_VertexID;
+	gl_ClipDistance[0] = gl_VertexID - 1;
+}
+
+[fragment shader]
+#version 130
+
+void main(void)
+{
+	gl_FragColor = vec4(0, 0, 1, 1);
+}
+
+[test]
+clear color 0.0 1.0 0.0 1.0
+clear
+enable GL_CLIP_PLANE0
+draw rect -1 -1 2 2
+
+# Bottom left corner is green because triangle 1 was clipped between
+# vertices 0 and 1
+relative probe rgba (0.100, 0.100) (0.0, 1.0, 0.0, 1.0)
+
+# Top left corner under the diagonal is blue because triangle 0 was clipped
+relative probe rgba (0.050, 0.900) (0.0, 0.0, 1.0, 1.0)
+
+# Top left corner over the diagonal is green because triangle 1 was culled
+relative probe rgba (0.100, 0.950) (0.0, 1.0, 0.0, 1.0)
+
+# Top right corner is green because triangle 1 was culled
+relative probe rgba (0.900, 0.900) (0.0, 1.0, 0.0, 1.0)
diff --git a/tests/spec/arb_cull_distance/exceed-limits.c b/tests/spec/arb_cull_distance/exceed-limits.c
new file mode 100644
index 0000000..10fecb9
--- /dev/null
+++ b/tests/spec/arb_cull_distance/exceed-limits.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright © 2015 Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de>
+ * Copyright © 2016 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file exceed.c
+ */
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vert_tmpl[] =
+   "#version 130\n"
+   "#extension GL_ARB_cull_distance: enable\n"
+   "%sout float gl_CullDistance[%d];\n"
+   "%sout float gl_ClipDistance[%d];\n"
+   "void main()\n"
+   "{\n"
+   "  gl_Position = gl_Vertex;\n"
+   "}\n";
+
+enum piglit_result
+piglit_display(void)
+{
+	return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+	GLuint prog, vs;
+	char vert[2048];
+	GLint max_clip_distances;
+	GLint max_cull_distances;
+	GLint max_combined_clip_and_cull_distances;
+	GLint clip_distances;
+	GLint cull_distances;
+	char *use_cull = "", *use_clip = "";
+
+	glGetIntegerv(GL_MAX_CLIP_DISTANCES, &max_clip_distances);
+	glGetIntegerv(GL_MAX_CULL_DISTANCES, &max_cull_distances);
+	glGetIntegerv(GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES,
+		      &max_combined_clip_and_cull_distances);
+
+	if (argc != 2) {
+		printf("usage: %s cull/clip/total\n", argv[0]);
+		piglit_report_result(PIGLIT_FAIL);
+	}
+
+	if (strcmp(argv[1], "cull") == 0) {
+		use_clip = "// ";
+		cull_distances = max_cull_distances + 2;
+	} else if (strcmp(argv[1], "clip") == 0) {
+		clip_distances = max_clip_distances + 2;
+		use_cull = "// ";
+	} else if (strcmp(argv[1], "total") == 0) {
+		clip_distances = max_combined_clip_and_cull_distances / 2 + 1;
+		cull_distances = max_combined_clip_and_cull_distances / 2 + 1;
+	} else {
+		printf("unknown subtest: %s\n", argv[1]);
+		piglit_report_result(PIGLIT_FAIL);
+	}
+
+	snprintf(vert, sizeof(vert), vert_tmpl,
+		 use_clip, clip_distances,
+		 use_cull, cull_distances);
+
+	piglit_require_gl_version(30);
+	piglit_require_GLSL();
+	piglit_require_GLSL_version(130);
+	piglit_require_extension("GL_ARB_cull_distance");
+
+	vs = piglit_compile_shader_text_nothrow(GL_VERTEX_SHADER, vert);
+	if (vs == 0)
+		piglit_report_result(PIGLIT_PASS);
+
+	prog = glCreateProgram();
+	glAttachShader(prog, vs);
+
+	glLinkProgram(prog);
+	if (!piglit_link_check_status(prog))
+		piglit_report_result(PIGLIT_PASS);
+
+	piglit_report_result(PIGLIT_FAIL);
+}
diff --git a/tests/spec/arb_cull_distance/fs-cull-and-clip-distance-exceed-max.shader_test b/tests/spec/arb_cull_distance/fs-cull-and-clip-distance-exceed-max.shader_test
deleted file mode 100644
index 8106092..0000000
--- a/tests/spec/arb_cull_distance/fs-cull-and-clip-distance-exceed-max.shader_test
+++ /dev/null
@@ -1,39 +0,0 @@
-# From the ARB_cull_distance spec:
-#
-#   It is a compile-time or link-time error for the set of shaders forming
-#   a program to have the sum of the sizes of the gl_ClipDistance and
-#   gl_CullDistance arrays to be larger than
-#   gl_MaxCombinedClipAndCullDistances.
-#
-# This test checks that the combined size of gl_CullDistance and
-# gl_ClipDistance causes an error when exceeding
-# gl_MaxCombinedClipAndCullDistances.
-
-[require]
-GLSL >= 1.30
-GL_ARB_cull_distance
-
-[vertex shader]
-#version 130
-#extension GL_ARB_cull_distance: enable
-out float gl_ClipDistance[gl_MaxCombinedClipAndCullDistances];
-out float gl_CullDistance[gl_MaxCombinedClipAndCullDistances];
-
-void main()
-{
-  gl_Position = gl_Vertex;
-}
-
-[fragment shader]
-#version 130
-#extension GL_ARB_cull_distance: enable
-in float gl_ClipDistance[gl_MaxCombinedClipAndCullDistances];
-in float gl_CullDistance[gl_MaxCombinedClipAndCullDistances];
-
-void main()
-{
-  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
-}
-
-[test]
-link error
diff --git a/tests/spec/arb_cull_distance/vs-cull-distance-vertex-inside-outside-cull-volume.shader_test b/tests/spec/arb_cull_distance/vs-cull-distance-vertex-inside-outside-cull-volume.shader_test
deleted file mode 100644
index 7974b20..0000000
--- a/tests/spec/arb_cull_distance/vs-cull-distance-vertex-inside-outside-cull-volume.shader_test
+++ /dev/null
@@ -1,55 +0,0 @@
-# Use 4 gl_CullDistance values to "cull" away some vertices with negative values
-# 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[4];
-
-void main(void)
-{
-         gl_Position = gl_Vertex;
-
-         // Compute 2D cordinates relative to a center point of (0.5,
-         // 0.5).
-         vec2 coord = gl_Vertex.xy - vec2(0.5, 0.5);
-
-         for (int i = 0; i < 4; ++i) {
-                  uint j = uint(i);
-
-                  // Compute a unit vector in the direction i*45deg from
-                  // the x axis.
-                  float angle = i*(3.141592653589793/4);
-                  vec2 u = vec2(cos(angle), sin(angle));
-
-                  gl_CullDistance[j] = -0.5 - dot(u, coord);
-         }
-}
-
-[fragment shader]
-#version 130
-
-void main(void)
-{
-         gl_FragColor = vec4(0, 1, 1, 1);
-}
-
-[test]
-clear color 0.0 1.0 0.0 1.0
-clear
-draw rect -1 -1 2 2
-
-relative probe rgba (0.100, 0.100) (0.0, 1.0, 1.0, 1.0)
-relative probe rgba (0.900, 0.900) (0.0, 1.0, 0.0, 1.0)
diff --git a/tests/spec/arb_cull_distance/vs-cull-distance-vertex-outside-cull-volume-inside-clip-volume.shader_test b/tests/spec/arb_cull_distance/vs-cull-distance-vertex-outside-cull-volume-inside-clip-volume.shader_test
deleted file mode 100644
index e884ea2..0000000
--- a/tests/spec/arb_cull_distance/vs-cull-distance-vertex-outside-cull-volume-inside-clip-volume.shader_test
+++ /dev/null
@@ -1,58 +0,0 @@
-# Use two gl_CullDistance values to "cull" away some vertices with negative
-# values. Additionally use two gl_ClipDistance values with positive values to
-# see if gl_CullDistance and gl_ClipDistance are different arrays.
-#
-# 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_ClipDistance[2];
-out float gl_CullDistance[2];
-
-void main(void)
-{
-         gl_Position = gl_Vertex;
-
-         // Compute 2D cordinates relative to a center point of (0.5,
-         // 0.5).
-         vec2 coord = gl_Vertex.xy - vec2(0.5, 0.5);
-
-         for (int i = 0; i < 2; ++i) {
-                  uint j = uint(i);
-
-                  // Compute a unit vector in the direction i*45deg from
-                  // the x axis.
-                  float angle = i*(3.141592653589793/4);
-                  vec2 u = vec2(cos(angle), sin(angle));
-
-                  gl_CullDistance[j] = -0.5 - dot(u, coord);
-                  gl_ClipDistance[j] = 1 - dot(u, coord);
-         }
-}
-
-[fragment shader]
-#version 130
-
-void main(void)
-{
-         gl_FragColor = vec4(0, 1, 1, 1);
-}
-
-[test]
-clear color 0.0 1.0 0.0 1.0
-clear
-draw rect -1 -1 2 2
-
-relative probe rgba (0.100, 0.100) (0.0, 1.0, 1.0, 1.0)
-relative probe rgba (0.900, 0.900) (0.0, 1.0, 0.0, 1.0)
-- 
2.5.0



More information about the Piglit mailing list