[Piglit] [PATCH 1/2] Fragment shader tests for clipDistance sizing.
Paul Berry
stereotype441 at gmail.com
Tue Sep 6 13:36:42 PDT 2011
This patch adds two new tests,
fs-clip-distance-explicitly-sized.shader_test and
fs-clip-distance-sizeable-to-max.shader_test, to verify that the
clipDistance array behaves properly when its size is explicitly set in
the fragment shader.
These tests parallel the existing tests,
vs-clip-distance-explicitly-sized.shader_test and
vs-clip-distance-sizeable-to-max.shader_test, which were testing the
equivalent functionality in the vertex shader.
---
.../fs-clip-distance-explicitly-sized.shader_test | 38 +++++++++++++++++++
.../fs-clip-distance-sizeable-to-max.shader_test | 39 ++++++++++++++++++++
2 files changed, 77 insertions(+), 0 deletions(-)
create mode 100644 tests/spec/glsl-1.30/execution/clipping/fs-clip-distance-explicitly-sized.shader_test
create mode 100644 tests/spec/glsl-1.30/execution/clipping/fs-clip-distance-sizeable-to-max.shader_test
diff --git a/tests/spec/glsl-1.30/execution/clipping/fs-clip-distance-explicitly-sized.shader_test b/tests/spec/glsl-1.30/execution/clipping/fs-clip-distance-explicitly-sized.shader_test
new file mode 100644
index 0000000..67dc32f
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/clipping/fs-clip-distance-explicitly-sized.shader_test
@@ -0,0 +1,38 @@
+# 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 GLSL compiler respects the size of
+# gl_ClipDistance when it is explicitly declared in the fragment shader.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+out float gl_ClipDistance[3];
+
+void main()
+{
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 130
+in float gl_ClipDistance[3];
+
+void main()
+{
+ gl_FragColor = (gl_ClipDistance.length() == 3) ? vec4(0.0, 1.0, 0.0, 1.0)
+ : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.30/execution/clipping/fs-clip-distance-sizeable-to-max.shader_test b/tests/spec/glsl-1.30/execution/clipping/fs-clip-distance-sizeable-to-max.shader_test
new file mode 100644
index 0000000..bd525fd
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/clipping/fs-clip-distance-sizeable-to-max.shader_test
@@ -0,0 +1,39 @@
+# 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 size of gl_ClipDistance can be set to
+# gl_MaxClipDistances without error, and that this actually causes the
+# size of the array to be set properly.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+out float gl_ClipDistance[gl_MaxClipDistances];
+
+void main()
+{
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 130
+in float gl_ClipDistance[gl_MaxClipDistances];
+
+void main()
+{
+ gl_FragColor = (gl_ClipDistance.length() == gl_MaxClipDistances)
+ ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[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