[Piglit] [PATCH 2/6] Remove bogus vs-clip-distance-implicitly-sized.shader_test.

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


This test was attempting to verify that the GLSL compiler properly
computed the size of the gl_ClipDistance array when it was implicitly
sized, by calling .length() on the array.  But according to the GLSL
spec, it is illegal to call .length() on an implicitly sized array.

Because of this, it is actually impossible to tell using a test
whether the GLSL compiler properly computed the size of an
implicitly-sized array; all we can do is attempt to use all elements
of the array and make sure nothing breaks.  The test
vs-clip-distance-all-planes-enabled.shader_test already does this.  So
I've removed the bogus test.
---
 ...vs-clip-distance-all-planes-enabled.shader_test |   18 +++++++
 .../vs-clip-distance-implicitly-sized.shader_test  |   52 --------------------
 2 files changed, 18 insertions(+), 52 deletions(-)
 delete mode 100644 tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-implicitly-sized.shader_test

diff --git a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-all-planes-enabled.shader_test b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-all-planes-enabled.shader_test
index adb5ad2..db294d5 100644
--- a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-all-planes-enabled.shader_test
+++ b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-all-planes-enabled.shader_test
@@ -1,5 +1,23 @@
 # [description]
 # Use all 6 gl_ClipDistance values to clip a rectangle to a hexagon shape.
+#
+# This also serves as a test that gl_ClipDistance may be implicitly
+# sized, as specified in section 7.1 (Vertex Shader Special Variables)
+# of the GLSL 1.30 spec:
+#
+#   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.
 
 [require]
 GLSL >= 1.30
diff --git a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-implicitly-sized.shader_test b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-implicitly-sized.shader_test
deleted file mode 100644
index 185fb22..0000000
--- a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-implicitly-sized.shader_test
+++ /dev/null
@@ -1,52 +0,0 @@
-# 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 GLSL compiler respects the size of
-# gl_ClipDistance when it is implicitly sized in the vertex shader by
-# indexing into it with integral constant expressions.
-#
-# The spec isn't clear about whether it's necessary for the GLSL
-# compiler to size gl_ClipDistance to the minimum size possible.  In
-# other words, if only gl_ClipDistance[2] is accessed, must the
-# compiler infer that the size of gl_ClipDistance is 3, or is any size
-# greater than or equal to 3 acceptable?  This test assumes any size
-# greater than or equal to 3 is acceptable.
-
-[require]
-GLSL >= 1.30
-
-[vertex shader]
-#version 130
-
-void main()
-{
-  gl_Position = gl_Vertex;
-  gl_FrontColor = (gl_ClipDistance.length() >= 3) ? vec4(0.0, 1.0, 0.0, 1.0)
-                                                  : vec4(1.0, 0.0, 0.0, 1.0);
-  gl_ClipDistance[2] = 1.0;
-}
-
-[fragment shader]
-#version 130
-void main()
-{
-  gl_FragColor = gl_Color;
-}
-
-[test]
-draw rect -1 -1 2 2
-probe all rgba 0.0 1.0 0.0 1.0
-- 
1.7.6



More information about the Piglit mailing list