[Piglit] [PATCH] ext_depth_bounds_test: new test for the extension

Ilia Mirkin imirkin at alum.mit.edu
Thu Aug 13 13:30:17 PDT 2015


On Thu, Aug 13, 2015 at 4:27 PM, Marek Olšák <maraeo at gmail.com> wrote:
> On Thu, Aug 13, 2015 at 10:17 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> On Thu, Aug 13, 2015 at 4:11 PM, Marek Olšák <maraeo at gmail.com> wrote:
>>> From: Marek Olšák <marek.olsak at amd.com>
>>>
>>> ---
>>>  tests/spec/CMakeLists.txt                          |   1 +
>>>  tests/spec/ext_depth_bounds_test/CMakeLists.gl.txt |  14 ++
>>>  tests/spec/ext_depth_bounds_test/CMakeLists.txt    |   1 +
>>>  tests/spec/ext_depth_bounds_test/depth_bounds.c    | 160 +++++++++++++++++++++
>>>  4 files changed, 176 insertions(+)
>>>  create mode 100644 tests/spec/ext_depth_bounds_test/CMakeLists.gl.txt
>>>  create mode 100644 tests/spec/ext_depth_bounds_test/CMakeLists.txt
>>>  create mode 100644 tests/spec/ext_depth_bounds_test/depth_bounds.c
>>>
>>> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
>>> index 0ed7aa3..eeb883d 100644
>>> --- a/tests/spec/CMakeLists.txt
>>> +++ b/tests/spec/CMakeLists.txt
>>> @@ -69,6 +69,7 @@ add_subdirectory (arb_transform_feedback2)
>>>  add_subdirectory (arb_transform_feedback3)
>>>  add_subdirectory (arb_viewport_array)
>>>  add_subdirectory (ati_envmap_bumpmap)
>>> +add_subdirectory (ext_depth_bounds_test)
>>>  add_subdirectory (ext_fog_coord)
>>>  add_subdirectory (ext_framebuffer_multisample)
>>>  add_subdirectory (ext_framebuffer_multisample_blit_scaled)
>>> diff --git a/tests/spec/ext_depth_bounds_test/CMakeLists.gl.txt b/tests/spec/ext_depth_bounds_test/CMakeLists.gl.txt
>>> new file mode 100644
>>> index 0000000..7879390
>>> --- /dev/null
>>> +++ b/tests/spec/ext_depth_bounds_test/CMakeLists.gl.txt
>>> @@ -0,0 +1,14 @@
>>> +include_directories(
>>> +       ${GLEXT_INCLUDE_DIR}
>>> +       ${OPENGL_INCLUDE_PATH}
>>> +)
>>> +
>>> +link_libraries (
>>> +       piglitutil_${piglit_target_api}
>>> +       ${OPENGL_gl_LIBRARY}
>>> +       ${OPENGL_glu_LIBRARY}
>>> +)
>>> +
>>> +piglit_add_executable (depth_bounds depth_bounds.c)
>>> +
>>> +# vim: ft=cmake:
>>> diff --git a/tests/spec/ext_depth_bounds_test/CMakeLists.txt b/tests/spec/ext_depth_bounds_test/CMakeLists.txt
>>> new file mode 100644
>>> index 0000000..4a012b9
>>> --- /dev/null
>>> +++ b/tests/spec/ext_depth_bounds_test/CMakeLists.txt
>>> @@ -0,0 +1 @@
>>> +piglit_include_target_api()
>>> \ No newline at end of file
>>> diff --git a/tests/spec/ext_depth_bounds_test/depth_bounds.c b/tests/spec/ext_depth_bounds_test/depth_bounds.c
>>> new file mode 100644
>>> index 0000000..d45cd49
>>> --- /dev/null
>>> +++ b/tests/spec/ext_depth_bounds_test/depth_bounds.c
>>> @@ -0,0 +1,160 @@
>>> +/*
>>> + * Copyright © 2015 Advanced Micro Devices, Inc.
>>> + *
>>> + * 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:
>>> + *    Marek Olšák <maraeo at gmail.com>
>>> + */
>>> +
>>> +#include "piglit-util-gl.h"
>>> +#include <time.h>
>>> +
>>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>>> +
>>> +       config.supports_gl_compat_version = 10;
>>> +       config.window_width = 200;
>>> +       config.window_height = 200;
>>> +       config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE |
>>> +                              PIGLIT_GL_VISUAL_DEPTH;
>>> +
>>> +PIGLIT_GL_TEST_CONFIG_END
>>> +
>>> +static bool inplace;
>>> +static const float size = 20;
>>> +static float white_color[3] = {1, 1, 1};
>>> +static float clear_color[3] = {0.1, 0.1, 0.1};
>>> +
>>> +void
>>> +piglit_init(int argc, char **argv)
>>> +{
>>> +       inplace = argc == 2 && strcmp(argv[1], "-inplace") == 0;
>>> +
>>> +       piglit_require_extension("GL_EXT_depth_bounds_test");
>>> +       piglit_gen_ortho_projection(0, piglit_width, 0, piglit_height, 0, -1, 0);
>>> +       srand(time(NULL));
>>
>> I *hate* random failures :( How would you feel about picking a
>> constant here? Or not using rand() in the first place?
>
> How about 123456789?

Worksforme.

>
>>
>>> +       glDepthFunc(GL_ALWAYS);
>>> +}
>>> +
>>> +enum {
>>> +       PASS,
>>> +       FAIL,
>>> +};
>>> +
>>> +static struct {
>>> +       unsigned expected;
>>> +       float z0, z1, z2, z3;
>>
>> These are always the same value... why separate them out?
>
> I wanted to use them for quads that aren't parallel with the screen,
> but I ran out of time while fixing this test.

OK. Nothing wrong with keeping them around I guess.

With the above time(NULL) removed, this is

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


More information about the Piglit mailing list