[Piglit] [PATCH] arb_shader_clock: add sanity/touch test
Emil Velikov
emil.l.velikov at gmail.com
Mon Oct 19 09:50:02 PDT 2015
On 19 October 2015 at 16:43, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> 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.
>
Ack. That's why I left the note as is - the spec says "written against
GL 4.5" with no explicit requirements. I'm leaning that there ought to
be some, yet I cannot point any off-hand. Perhaps we can live with
this being core extension only :-)
>> + 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...
>
It does afaics. But I never got further than that (/me needs a new gpu :P)
>> + "}\n";
>> + int prog;
>> +
>> + piglit_gl_require_extension("GL_ARB_shader_clock");
>
> No such function. Did you try building/running this?
>
Ouch. Forgot that the patch is based on top of a massive 'prefix gl
specific functions with piglit_gl_foo" series which I never got to
finishing/sending.
The above should read "piglit_require_extension"
>> +
>> + 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...
>
Afaict with the former one does probing and requires deterministic
output. Which in our case isn't possible to achieve. Haven't looked at
the latter though - will do in a second.
Thanks
Emil
More information about the Piglit
mailing list