[Piglit] [PATCH] arb_shader_clock: add sanity/touch test

Ilia Mirkin imirkin at alum.mit.edu
Mon Oct 19 08:43:01 PDT 2015


On Mon, Oct 19, 2015 at 10:44 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
>  tests/all.py                                  |  5 ++
>  tests/spec/CMakeLists.txt                     |  1 +
>  tests/spec/arb_shader_clock/CMakeLists.gl.txt | 11 +++++
>  tests/spec/arb_shader_clock/CMakeLists.txt    |  1 +
>  tests/spec/arb_shader_clock/sanity.c          | 70 +++++++++++++++++++++++++++
>  5 files changed, 88 insertions(+)
>  create mode 100644 tests/spec/arb_shader_clock/CMakeLists.gl.txt
>  create mode 100644 tests/spec/arb_shader_clock/CMakeLists.txt
>  create mode 100644 tests/spec/arb_shader_clock/sanity.c
>
> diff --git a/tests/all.py b/tests/all.py
> index 5bfb5f0..049b948 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -4353,6 +4353,11 @@ with profile.group_manager(
>
>  with profile.group_manager(
>          PiglitGLTest,
> +        grouptools.join('spec', 'arb_shader_clock')) as g:
> +    g(['arb_shader_clock-sanity'], 'sanity')
> +
> +with profile.group_manager(
> +        PiglitGLTest,
>          grouptools.join('spec', 'arb_direct_state_access')) as g:
>      g(['arb_direct_state_access-create-transformfeedbacks'],
>        'create-transformfeedbacks')
> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
> index 4ebdce0..17a836d 100644
> --- a/tests/spec/CMakeLists.txt
> +++ b/tests/spec/CMakeLists.txt
> @@ -45,6 +45,7 @@ add_subdirectory (arb_separate_shader_objects)
>  add_subdirectory (arb_shader_subroutine)
>  add_subdirectory (arb_shader_texture_lod/execution)
>  add_subdirectory (arb_shader_atomic_counters)
> +add_subdirectory (arb_shader_clock)
>  add_subdirectory (arb_shader_objects)
>  add_subdirectory (arb_shader_image_load_store)
>  add_subdirectory (arb_shader_image_size)
> diff --git a/tests/spec/arb_shader_clock/CMakeLists.gl.txt b/tests/spec/arb_shader_clock/CMakeLists.gl.txt
> new file mode 100644
> index 0000000..c0cf928
> --- /dev/null
> +++ b/tests/spec/arb_shader_clock/CMakeLists.gl.txt
> @@ -0,0 +1,11 @@
> +include_directories(
> +       ${GLEXT_INCLUDE_DIR}
> +       ${OPENGL_INCLUDE_PATH}
> +)
> +
> +link_libraries (
> +       piglitutil_${piglit_target_api}
> +       ${OPENGL_gl_LIBRARY}
> +)
> +
> +piglit_add_executable (arb_shader_clock-sanity sanity.c)
> diff --git a/tests/spec/arb_shader_clock/CMakeLists.txt b/tests/spec/arb_shader_clock/CMakeLists.txt
> new file mode 100644
> index 0000000..144a306
> --- /dev/null
> +++ b/tests/spec/arb_shader_clock/CMakeLists.txt
> @@ -0,0 +1 @@
> +piglit_include_target_api()
> diff --git a/tests/spec/arb_shader_clock/sanity.c b/tests/spec/arb_shader_clock/sanity.c
> new file mode 100644
> index 0000000..46a3997
> --- /dev/null
> +++ b/tests/spec/arb_shader_clock/sanity.c
> @@ -0,0 +1,70 @@
> +/*
> + * Copyright (C) 2015 Intel Corporation
> + *
> + * 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.
> + */
> +
> +/** @file shader-clock.c
> + *
> + * Dummy/touch test for the clock2x32ARB() GLSL built-in.
> + *
> + * A very rudimentary piglit, as we cannot realistically test this - the
> + * units are undefined (platform specific) and the monotonic counter can
> + * wrap. The secondary goal of the extension (to act as code motion barrier)
> + * cannot be achieved with the current NIR infrastructure :'(
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +// XXX: confirm GL profile, version and visuals
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +       config.supports_gl_compat_version = 21;

You're requesting #version 130 below, so this should be version=30.

> +       config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +       static const char * const fs =
> +               "#version 130\n"
> +               "#extension GL_ARB_shader_clock : enable\n"
> +               "void main()\n"
> +               "{\n"
> +               "    gl_FragColor = uvec4(clock2x32ARB(), 0, 0);\n"

Does this compile? Didn't think there was an implicit conversion
available from uint to float...

> +               "}\n";
> +       int prog;
> +
> +       piglit_gl_require_extension("GL_ARB_shader_clock");

No such function. Did you try building/running this?

> +
> +       prog = piglit_build_simple_program(NULL, fs);
> +       glUseProgram(prog);
> +       glDeleteProgram(prog);
> +
> +       // XXX: spin up some textures, draw something ?

If all you're looking to do is test compilation and very basic runtime
stuff, you can add a compiler or linker test, via shader_runner or
glslparsertest...

> +
> +       piglit_report_result(PIGLIT_PASS);
> +}
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +       return PIGLIT_FAIL;
> +}
> --
> 2.6.1
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list