[Piglit] [PATCH 4/6] gl_ClipDistance: Add better max size checks.

Paul Berry stereotype441 at gmail.com
Sun Sep 4 11:34:31 PDT 2011


These new tests validate that an appropriate error is generated when:
- attempting to access beyond the end of gl_ClipDistance when explicitly sized
  to 3.
- attempting to access beyond the end of gl_ClipDistance when explicitly sized
  to gl_MaxClipDistances.
- attempting to explicitly size gl_ClipDistance beyond gl_MaxClipDistances.
- same as above, but without accessing gl_ClipDistance.
- attempting to access beyond the end of gl_ClipDistance when implicitly sized.

These tests replace clip-distance-not-sizeable-above-max.c, which was less thorough, and more unweildy since it was a straight C program.
---
 tests/all.tests                                    |    1 -
 .../clipping/clip-distance-explicit-access-3.frag  |   30 +++++
 .../clipping/clip-distance-explicit-access-3.vert  |   37 ++++++
 .../clip-distance-explicit-access-max.frag         |   31 +++++
 .../clip-distance-explicit-access-max.vert         |   38 ++++++
 ...ip-distance-explicit-too-large-with-access.frag |   30 +++++
 ...ip-distance-explicit-too-large-with-access.vert |   37 ++++++
 .../clipping/clip-distance-explicit-too-large.frag |   28 +++++
 .../clipping/clip-distance-explicit-too-large.vert |   35 ++++++
 .../clip-distance-implicit-access-max.frag         |   28 +++++
 .../clip-distance-implicit-access-max.vert         |   35 ++++++
 .../glsl-1.30/linker/clipping/CMakeLists.gl.txt    |    1 -
 .../clip-distance-not-sizeable-above-max.c         |  123 --------------------
 13 files changed, 329 insertions(+), 125 deletions(-)
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-3.frag
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-3.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-max.frag
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-max.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large-with-access.frag
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large-with-access.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large.frag
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-access-max.frag
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-access-max.vert
 delete mode 100644 tests/spec/glsl-1.30/linker/clipping/clip-distance-not-sizeable-above-max.c

diff --git a/tests/all.tests b/tests/all.tests
index 931e0d3..9958c66 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -811,7 +811,6 @@ add_shader_test_dir(spec['glsl-1.30']['execution'],
 		    recursive=True)
 spec['glsl-1.30']['linker'] = Group()
 spec['glsl-1.30']['linker']['clipping'] = Group()
-add_plain_test(spec['glsl-1.30']['linker']['clipping'], 'clip-distance-not-sizeable-above-max')
 add_plain_test(spec['glsl-1.30']['linker']['clipping'], 'mixing-clip-distance-and-clip-vertex-disallowed')
 
 # Group AMD_conservative_depth
diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-3.frag b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-3.frag
new file mode 100644
index 0000000..19c10cd
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-3.frag
@@ -0,0 +1,30 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * check_link: true
+ * [end config]
+ *
+ * From the GLSL 1.30 spec section 7.2 (Fragment Shader Special
+ * Variables):
+ *
+ *   The built-in input variable gl_ClipDistance array contains
+ *   linearly interpolated values for the vertex values written by the
+ *   vertex shader to the gl_ClipDistance vertex output variable. This
+ *   array must be sized in the fragment shader either implicitly or
+ *   explicitly to be the same size as it was sized in the vertex
+ *   shader.
+ *
+ * This test checks that the an error occurs when explicitly setting
+ * the size of gl_ClipDistance to 3 (which should be ok) and trying to
+ * access a non-existent element (gl_ClipDistance[3]) using an
+ * integral constant expression, which should generate an error.
+ */
+#version 130
+
+out float gl_ClipDistance[3];
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  gl_FragColor = vec4(gl_ClipDistance[3]);
+}
diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-3.vert b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-3.vert
new file mode 100644
index 0000000..bcfce56
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-3.vert
@@ -0,0 +1,37 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * check_link: true
+ * [end config]
+ *
+ * From the GLSL 1.30 spec section 7.1 (Vertex Shader Special
+ * Variables):
+ *
+ *   The gl_ClipDistance array is predeclared as unsized and must be
+ *   sized by the shader either redeclaring it with a size or indexing
+ *   it only with integral constant expressions. This needs to size
+ *   the array to include all the clip planes that are enabled via the
+ *   OpenGL API; if the size does not include all enabled planes,
+ *   results are undefined. The size can be at most
+ *   gl_MaxClipDistances. The number of varying components (see
+ *   gl_MaxVaryingComponents) consumed by gl_ClipDistance will match
+ *   the size of the array, no matter how many planes are enabled. The
+ *   shader must also set all values in gl_ClipDistance that have been
+ *   enabled via the OpenGL API, or results are undefined. Values
+ *   written into gl_ClipDistance for planes that are not enabled have
+ *   no effect.
+ *
+ * This test checks that the an error occurs when explicitly setting
+ * the size of gl_ClipDistance to 3 (which should be ok) and trying to
+ * access a non-existent element (gl_ClipDistance[3]) using an
+ * integral constant expression, which should generate an error.
+ */
+#version 130
+
+out float gl_ClipDistance[3];
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  gl_ClipDistance[3] = 1.0;
+}
diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-max.frag b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-max.frag
new file mode 100644
index 0000000..22dae46
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-max.frag
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * check_link: true
+ * [end config]
+ *
+ * From the GLSL 1.30 spec section 7.2 (Fragment Shader Special
+ * Variables):
+ *
+ *   The built-in input variable gl_ClipDistance array contains
+ *   linearly interpolated values for the vertex values written by the
+ *   vertex shader to the gl_ClipDistance vertex output variable. This
+ *   array must be sized in the fragment shader either implicitly or
+ *   explicitly to be the same size as it was sized in the vertex
+ *   shader.
+ *
+ * This test checks that the an error occurs when explicitly setting
+ * the size of gl_ClipDistance to gl_MaxClipDistances (which should be
+ * ok) and trying to access a non-existent element
+ * (gl_ClipDistance[gl_MaxClipDistances]) using an integral constant
+ * expression, which should generate an error.
+ */
+#version 130
+
+out float gl_ClipDistance[gl_MaxClipDistances];
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  gl_FragColor = vec4(gl_ClipDistance[gl_MaxClipDistances]);
+}
diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-max.vert b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-max.vert
new file mode 100644
index 0000000..7bbe91c
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-max.vert
@@ -0,0 +1,38 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * check_link: true
+ * [end config]
+ *
+ * From the GLSL 1.30 spec section 7.1 (Vertex Shader Special
+ * Variables):
+ *
+ *   The gl_ClipDistance array is predeclared as unsized and must be
+ *   sized by the shader either redeclaring it with a size or indexing
+ *   it only with integral constant expressions. This needs to size
+ *   the array to include all the clip planes that are enabled via the
+ *   OpenGL API; if the size does not include all enabled planes,
+ *   results are undefined. The size can be at most
+ *   gl_MaxClipDistances. The number of varying components (see
+ *   gl_MaxVaryingComponents) consumed by gl_ClipDistance will match
+ *   the size of the array, no matter how many planes are enabled. The
+ *   shader must also set all values in gl_ClipDistance that have been
+ *   enabled via the OpenGL API, or results are undefined. Values
+ *   written into gl_ClipDistance for planes that are not enabled have
+ *   no effect.
+ *
+ * This test checks that the an error occurs when explicitly setting
+ * the size of gl_ClipDistance to gl_MaxClipDistances (which should be
+ * ok) and trying to access a non-existent element
+ * (gl_ClipDistance[gl_MaxClipDistances]) using an integral constant
+ * expression, which should generate an error.
+ */
+#version 130
+
+out float gl_ClipDistance[gl_MaxClipDistances];
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  gl_ClipDistance[gl_MaxClipDistances] = 1.0;
+}
diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large-with-access.frag b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large-with-access.frag
new file mode 100644
index 0000000..a6cbff4
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large-with-access.frag
@@ -0,0 +1,30 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * check_link: true
+ * [end config]
+ *
+ * From the GLSL 1.30 spec section 7.2 (Fragment Shader Special
+ * Variables):
+ *
+ *   The built-in input variable gl_ClipDistance array contains
+ *   linearly interpolated values for the vertex values written by the
+ *   vertex shader to the gl_ClipDistance vertex output variable. This
+ *   array must be sized in the fragment shader either implicitly or
+ *   explicitly to be the same size as it was sized in the vertex
+ *   shader.
+ *
+ * This test checks that the an error occurs when explicitly setting
+ * the size of gl_ClipDistance to gl_MaxClipDistances+1 (which should
+ * generate an error) and accessing gl_ClipDistance[0] (which would
+ * otherwise be ok).
+ */
+#version 130
+
+out float gl_ClipDistance[gl_MaxClipDistances+1];
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  gl_FragColor = vec4(gl_ClipDistance[0]);
+}
diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large-with-access.vert b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large-with-access.vert
new file mode 100644
index 0000000..6733ddc
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large-with-access.vert
@@ -0,0 +1,37 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * check_link: true
+ * [end config]
+ *
+ * From the GLSL 1.30 spec section 7.1 (Vertex Shader Special
+ * Variables):
+ *
+ *   The gl_ClipDistance array is predeclared as unsized and must be
+ *   sized by the shader either redeclaring it with a size or indexing
+ *   it only with integral constant expressions. This needs to size
+ *   the array to include all the clip planes that are enabled via the
+ *   OpenGL API; if the size does not include all enabled planes,
+ *   results are undefined. The size can be at most
+ *   gl_MaxClipDistances. The number of varying components (see
+ *   gl_MaxVaryingComponents) consumed by gl_ClipDistance will match
+ *   the size of the array, no matter how many planes are enabled. The
+ *   shader must also set all values in gl_ClipDistance that have been
+ *   enabled via the OpenGL API, or results are undefined. Values
+ *   written into gl_ClipDistance for planes that are not enabled have
+ *   no effect.
+ *
+ * This test checks that the an error occurs when explicitly setting
+ * the size of gl_ClipDistance to gl_MaxClipDistances+1 (which should
+ * generate an error) and accessing gl_ClipDistance[0] (which would
+ * otherwise be ok).
+ */
+#version 130
+
+out float gl_ClipDistance[gl_MaxClipDistances+1];
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  gl_ClipDistance[0] = 1.0;
+}
diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large.frag b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large.frag
new file mode 100644
index 0000000..293f7d6
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large.frag
@@ -0,0 +1,28 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * check_link: true
+ * [end config]
+ *
+ * From the GLSL 1.30 spec section 7.2 (Fragment Shader Special
+ * Variables):
+ *
+ *   The built-in input variable gl_ClipDistance array contains
+ *   linearly interpolated values for the vertex values written by the
+ *   vertex shader to the gl_ClipDistance vertex output variable. This
+ *   array must be sized in the fragment shader either implicitly or
+ *   explicitly to be the same size as it was sized in the vertex
+ *   shader.
+ *
+ * This test checks that the an error occurs when explicitly setting
+ * the size of gl_ClipDistance to gl_MaxClipDistances+1, which should
+ * generate an error.
+ */
+#version 130
+
+out float gl_ClipDistance[gl_MaxClipDistances+1];
+
+void main()
+{
+  gl_Position = gl_Vertex;
+}
diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large.vert b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large.vert
new file mode 100644
index 0000000..3287d7f
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large.vert
@@ -0,0 +1,35 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * check_link: true
+ * [end config]
+ *
+ * From the GLSL 1.30 spec section 7.1 (Vertex Shader Special
+ * Variables):
+ *
+ *   The gl_ClipDistance array is predeclared as unsized and must be
+ *   sized by the shader either redeclaring it with a size or indexing
+ *   it only with integral constant expressions. This needs to size
+ *   the array to include all the clip planes that are enabled via the
+ *   OpenGL API; if the size does not include all enabled planes,
+ *   results are undefined. The size can be at most
+ *   gl_MaxClipDistances. The number of varying components (see
+ *   gl_MaxVaryingComponents) consumed by gl_ClipDistance will match
+ *   the size of the array, no matter how many planes are enabled. The
+ *   shader must also set all values in gl_ClipDistance that have been
+ *   enabled via the OpenGL API, or results are undefined. Values
+ *   written into gl_ClipDistance for planes that are not enabled have
+ *   no effect.
+ *
+ * This test checks that the an error occurs when explicitly setting
+ * the size of gl_ClipDistance to gl_MaxClipDistances+1, which should
+ * generate an error.
+ */
+#version 130
+
+out float gl_ClipDistance[gl_MaxClipDistances+1];
+
+void main()
+{
+  gl_Position = gl_Vertex;
+}
diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-access-max.frag b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-access-max.frag
new file mode 100644
index 0000000..c7ede3e
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-access-max.frag
@@ -0,0 +1,28 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * check_link: true
+ * [end config]
+ *
+ * From the GLSL 1.30 spec section 7.2 (Fragment Shader Special
+ * Variables):
+ *
+ *   The built-in input variable gl_ClipDistance array contains
+ *   linearly interpolated values for the vertex values written by the
+ *   vertex shader to the gl_ClipDistance vertex output variable. This
+ *   array must be sized in the fragment shader either implicitly or
+ *   explicitly to be the same size as it was sized in the vertex
+ *   shader.
+ *
+ * This test checks that the an error occurs when the size of
+ * gl_ClipDistance is implicit, and we try to access a non-existent
+ * element (gl_ClipDistance[gl_MaxClipDistances]) using an integral
+ * constant expression.
+ */
+#version 130
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  gl_FragColor = vec4(gl_ClipDistance[gl_MaxClipDistances]);
+}
diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-access-max.vert b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-access-max.vert
new file mode 100644
index 0000000..76b4828
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-access-max.vert
@@ -0,0 +1,35 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * check_link: true
+ * [end config]
+ *
+ * From the GLSL 1.30 spec section 7.1 (Vertex Shader Special
+ * Variables):
+ *
+ *   The gl_ClipDistance array is predeclared as unsized and must be
+ *   sized by the shader either redeclaring it with a size or indexing
+ *   it only with integral constant expressions. This needs to size
+ *   the array to include all the clip planes that are enabled via the
+ *   OpenGL API; if the size does not include all enabled planes,
+ *   results are undefined. The size can be at most
+ *   gl_MaxClipDistances. The number of varying components (see
+ *   gl_MaxVaryingComponents) consumed by gl_ClipDistance will match
+ *   the size of the array, no matter how many planes are enabled. The
+ *   shader must also set all values in gl_ClipDistance that have been
+ *   enabled via the OpenGL API, or results are undefined. Values
+ *   written into gl_ClipDistance for planes that are not enabled have
+ *   no effect.
+ *
+ * This test checks that the an error occurs when the size of
+ * gl_ClipDistance is implicit, and we try to access a non-existent
+ * element (gl_ClipDistance[gl_MaxClipDistances]) using an integral
+ * constant expression.
+ */
+#version 130
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  gl_ClipDistance[gl_MaxClipDistances] = 1.0;
+}
diff --git a/tests/spec/glsl-1.30/linker/clipping/CMakeLists.gl.txt b/tests/spec/glsl-1.30/linker/clipping/CMakeLists.gl.txt
index 233c4f7..28c9e00 100644
--- a/tests/spec/glsl-1.30/linker/clipping/CMakeLists.gl.txt
+++ b/tests/spec/glsl-1.30/linker/clipping/CMakeLists.gl.txt
@@ -14,5 +14,4 @@ link_libraries (
 	${GLUT_glut_LIBRARY}
 )
 
-add_executable (clip-distance-not-sizeable-above-max clip-distance-not-sizeable-above-max.c)
 add_executable (mixing-clip-distance-and-clip-vertex-disallowed mixing-clip-distance-and-clip-vertex-disallowed.c)
diff --git a/tests/spec/glsl-1.30/linker/clipping/clip-distance-not-sizeable-above-max.c b/tests/spec/glsl-1.30/linker/clipping/clip-distance-not-sizeable-above-max.c
deleted file mode 100644
index 249210d..0000000
--- a/tests/spec/glsl-1.30/linker/clipping/clip-distance-not-sizeable-above-max.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright © 2011 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 clip-distance-not-sizeable-above-max.c
- *
- * From the GLSL 1.30 spec section 7.1 (Vertex Shader Special
- * Variables):
- *
- *   The gl_ClipDistance array is predeclared as unsized and must be
- *   sized by the shader either redeclaring it with a size or indexing
- *   it only with integral constant expressions. This needs to size
- *   the array to include all the clip planes that are enabled via the
- *   OpenGL API; if the size does not include all enabled planes,
- *   results are undefined. The size can be at most
- *   gl_MaxClipDistances. The number of varying components (see
- *   gl_MaxVaryingComponents) consumed by gl_ClipDistance will match
- *   the size of the array, no matter how many planes are enabled. The
- *   shader must also set all values in gl_ClipDistance that have been
- *   enabled via the OpenGL API, or results are undefined. Values
- *   written into gl_ClipDistance for planes that are not enabled have
- *   no effect.
- *
- * This test checks that the an error occurs when trying to set the
- * size of gl_ClipDistance larger than gl_MaxClipDistances.
- *
- * Note: we don't care about the specific error that is generated or
- * the precise circumstances under which it occurs--we just want to
- * make sure that gl_MaxClipDistances isn't too small.  So to provoke
- * the error into occurring, we also try to access the first
- * disallowed element of the array.
- */
-#include "piglit-util.h"
-
-int piglit_width = 100, piglit_height = 100;
-int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
-
-static const char vert[] =
-	"#version 130\n"
-	"out float gl_ClipDistance[gl_MaxClipDistances + 1];\n"
-	"void main()\n"
-	"{\n"
-	"  gl_Position = gl_Vertex;\n"
-	"  gl_ClipDistance[gl_MaxClipDistances] = 1.0;\n"
-	"}\n";
-
-static const char frag[] =
-	"#version 130\n"
-	"void main()\n"
-	"{\n"
-	"  gl_FragColor = gl_Color;\n"
-	"}\n";
-
-enum piglit_result
-piglit_display(void)
-{
-	return PIGLIT_FAIL;
-}
-
-void
-piglit_init(int argc, char **argv)
-{
-	const char *glsl_version_string;
-	float glsl_version;
-	GLint ok;
-	GLuint prog;
-	GLuint vs;
-	GLuint fs;
-
-
-	piglit_require_GLSL();
-
-	glsl_version_string = (char *)
-		glGetString(GL_SHADING_LANGUAGE_VERSION);
-	glsl_version = (glsl_version_string == NULL)
-		? 0.0 : strtod(glsl_version_string, NULL);
-	if (glsl_version <= 1.299999) {
-		printf("Test requires GLSL version >= 1.3.  "
-		       "Actual version is %.1f.\n",
-		       glsl_version);
-		piglit_report_result(PIGLIT_SKIP);
-	}
-
-	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);
-	fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);
-	prog = glCreateProgram();
-	glAttachShader(prog, vs);
-	glAttachShader(prog, fs);
-	glLinkProgram(prog);
-	glDeleteShader(vs);
-	glDeleteShader(fs);
-
-	ok = piglit_link_check_status_quiet(prog);
-	if (ok) {
-		fprintf(stderr,
-			"Linking with a shader that accesses gl_ClipDistance "
-			"beyond gl_MaxClipDistances succeeded when it should "
-			"have failed.\n");
-		piglit_report_result(PIGLIT_FAIL);
-	}
-
-	piglit_report_result(PIGLIT_PASS);
-}
-- 
1.7.6



More information about the Piglit mailing list