[Piglit] [PATCH] Add test for ARB_clip_control.

Ilia Mirkin imirkin at alum.mit.edu
Sat Nov 15 10:04:40 PST 2014


I can confirm that this now requires me to set DEPTH_CLIP_NEGATIVE_Z
to cso->clip_halfz in order for the test to pass. It now fails if I
force it to either 1 or 0, but passes when set to cso->clip_halfz.

It's probably completely obvious that I'm in no way suited to review
this though, but happy to add my

Tested-by: Ilia Mirkin <imirkin at alum.mit.edu>

If someone can review this, I can fix up the commit log and check it in.

  -ilia


On Sat, Nov 15, 2014 at 8:05 AM,  <Mathias.Froehlich at gmx.net> wrote:
> From: Mathias Fröhlich <Mathias.Froehlich at gmx.net>
>
> Hi,
>
> This adds clip control to the set of piglit tests.
> This time with an other bunch of tests covering
> different depth range settings.
>
> please review, and if ok, can somebody with piglit
> push access feed that to the repository, as I don't
> have write access to piglit IIRC.
>
> Thanks!
>
> Mathias
>
>
> v2:
> Check for ARB_depth_buffer_float where used.
> Fix and extend comments.
> Introduce helper for reading and checking the clip control state.
> Split state and draw related parts into separate methods.
> Test for Push/PopAttrib.
>
> v3:
> Add tests to tests/all.py.
>
> v4:
> Use piglit_draw_rect_z instead of a hand written function.
>
> v5:
> Check for different depth range values.
> To implement the above, refactor the implementation.
> Rebase to current upstream.
>
> Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de>
> CC: Ilia Mirkin <imirkin at alum.mit.edu>
> CC: Brian Paul <brianp at vmware.com>
> CC: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  tests/all.py                                       |   5 +
>  tests/spec/CMakeLists.txt                          |   1 +
>  tests/spec/arb_clip_control/CMakeLists.gl.txt      |  15 ++
>  tests/spec/arb_clip_control/CMakeLists.txt         |   1 +
>  .../clip-control-depth-precision.c                 | 174 +++++++++++++
>  tests/spec/arb_clip_control/clip-control.c         | 285 +++++++++++++++++++++
>  6 files changed, 481 insertions(+)
>  create mode 100644 tests/spec/arb_clip_control/CMakeLists.gl.txt
>  create mode 100644 tests/spec/arb_clip_control/CMakeLists.txt
>  create mode 100644 tests/spec/arb_clip_control/clip-control-depth-precision.c
>  create mode 100644 tests/spec/arb_clip_control/clip-control.c
>
> diff --git a/tests/all.py b/tests/all.py
> index f2c5c1f..a0aeca9 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -2279,6 +2279,11 @@ add_fbo_generatemipmap_extension(tdfx_texture_compression_fxt1, 'GL_3DFX_texture
>  tdfx_texture_compression_fxt1['invalid formats'] = PiglitGLTest('arb_texture_compression-invalid-formats fxt1', run_concurrent=True)
>  add_plain_test(tdfx_texture_compression_fxt1, 'fxt1-teximage')
>
> +arb_clip_control = {}
> +spec['ARB_clip_control'] = arb_clip_control
> +add_plain_test(arb_clip_control, 'clip-control')
> +add_plain_test(arb_clip_control, 'clip-control-depth-precision')
> +
>  def add_color_buffer_float_test(name, format, p1, p2):
>      arb_color_buffer_float[format + '-' + name + ('-' + p1 if len(p1) else '') + ('-' + p2 if len(p2) else '')] = PiglitGLTest(' '.join(['arb_color_buffer_float-' + name, format, p1, p2]), run_concurrent=True)
>
> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
> index b2da115..5a347ae 100644
> --- a/tests/spec/CMakeLists.txt
> +++ b/tests/spec/CMakeLists.txt
> @@ -3,6 +3,7 @@ add_subdirectory (arb_base_instance)
>  add_subdirectory (arb_buffer_storage)
>  add_subdirectory (arb_clear_buffer_object)
>  add_subdirectory (arb_clear_texture)
> +add_subdirectory (arb_clip_control)
>  add_subdirectory (arb_color_buffer_float)
>  add_subdirectory (arb_copy_image)
>  add_subdirectory (arb_compute_shader)
> diff --git a/tests/spec/arb_clip_control/CMakeLists.gl.txt b/tests/spec/arb_clip_control/CMakeLists.gl.txt
> new file mode 100644
> index 0000000..3951bfb
> --- /dev/null
> +++ b/tests/spec/arb_clip_control/CMakeLists.gl.txt
> @@ -0,0 +1,15 @@
> +include_directories(
> +       ${GLEXT_INCLUDE_DIR}
> +       ${OPENGL_INCLUDE_PATH}
> +)
> +
> +link_libraries (
> +       piglitutil_${piglit_target_api}
> +       ${OPENGL_gl_LIBRARY}
> +       ${OPENGL_glu_LIBRARY}
> +)
> +
> +piglit_add_executable (clip-control clip-control.c)
> +piglit_add_executable (clip-control-depth-precision clip-control-depth-precision.c)
> +
> +# vim: ft=cmake:
> diff --git a/tests/spec/arb_clip_control/CMakeLists.txt b/tests/spec/arb_clip_control/CMakeLists.txt
> new file mode 100644
> index 0000000..144a306
> --- /dev/null
> +++ b/tests/spec/arb_clip_control/CMakeLists.txt
> @@ -0,0 +1 @@
> +piglit_include_target_api()
> diff --git a/tests/spec/arb_clip_control/clip-control-depth-precision.c b/tests/spec/arb_clip_control/clip-control-depth-precision.c
> new file mode 100644
> index 0000000..87d928e
> --- /dev/null
> +++ b/tests/spec/arb_clip_control/clip-control-depth-precision.c
> @@ -0,0 +1,174 @@
> +/*
> + * Copyright Mathias Fröhlich <Mathias.Froehlich at web.de>
> + *
> + * 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.
> + *
> + * Authors:
> + *    Mathias Fröhlich <Mathias.Froehlich at web.de>
> + */
> +
> +/** @file clip-control-depth-precision.c
> + *
> + * Test for ARB_clip_control.
> + * This is actually the application level use case making use of the
> + * close to logarithmic depth buffer precision available with the
> + * GL_ZERO_TO_ONE depth mode that is newly provided with this extension.
> + * The ARB_clip_control spec gives a set of web references explaining the
> + * background greatly.
> + * In short we set up a projection matrix that maps infinite far away
> + * points to 0 and the near plane to 1. We use a float depth buffer
> + * with a well known accuracy behavior. That together gives a depth
> + * buffer resolution that is about the relative floating point accuracy
> + * relative to the distance from the eye point.
> + * This extension avoids adding a constant number even in an intermediate
> + * step which would destroy the effective depth precision possible with
> + * the floating point depth buffers.
> + * Roughtly in numbers:
> + * Two fragments at 5000001 and 5000000 \about 5000001*(1 - eps) distance
> + * from the eye point should yield to different values in the depth buffer.
> + * The same goes for about any fragment distance x that you should be able
> + * to distinguish this from x*(1 - eps).
> + * And this is exactly what this test checks. We draw two surfaces
> + * a big red one at a distance x and a half that big green one at a distance
> + * x*(1 - 10*eps) to have a security factor of 10 to allow for some roundoff
> + * errors to accumulate. Due to the depth precision we must not get z fighting
> + * between these two and see a nested green solid square inside a bigger red
> + * square really behind it.
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +       config.supports_gl_compat_version = 20;
> +
> +       config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +       GLdouble projection[16] = { 0.0, };
> +
> +       piglit_require_extension("GL_ARB_clip_control");
> +       piglit_require_extension("GL_ARB_depth_buffer_float");
> +       piglit_require_extension("GL_EXT_framebuffer_object");
> +       piglit_require_extension("GL_EXT_framebuffer_blit");
> +
> +       /* Set up a projection matrix mapping z = -1 to z = 1
> +        * and z = -inf to z = 0 in projection space.
> +        * Given the clip control setting below, this is just
> +        * written as is into the float depth buffer.
> +        */
> +       projection[0 + 4*0] = 1;
> +       projection[1 + 4*1] = (GLdouble)piglit_width/piglit_height;
> +       projection[2 + 4*3] = 1;
> +       projection[3 + 4*2] = -1;
> +
> +       glMatrixMode(GL_PROJECTION);
> +       glLoadMatrixd(projection);
> +
> +       glMatrixMode(GL_MODELVIEW);
> +       glLoadIdentity();
> +}
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +       GLfloat red[3] = { 1, 0, 0 };
> +       GLfloat green[3] = { 0, 1, 0 };
> +       GLboolean pass = GL_TRUE;
> +       GLuint fb, cb, db;
> +       GLenum status;
> +       int range10;
> +
> +       glGenRenderbuffers(1, &cb);
> +       glBindRenderbuffer(GL_RENDERBUFFER, cb);
> +       glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA, piglit_width, piglit_height);
> +       glBindRenderbuffer(GL_RENDERBUFFER, 0);
> +
> +       glGenRenderbuffers(1, &db);
> +       glBindRenderbuffer(GL_RENDERBUFFER, db);
> +       glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT32F, piglit_width, piglit_height);
> +       glBindRenderbuffer(GL_RENDERBUFFER, 0);
> +
> +       glGenFramebuffers(1, &fb);
> +       glBindFramebuffer(GL_FRAMEBUFFER, fb);
> +       glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, cb);
> +       glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, db);
> +
> +       status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
> +       if (status != GL_FRAMEBUFFER_COMPLETE) {
> +               printf("FBO incomplete status 0x%X\n", status);
> +               piglit_report_result(PIGLIT_FAIL);
> +       }
> +
> +       glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
> +       glClearDepth(0);
> +       glDepthRange(0, 1);
> +       glClearColor(0, 0, 0, 1);
> +       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
> +       glEnable(GL_DEPTH_TEST);
> +       glDepthFunc(GL_GREATER);
> +
> +       for (range10 = 0; range10 < 16; ++range10) {
> +               int width = piglit_width/4;
> +               int height = piglit_height/4;
> +               int tilex = range10 % 4;
> +               int tiley = range10 / 4;
> +               int x = tilex*width;
> +               int y = tiley*height;
> +               double z = pow(10, 1 + range10);
> +
> +               /* Set up a new viewport for each depth we want to test */
> +               glViewport(x, y, width, height);
> +
> +               /* Draw a red surface at given distance z */
> +               glColor3fv(red);
> +               piglit_draw_rect_z(-z, -0.5*z, -0.5*z, z, z);
> +
> +               pass = piglit_probe_pixel_rgb(x + width/2, y + height/2, red) && pass;
> +
> +               /* And a green one just close in front of that red one */
> +               glColor3fv(green);
> +               piglit_draw_rect_z((10*FLT_EPSILON - 1)*z, -0.25*z, -0.25*z, 0.5*z, 0.5*z);
> +
> +               pass = piglit_probe_pixel_rgb(x + width/2, y + height/2, green) && pass;
> +       }
> +
> +
> +       /* set viewport to window size */
> +       glViewport(0, 0, piglit_width, piglit_height);
> +
> +       /* copy the result to the back buffer */
> +       glBindFramebuffer(GL_READ_FRAMEBUFFER, fb);
> +       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
> +       glBlitFramebuffer(0, 0, piglit_width, piglit_height, 0, 0, piglit_width, piglit_height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
> +       glBindFramebuffer(GL_FRAMEBUFFER, 0);
> +
> +       glDeleteFramebuffers(1, &fb);
> +       glDeleteRenderbuffers(1, &cb);
> +       glDeleteRenderbuffers(1, &db);
> +
> +       piglit_present_results();
> +
> +       return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> diff --git a/tests/spec/arb_clip_control/clip-control.c b/tests/spec/arb_clip_control/clip-control.c
> new file mode 100644
> index 0000000..df468fb
> --- /dev/null
> +++ b/tests/spec/arb_clip_control/clip-control.c
> @@ -0,0 +1,285 @@
> +/*
> + * Copyright Mathias Fröhlich <Mathias.Froehlich at web.de>
> + *
> + * 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.
> + *
> + * Authors:
> + *    Mathias Fröhlich <Mathias.Froehlich at web.de>
> + */
> +
> +/** @file clip-control.c
> + *
> + * Basic test for ARB_clip_contol.
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +       config.supports_gl_compat_version = 20;
> +
> +       config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +       piglit_require_extension("GL_ARB_clip_control");
> +
> +       piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
> +}
> +
> +GLboolean
> +test_clip_control(GLenum origin, GLenum mode)
> +{
> +       GLboolean pass;
> +       GLint value;
> +
> +       pass = piglit_check_gl_error(GL_NO_ERROR);
> +
> +       glGetIntegerv(GL_CLIP_ORIGIN, &value);
> +       if (value != origin) {
> +               fprintf(stderr, "glClipControl origin unexpected!\n");
> +               pass = GL_FALSE;
> +       }
> +       glGetIntegerv(GL_CLIP_DEPTH_MODE, &value);
> +       if (value != mode) {
> +               fprintf(stderr, "glClipControl mode unexpected!\n");
> +               pass = GL_FALSE;
> +       }
> +
> +       return pass;
> +}
> +
> +GLboolean
> +state_test(void)
> +{
> +       GLboolean pass = GL_TRUE;
> +
> +       /* The initial values */
> +       pass = test_clip_control(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE) && pass;
> +
> +       glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
> +       pass = test_clip_control(GL_LOWER_LEFT, GL_ZERO_TO_ONE) && pass;
> +
> +       glClipControl(GL_UPPER_LEFT, GL_ZERO_TO_ONE);
> +       pass = test_clip_control(GL_UPPER_LEFT, GL_ZERO_TO_ONE) && pass;
> +
> +       glClipControl(GL_UPPER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
> +       pass = test_clip_control(GL_UPPER_LEFT, GL_NEGATIVE_ONE_TO_ONE) && pass;
> +
> +       /* Check bailing out on invalid input */
> +       glClipControl(GL_RGB, GL_NEGATIVE_ONE_TO_ONE);
> +       pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
> +       piglit_reset_gl_error();
> +       pass = test_clip_control(GL_UPPER_LEFT, GL_NEGATIVE_ONE_TO_ONE) && pass;
> +
> +       glClipControl(GL_LOWER_LEFT, GL_RGB);
> +       pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
> +       piglit_reset_gl_error();
> +       pass = test_clip_control(GL_UPPER_LEFT, GL_NEGATIVE_ONE_TO_ONE) && pass;
> +
> +
> +       /* Check push/pop */
> +       glClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
> +       pass = test_clip_control(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE) && pass;
> +
> +       glPushAttrib(GL_TRANSFORM_BIT);
> +
> +       glClipControl(GL_UPPER_LEFT, GL_ZERO_TO_ONE);
> +       pass = test_clip_control(GL_UPPER_LEFT, GL_ZERO_TO_ONE) && pass;
> +
> +       /* Back to default */
> +       glPopAttrib();
> +       pass = test_clip_control(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE) && pass;
> +
> +       return pass;
> +}
> +
> +GLboolean
> +test_patch(GLenum origin, GLenum depth,
> +          GLclampd near, GLclampd far,
> +          float x, float y, float z)
> +{
> +       GLboolean pass = GL_TRUE;
> +       float draw_y;
> +       float depth_z;
> +
> +       /* Draw the patch */
> +
> +       if (origin == GL_LOWER_LEFT)
> +               draw_y = y;
> +       else
> +               draw_y = piglit_height - y;
> +
> +       piglit_draw_rect_z(z, x - 2, draw_y - 2, 4, 4);
> +
> +
> +       /* Check the depth and clip behavior */
> +
> +       /* The usual orthographic projection flips the z sign */
> +       if (depth == GL_NEGATIVE_ONE_TO_ONE)
> +               depth_z = -z*0.5*(far - near) + 0.5*(near + far);
> +       else
> +               depth_z = -z*(far - near) + near;
> +
> +       if ((depth_z < near && depth_z < far)
> +           || (near < depth_z && far < depth_z))
> +               /* still the clear value */
> +               pass = piglit_probe_pixel_depth(x, y, 1.0) && pass;
> +       else
> +               /* the written depth value */
> +               pass = piglit_probe_pixel_depth(x, y, depth_z) && pass;
> +
> +       return pass;
> +}
> +
> +GLboolean
> +test_patches(GLenum origin, GLenum depth,
> +            GLclampd near, GLclampd far,
> +            float x)
> +{
> +       GLboolean pass = GL_TRUE;
> +
> +       /* Back to default */
> +       glClipControl(origin, depth);
> +       glDepthRange(near, far);
> +
> +       if (depth == GL_NEGATIVE_ONE_TO_ONE) {
> +               /* outside the clip space */
> +               pass = test_patch(origin, depth, near, far,
> +                                 x, 10, 1.5) && pass;
> +               /* inside the clip space */
> +               pass = test_patch(origin, depth, near, far,
> +                                 x, 20, 1.0) && pass;
> +               pass = test_patch(origin, depth, near, far,
> +                                 x, 30, 0.5) && pass;
> +               pass = test_patch(origin, depth, near, far,
> +                                 x, 40, 0.0) && pass;
> +               pass = test_patch(origin, depth, near, far,
> +                                 x, 50, -0.5) && pass;
> +               pass = test_patch(origin, depth, near, far,
> +                                 x, 60, -1.0) && pass;
> +               /* outside the clip space */
> +               pass = test_patch(origin, depth, near, far,
> +                                 x, 70, -1.5) && pass;
> +       } else {
> +               /* outside the clip space */
> +               pass = test_patch(origin, depth, near, far,
> +                                 x, 10, 0.25) && pass;
> +               /* inside the clip space */
> +               pass = test_patch(origin, depth, near, far,
> +                                 x, 20, 0.0) && pass;
> +               pass = test_patch(origin, depth, near, far,
> +                                 x, 30, -0.25) && pass;
> +               pass = test_patch(origin, depth, near, far,
> +                                 x, 40, -0.5) && pass;
> +               pass = test_patch(origin, depth, near, far,
> +                                 x, 50, -0.75) && pass;
> +               pass = test_patch(origin, depth, near, far,
> +                                 x, 60, -1.0) && pass;
> +               /* outside the clip space */
> +               pass = test_patch(origin, depth, near, far,
> +                                 x, 70, -1.25) && pass;
> +       }
> +
> +       return pass;
> +}
> +
> +GLboolean
> +draw_test(void)
> +{
> +       GLboolean pass = GL_TRUE;
> +       GLenum origin, depth;
> +       GLclampd near = 0, far = 1;
> +
> +       /* Now prepare the draw buffer */
> +       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
> +       glEnable(GL_DEPTH_TEST);
> +       glDepthFunc(GL_ALWAYS);
> +
> +       /* Also test the winding order logic */
> +       glEnable(GL_CULL_FACE);
> +       glCullFace(GL_BACK);
> +
> +       /* The clear value - to be sure */
> +       pass = piglit_probe_pixel_depth(5, 5, 1.0) && pass;
> +
> +
> +       /* Defaut depth rage all clip control combinations */
> +       pass = test_patches(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE,
> +                           near, far, 10) && pass;
> +       pass = test_patches(GL_LOWER_LEFT, GL_ZERO_TO_ONE,
> +                           near, far, 20) && pass;
> +       pass = test_patches(GL_UPPER_LEFT, GL_NEGATIVE_ONE_TO_ONE,
> +                           near, far, 30) && pass;
> +       pass = test_patches(GL_UPPER_LEFT, GL_ZERO_TO_ONE,
> +                           near, far, 40) && pass;
> +
> +
> +       /* Narrow depth rage all clip control combinations */
> +       near = 0.25;
> +       far = 0.75;
> +       pass = test_patches(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE,
> +                           near, far, 50) && pass;
> +       pass = test_patches(GL_LOWER_LEFT, GL_ZERO_TO_ONE,
> +                           near, far, 60) && pass;
> +       pass = test_patches(GL_UPPER_LEFT, GL_NEGATIVE_ONE_TO_ONE,
> +                           near, far, 70) && pass;
> +       pass = test_patches(GL_UPPER_LEFT, GL_ZERO_TO_ONE,
> +                           near, far, 80) && pass;
> +
> +
> +       /* Reverse narrow depth rage all clip control combinations */
> +       near = 0.75;
> +       far = 0.25;
> +       pass = test_patches(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE,
> +                           near, far, 90) && pass;
> +       pass = test_patches(GL_LOWER_LEFT, GL_ZERO_TO_ONE,
> +                           near, far, 100) && pass;
> +       pass = test_patches(GL_UPPER_LEFT, GL_NEGATIVE_ONE_TO_ONE,
> +                           near, far, 110) && pass;
> +       pass = test_patches(GL_UPPER_LEFT, GL_ZERO_TO_ONE,
> +                           near, far, 120) && pass;
> +
> +
> +       /* Back to default */
> +       glClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
> +       glDepthRange(0.0, 1.0);
> +
> +       piglit_present_results();
> +
> +       return pass;
> +}
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +       GLboolean pass;
> +
> +       /* Check for getting and setting the state. */
> +       pass = state_test();
> +
> +       /* Check for correct draws according to the state. */
> +       pass = draw_test() && pass;
> +
> +       return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> --
> 1.9.3
>


More information about the Piglit mailing list