[Piglit] [PATCH 1/3] Test that gl_ClipVertex respects clip plane enable flags.
Ian Romanick
idr at freedesktop.org
Thu Oct 6 14:20:22 PDT 2011
On 10/03/2011 04:19 PM, Paul Berry wrote:
> This test is similar to the existing
> "vs-clip-distance-enables.shader_test", except that it tests the
> behavior of gl_ClipVertex instead of gl_ClipDistance. Because of
> differences in the way gl_ClipVertex and gl_ClipDistance are
> implemented in Mesa, it's possible that one of these tests might pass
> while the other fails.
There is one thing that I don't think I noticed when
vs-clip-distance-enables.shader_test went around for review. If the
test fails in, say, the first draw will be difficult to debug because
it's overdrawn by later operations. Other than breaking this into
several separate tests, I don't see a good way to fix that.
So, other than just wanting to complain, the series is
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
> .../clipping/vs-clip-vertex-enables.shader_test | 147 ++++++++++++++++++++
> 1 files changed, 147 insertions(+), 0 deletions(-)
> create mode 100644 tests/spec/glsl-1.20/execution/clipping/vs-clip-vertex-enables.shader_test
>
> diff --git a/tests/spec/glsl-1.20/execution/clipping/vs-clip-vertex-enables.shader_test b/tests/spec/glsl-1.20/execution/clipping/vs-clip-vertex-enables.shader_test
> new file mode 100644
> index 0000000..b93d16f
> --- /dev/null
> +++ b/tests/spec/glsl-1.20/execution/clipping/vs-clip-vertex-enables.shader_test
> @@ -0,0 +1,147 @@
> +# This test sets up 6 clipping planes using gl_ClipVertex, which clip
> +# a rectangle to a hexagon shape. Then it tests various combinations
> +# of enables for the 6 clipping planes, and verifies that they all
> +# create the correct shape.
> +#
> +# To verify that each enable works, the combinations of enables were
> +# chosen such that:
> +# - Every plane is enabled at least once and disbled at least once.
> +# - Every plane is enabled and disabled in a different pattern.
> +#
> +# Note: Some implementations have bugs related to improper coordinate
> +# transformations of clip planes (which are already adequately tested
> +# by the clip-plane-transformation test), so to avoid those bugs
> +# contaminating the results of this test, we don't do any coordinate
> +# transformation in this test.
> +
> +[require]
> +GLSL>= 1.20
> +
> +[vertex shader]
> +#version 120
> +void main(void)
> +{
> + gl_Position = gl_Vertex;
> +
> + gl_ClipVertex = gl_Position;
> +}
> +
> +[fragment shader]
> +#version 120
> +void main(void)
> +{
> + gl_FragColor = vec4(1, 1, 1, 1);
> +}
> +
> +[test]
> +clip plane 0 0 1 0 0.5
> +clip plane 1 -1 1 0 0.8
> +clip plane 2 -1 -1 0 0.8
> +clip plane 3 0 -1 0 0.5
> +clip plane 4 1 -1 0 0.8
> +clip plane 5 1 1 0 0.8
> +clear color 0.0 0.0 0.0 0.0
> +
> +# Test with planes 0, 2, and 4 enabled.
> +enable GL_CLIP_PLANE0
> +disable GL_CLIP_PLANE1
> +enable GL_CLIP_PLANE2
> +disable GL_CLIP_PLANE3
> +enable GL_CLIP_PLANE4
> +disable GL_CLIP_PLANE5
> +clear
> +draw rect -1 -1 2 2
> +
> +# Test points inside each hexagon edge
> +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
> +
> +# Test points outside each hexagon edge
> +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
> +relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1
> +relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2
> +relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
> +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
> +relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5
> +
> +# Test with planes 0, 1, 4, and 5 enabled.
> +enable GL_CLIP_PLANE0
> +enable GL_CLIP_PLANE1
> +disable GL_CLIP_PLANE2
> +disable GL_CLIP_PLANE3
> +enable GL_CLIP_PLANE4
> +enable GL_CLIP_PLANE5
> +clear
> +draw rect -1 -1 2 2
> +
> +# Test points inside each hexagon edge
> +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
> +
> +# Test points outside each hexagon edge
> +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
> +relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1
> +relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2
> +relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
> +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
> +relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5
> +
> +# Test with planes 0, 1, 2, and 3 enabled.
> +enable GL_CLIP_PLANE0
> +enable GL_CLIP_PLANE1
> +enable GL_CLIP_PLANE2
> +enable GL_CLIP_PLANE3
> +disable GL_CLIP_PLANE4
> +disable GL_CLIP_PLANE5
> +clear
> +draw rect -1 -1 2 2
> +
> +# Test points inside each hexagon edge
> +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
> +
> +# Test points outside each hexagon edge
> +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
> +relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1
> +relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2
> +relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0) # clipped by plane 3
> +relative probe rgba (0.2, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 4
> +relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5
> +
> +# Test with planes 4 and 5 enabled.
> +disable GL_CLIP_PLANE0
> +disable GL_CLIP_PLANE1
> +disable GL_CLIP_PLANE2
> +disable GL_CLIP_PLANE3
> +enable GL_CLIP_PLANE4
> +enable GL_CLIP_PLANE5
> +clear
> +draw rect -1 -1 2 2
> +
> +# Test points inside each hexagon edge
> +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
> +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
> +
> +# Test points outside each hexagon edge
> +relative probe rgba (0.5, 0.2) (1.0, 1.0, 1.0, 1.0) # clipped by plane 0
> +relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1
> +relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2
> +relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
> +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
> +relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5
More information about the Piglit
mailing list