On 4 September 2011 11:34, Paul Berry <span dir="ltr">&lt;<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
These new tests validate that an appropriate error is generated when:<br>
- attempting to access beyond the end of gl_ClipDistance when explicitly sized<br>
  to 3.<br>
- attempting to access beyond the end of gl_ClipDistance when explicitly sized<br>
  to gl_MaxClipDistances.<br>
- attempting to explicitly size gl_ClipDistance beyond gl_MaxClipDistances.<br>
- same as above, but without accessing gl_ClipDistance.<br>
- attempting to access beyond the end of gl_ClipDistance when implicitly sized.<br>
<br>
These tests replace clip-distance-not-sizeable-above-max.c, which was less thorough, and more unweildy since it was a straight C program.<br>
---<br>
 tests/all.tests                                    |    1 -<br>
 .../clipping/clip-distance-explicit-access-3.frag  |   30 +++++<br>
 .../clipping/clip-distance-explicit-access-3.vert  |   37 ++++++<br>
 .../clip-distance-explicit-access-max.frag         |   31 +++++<br>
 .../clip-distance-explicit-access-max.vert         |   38 ++++++<br>
 ...ip-distance-explicit-too-large-with-access.frag |   30 +++++<br>
 ...ip-distance-explicit-too-large-with-access.vert |   37 ++++++<br>
 .../clipping/clip-distance-explicit-too-large.frag |   28 +++++<br>
 .../clipping/clip-distance-explicit-too-large.vert |   35 ++++++<br>
 .../clip-distance-implicit-access-max.frag         |   28 +++++<br>
 .../clip-distance-implicit-access-max.vert         |   35 ++++++<br>
 .../glsl-1.30/linker/clipping/CMakeLists.gl.txt    |    1 -<br>
 .../clip-distance-not-sizeable-above-max.c         |  123 --------------------<br>
 13 files changed, 329 insertions(+), 125 deletions(-)<br>
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-3.frag<br>
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-3.vert<br>
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-max.frag<br>
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-max.vert<br>
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large-with-access.frag<br>
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large-with-access.vert<br>
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large.frag<br>
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-too-large.vert<br>
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-access-max.frag<br>
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-access-max.vert<br>
 delete mode 100644 tests/spec/glsl-1.30/linker/clipping/clip-distance-not-sizeable-above-max.c<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index 931e0d3..9958c66 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -811,7 +811,6 @@ add_shader_test_dir(spec[&#39;glsl-1.30&#39;][&#39;execution&#39;],<br>
                    recursive=True)<br>
 spec[&#39;glsl-1.30&#39;][&#39;linker&#39;] = Group()<br>
 spec[&#39;glsl-1.30&#39;][&#39;linker&#39;][&#39;clipping&#39;] = Group()<br>
-add_plain_test(spec[&#39;glsl-1.30&#39;][&#39;linker&#39;][&#39;clipping&#39;], &#39;clip-distance-not-sizeable-above-max&#39;)<br>
 add_plain_test(spec[&#39;glsl-1.30&#39;][&#39;linker&#39;][&#39;clipping&#39;], &#39;mixing-clip-distance-and-clip-vertex-disallowed&#39;)<br>
<br>
 # Group AMD_conservative_depth<br>
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<br>
new file mode 100644<br>
index 0000000..19c10cd<br>
--- /dev/null<br>
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-explicit-access-3.frag<br>
@@ -0,0 +1,30 @@<br>
+/* [config]<br>
+ * expect_result: fail<br>
+ * glsl_version: 1.30<br>
+ * check_link: true<br>
+ * [end config]<br>
+ *<br>
+ * From the GLSL 1.30 spec section 7.2 (Fragment Shader Special<br>
+ * Variables):<br>
+ *<br>
+ *   The built-in input variable gl_ClipDistance array contains<br>
+ *   linearly interpolated values for the vertex values written by the<br>
+ *   vertex shader to the gl_ClipDistance vertex output variable. This<br>
+ *   array must be sized in the fragment shader either implicitly or<br>
+ *   explicitly to be the same size as it was sized in the vertex<br>
+ *   shader.<br>
+ *<br>
+ * This test checks that the an error occurs when explicitly setting<br>
+ * the size of gl_ClipDistance to 3 (which should be ok) and trying to<br>
+ * access a non-existent element (gl_ClipDistance[3]) using an<br>
+ * integral constant expression, which should generate an error.<br>
+ */<br>
+#version 130<br>
+<br>
+out float gl_ClipDistance[3];<br>
+<br>
+void main()<br>
+{<br>
+  gl_Position = gl_Vertex;<br>
+  gl_FragColor = vec4(gl_ClipDistance[3]);<br>
+}<br></blockquote><div><br>Whoops, all the .frag programs in this patch have an extra bogus line saying &quot;gl_Position = gl_Vertex;&quot;.  This causes the test to pass, but for the wrong reason (it passes because &quot;gl_Vertex&quot; and &quot;gl_Position&quot; are not defined for fragment shaders, not because of the gl_ClipDistance sizing rules that these tests are intended to check).  I&#39;ll remove these bogus lines before pushing the patches.<br>
</div></div>