arb_shader_clock: add sanity/touch test

Submitted by Emil Velikov on Oct. 19, 2015, 2:44 p.m.

Details

Message ID 1445265846-18574-1-git-send-email-emil.l.velikov@gmail.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Emil Velikov Oct. 19, 2015, 2:44 p.m.
Signed-off-by: Emil Velikov <emil.velikov@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

Patch hide | download patch | download mbox

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;
+	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"
+		"}\n";
+	int prog;
+
+	piglit_gl_require_extension("GL_ARB_shader_clock");
+
+	prog = piglit_build_simple_program(NULL, fs);
+	glUseProgram(prog);
+	glDeleteProgram(prog);
+
+	// XXX: spin up some textures, draw something ?
+
+	piglit_report_result(PIGLIT_PASS);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+	return PIGLIT_FAIL;
+}

Comments

On Mon, Oct 19, 2015 at 10:44 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
> Signed-off-by: Emil Velikov <emil.velikov@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@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
On 19 October 2015 at 16:43, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
> On Mon, Oct 19, 2015 at 10:44 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
>> Signed-off-by: Emil Velikov <emil.velikov@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
On Mon, Oct 19, 2015 at 12:50 PM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
> On 19 October 2015 at 16:43, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
>> On Mon, Oct 19, 2015 at 10:44 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
>>> Signed-off-by: Emil Velikov <emil.velikov@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 :-)

OK, but this isn't a reflection of what the min GL version the ext
could exist on... this is a reflection of the min GL version that this
specific test requires. In this case, it's 3.0 since you're using a
#version 130 shader.

But all you're testing here is linking, which can easily be done with
a shader test (search for 'link success'). If you have no expectations
of what might be returned by this clock, that's fine, you can still
draw, just don't probe the results.

  -ilia
On 19 October 2015 at 18:09, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
> On Mon, Oct 19, 2015 at 12:50 PM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
>> On 19 October 2015 at 16:43, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
>>> On Mon, Oct 19, 2015 at 10:44 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
>>>> Signed-off-by: Emil Velikov <emil.velikov@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 :-)
>
> OK, but this isn't a reflection of what the min GL version the ext
> could exist on... this is a reflection of the min GL version that this
> specific test requires. In this case, it's 3.0 since you're using a
> #version 130 shader.
>
What I meant was "despite being out of sync both versions came out of
thin air". But sure I'll make sure they match.

> But all you're testing here is linking, which can easily be done with
> a shader test (search for 'link success'). If you have no expectations
> of what might be returned by this clock, that's fine, you can still
> draw, just don't probe the results.
>
Nice. Did not know about the "link success" case. Although if I can
omit the probing I'd go for link and draw something :-)

Thanks
Emil