Re: [Piglit] [PATCH 0/2] shader_runner: Add ARB_program_interface_query support

2015-09-16 Thread Tapani Pälli


On 09/16/2015 11:31 AM, Samuel Iglesias Gonsalvez wrote:

Hello,

Following my idea described here [0], I modified shader_runner to accept
other program interfaces.

The format of the command is:

  active program_interface GL_INTERFACE_TYPE_ENUM var_name GL_PROPS_ENUM integer

or, if we include the GL type enum:

  active program_interface GL_INTERFACE_TYPE_ENUM var_name GL_PROPS_ENUM 
GL_TYPE_ENUM

Some examples:

active program_interface GL_UNIFORM i1 GL_MATRIX_STRIDE 0
active program_interface GL_UNIFORM i1 GL_IS_ROW_MAJOR 0
active program_interface GL_PROGRAM_OUTPUT piglit_fragcolor GL_TYPE 
GL_FLOAT_VEC4
active program_interface GL_PROGRAM_INPUT piglit_vertex GL_TYPE GL_FLOAT_VEC4


From user/reader perspective it is not obvious what 'active 
program_interface' does. I think it should have something like 
'validate' or 'query' in it so that reader knows what is going on. These 
sounds more like setters now than queries? Also, why 'active', you can't 
query inactive ones?


Otherwise, I think it is fine addition if it helps in writing more tests.



What do you think?

Thanks,

Sam

[0] http://lists.freedesktop.org/archives/piglit/2015-September/017080.html

Samuel Iglesias Gonsalvez (2):
   shader_runner: make active_uniforms's all_types variable be global
   shader_runner: Add ARB_program_interface_query support

  tests/shaders/shader_runner.c | 322 --
  1 file changed, 244 insertions(+), 78 deletions(-)




// Tapani
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] tbo: add buffer storage test

2015-09-16 Thread Ilia Mirkin
On Wed, Sep 16, 2015 at 9:38 PM, Ilia Mirkin  wrote:
> Have to use a VBO since piglit_draw_rect causes too much state to get
> flushed.
>
> Signed-off-by: Ilia Mirkin 
> ---
>  tests/all.py   |   1 +
>  .../arb_texture_buffer_object/CMakeLists.gl.txt|   1 +
>  .../spec/arb_texture_buffer_object/bufferstorage.c | 149 
> +
>  3 files changed, 151 insertions(+)
>  create mode 100644 tests/spec/arb_texture_buffer_object/bufferstorage.c
>
> diff --git a/tests/all.py b/tests/all.py
> index 761ec5c..fc7cb13 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -2361,6 +2361,7 @@ with profile.group_manager(
>  with profile.group_manager(
>  PiglitGLTest,
>  grouptools.join('spec', 'ARB_texture_buffer_object')) as g:
> +g(['arb_texture_buffer_object-bufferstorage'], 'bufferstorage')
>  g(['arb_texture_buffer_object-data-sync'], 'data-sync')
>  g(['arb_texture_buffer_object-dlist'], 'dlist')
>  g(['arb_texture_buffer_object-formats', 'fs', 'core'],
> diff --git a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt 
> b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
> index 2971582..fb221fc 100644
> --- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
> +++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
> @@ -10,6 +10,7 @@ link_libraries (
> ${OPENGL_glu_LIBRARY}
>  )
>
> +piglit_add_executable (arb_texture_buffer_object-bufferstorage 
> bufferstorage.c)
>  piglit_add_executable (arb_texture_buffer_object-data-sync data-sync.c)
>  piglit_add_executable (arb_texture_buffer_object-dlist dlist.c)
>  piglit_add_executable (arb_texture_buffer_object-formats formats.c)
> diff --git a/tests/spec/arb_texture_buffer_object/bufferstorage.c 
> b/tests/spec/arb_texture_buffer_object/bufferstorage.c
> new file mode 100644
> index 000..8c526bf
> --- /dev/null
> +++ b/tests/spec/arb_texture_buffer_object/bufferstorage.c
> @@ -0,0 +1,149 @@
> +/* Copyright © 2015 Ilia Mirkin
> + *
> + * 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 bufferstorage.c
> + *
> + * Tests that we can modify texture buffers using coherently mapped buffers.
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +static const float green[4] = {0, 1, 0, 0};
> +static const float red[4] = {1, 0, 0, 0};
> +static float *map;
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +   GLsync fence;
> +   bool pass = true;
> +
> +   glViewport(0, 0, piglit_width, piglit_height);
> +   glClearColor(0.2, 0.2, 0.2, 0.2);
> +   glClear(GL_COLOR_BUFFER_BIT);
> +
> +   /* Wait for any previous rendering to finish before updating
> +* the texture buffers
> +*/
> +   fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
> +   glClientWaitSync(fence, GL_SYNC_FLUSH_COMMANDS_BIT,
> +GL_TIMEOUT_IGNORED);

Actually this first fence is unnecessary -- any previous rendering
would have been completed by virtue of the probe at the end of the
display function. The second one is necessary though.

> +
> +   memcpy(map, red, sizeof(red));
> +   glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
> +
> +   fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
> +   glClientWaitSync(fence, GL_SYNC_FLUSH_COMMANDS_BIT,
> +GL_TIMEOUT_IGNORED);
> +
> +   memcpy(map, green, sizeof(green));
> +   glDrawArrays(GL_TRIANGLE_FAN, 4, 4);
> +
> +   pass = piglit_probe_rect_rgba(
> +   0, 0, piglit_width / 2, piglit_height, red) && pass;
> +   pass = piglit_probe_rect_rgba(piglit_width / 2, 0,
> + piglit_width / 2, piglit_height,
> + green) && pass;
> +
> +   piglit_present_results();
> +
> +   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +vo

[Piglit] [PATCH] tbo: add buffer storage test

2015-09-16 Thread Ilia Mirkin
Have to use a VBO since piglit_draw_rect causes too much state to get
flushed.

Signed-off-by: Ilia Mirkin 
---
 tests/all.py   |   1 +
 .../arb_texture_buffer_object/CMakeLists.gl.txt|   1 +
 .../spec/arb_texture_buffer_object/bufferstorage.c | 149 +
 3 files changed, 151 insertions(+)
 create mode 100644 tests/spec/arb_texture_buffer_object/bufferstorage.c

diff --git a/tests/all.py b/tests/all.py
index 761ec5c..fc7cb13 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2361,6 +2361,7 @@ with profile.group_manager(
 with profile.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'ARB_texture_buffer_object')) as g:
+g(['arb_texture_buffer_object-bufferstorage'], 'bufferstorage')
 g(['arb_texture_buffer_object-data-sync'], 'data-sync')
 g(['arb_texture_buffer_object-dlist'], 'dlist')
 g(['arb_texture_buffer_object-formats', 'fs', 'core'],
diff --git a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
index 2971582..fb221fc 100644
--- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
@@ -10,6 +10,7 @@ link_libraries (
${OPENGL_glu_LIBRARY}
 )
 
+piglit_add_executable (arb_texture_buffer_object-bufferstorage bufferstorage.c)
 piglit_add_executable (arb_texture_buffer_object-data-sync data-sync.c)
 piglit_add_executable (arb_texture_buffer_object-dlist dlist.c)
 piglit_add_executable (arb_texture_buffer_object-formats formats.c)
diff --git a/tests/spec/arb_texture_buffer_object/bufferstorage.c 
b/tests/spec/arb_texture_buffer_object/bufferstorage.c
new file mode 100644
index 000..8c526bf
--- /dev/null
+++ b/tests/spec/arb_texture_buffer_object/bufferstorage.c
@@ -0,0 +1,149 @@
+/* Copyright © 2015 Ilia Mirkin
+ *
+ * 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 bufferstorage.c
+ *
+ * Tests that we can modify texture buffers using coherently mapped buffers.
+ */
+
+#include "piglit-util-gl.h"
+
+static const float green[4] = {0, 1, 0, 0};
+static const float red[4] = {1, 0, 0, 0};
+static float *map;
+
+enum piglit_result
+piglit_display(void)
+{
+   GLsync fence;
+   bool pass = true;
+
+   glViewport(0, 0, piglit_width, piglit_height);
+   glClearColor(0.2, 0.2, 0.2, 0.2);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   /* Wait for any previous rendering to finish before updating
+* the texture buffers
+*/
+   fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+   glClientWaitSync(fence, GL_SYNC_FLUSH_COMMANDS_BIT,
+GL_TIMEOUT_IGNORED);
+
+   memcpy(map, red, sizeof(red));
+   glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+   fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+   glClientWaitSync(fence, GL_SYNC_FLUSH_COMMANDS_BIT,
+GL_TIMEOUT_IGNORED);
+
+   memcpy(map, green, sizeof(green));
+   glDrawArrays(GL_TRIANGLE_FAN, 4, 4);
+
+   pass = piglit_probe_rect_rgba(
+   0, 0, piglit_width / 2, piglit_height, red) && pass;
+   pass = piglit_probe_rect_rgba(piglit_width / 2, 0,
+ piglit_width / 2, piglit_height,
+ green) && pass;
+
+   piglit_present_results();
+
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   static const char *vs_source =
+   "#version 140\n"
+   "in vec4 piglit_vertex;\n"
+   "void main()\n"
+   "{\n"
+   "   gl_Position = piglit_vertex;\n"
+   "}\n";
+
+   static const char *fs_source =
+   "#version 140\n"
+   "uniform samplerBuffer s;\n"
+   "uniform int offset;\n"
+   "void main()\

[Piglit] [PATCH v5] Port arb occlusion query conformance tests from Glean to Piglit

2015-09-16 Thread Juliet Fru
This test replaces the original glean toccluqry.cpp test.
---
 tests/all.py   |   1 +
 tests/spec/arb_occlusion_query/CMakeLists.gl.txt   |   1 +
 .../arb_occlusion_query/occlusion_query_conform.c  | 613 +
 3 files changed, 615 insertions(+)
 create mode 100644 tests/spec/arb_occlusion_query/occlusion_query_conform.c

diff --git a/tests/all.py b/tests/all.py
index fe088f5..748165f 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2115,6 +2115,7 @@ with profile.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'ARB_occlusion_query')) as g:
 g(['occlusion_query'])
+g(['occlusion_query_conformance'])
 g(['occlusion_query_lifetime'])
 g(['occlusion_query_meta_fragments'])
 g(['occlusion_query_meta_no_fragments'])
diff --git a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt 
b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
index 01a499d..23a19e4 100644
--- a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
+++ b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
@@ -10,6 +10,7 @@ link_libraries (
 )
 
 piglit_add_executable (occlusion_query occlusion_query.c)
+piglit_add_executable (occlusion_query_conformance occlusion_query_conform.c)
 piglit_add_executable (occlusion_query_lifetime occlusion_query_lifetime.c)
 piglit_add_executable (occlusion_query_meta_no_fragments 
occlusion_query_meta_no_fragments.c)
 piglit_add_executable (occlusion_query_meta_fragments 
occlusion_query_meta_fragments.c)
diff --git a/tests/spec/arb_occlusion_query/occlusion_query_conform.c 
b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
new file mode 100644
index 000..aa98e7d
--- /dev/null
+++ b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
@@ -0,0 +1,613 @@
+/*  BEGIN_COPYRIGHT -*- glean -*-
+ *
+ *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ *  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.
+ *
+ * END_COPYRIGHT
+ */
+
+/** @file occlusion_query_conform.c
+ *
+ * Conformance test on ARB_occlusion_query extension.
+ *
+ * Authors:
+ * Wei Wang 
+ * Adapted to Piglit by Juliet Fru , September 2015
+ */
+
+#include "piglit-util-gl.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;
+
+
+config.window_width = 160;
+config.window_height = 160;
+config.window_visual =
+   PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE |
+   PIGLIT_GL_VISUAL_DEPTH;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static GLuint
+find_unused_id(void)
+{
+   GLuint id;
+   glGenQueries(1, &id);
+   return id;
+
+}
+
+/* If multiple queries are issued on the same target and id prior to calling
+ * GetQueryObject[u]iVARB, the result returned will always be from the last
+ * query issued.  The results from any queries before the last one will be lost
+ * if the results are not retrieved before starting a new query on the same
+ * target and id.
+ */
+static bool
+conformOQ_GetObjivAval_multi1(GLuint id)
+{
+   GLint ready;
+   GLuint passed = 0;
+
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   glMatrixMode(GL_PROJECTION);
+   glPushMatrix();
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 25.0);
+
+   glMatrixMode(GL_MODELVIEW);
+   glPushMatrix();
+   glLoadIdentity();
+   glTranslatef(0.0, 0.0, -10.0);
+
+   /* draw the occluder (red) */
+   glColorMask(1, 1, 1, 1);
+   glDepthMask(GL_TRUE);
+   glColor3f(1, 0, 0);
+   piglit_draw_rect(-0.5, 0.5, 0.5, -0.5);
+
+   glPushMatrix();
+   glTranslatef(0.0, 0.0, -5.0);
+   glColorMask(0, 0, 0, 0);
+   glDepthMask(GL_FALSE);
+
+   /* draw the 1st box (gren) which is occluded by the occluder partly */
+   glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id);
+   glColor3f(

Re: [Piglit] [PATCH 2/2] cl: Change data types of char/short buffers in integer limits tests

2015-09-16 Thread Jan Vesely
On Wed, 2015-09-16 at 17:18 -0500, Aaron Watry wrote:
> On Tue, Sep 15, 2015 at 9:42 AM, Jan Vesely 
> wrote:
> 
> > 
> > 
> > On Tue, Sep 15, 2015 at 7:28 AM, Jan Vesely  > >
> > wrote:
> > 
> > > On Thu, 2015-09-10 at 10:12 -0500, Aaron Watry wrote:
> > > > The char/short return buffers were declared as ints.
> > > > 
> > > > Signed-off-by: Aaron Watry 
> > > 
> > > Reviewed-by: Jan Vesely 
> > > For both patches.
> > > 
> > > though, I agree with Serge that a spec reference would be nice.
> > > 
> > 
> > PS: don't we need to test this for *_MAX too? I'd expect at least
> > char and
> > short to have the same problem.
> > 
> 
> 
> Yes, it seems that the _MAX values are also broken because the values
> are
> upgraded to ints by llvm.

I checked the c99 specs, section 6.4.4.1 says that the type decimal
constants without suffix is the first of int, long int, long long int,
in which the value can be represented.
So I guess llvm is doing the right thing here.

Jan

> 
> 
> > 
> > > Jan
> > > 
> > > > ---
> > > >  tests/cl/program/execute/int-definitions.cl | 8 
> > > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/tests/cl/program/execute/int-definitions.cl
> > > > b/tests/cl/program/execute/int-definitions.cl
> > > > index 3d8ee63..a438fe4 100644
> > > > --- a/tests/cl/program/execute/int-definitions.cl
> > > > +++ b/tests/cl/program/execute/int-definitions.cl
> > > > @@ -12,12 +12,12 @@ global_size: 1 0 0
> > > >  [test]
> > > >  name: Char Definitions
> > > >  kernel_name: test_char
> > > > -arg_out: 0 buffer int[6] 8 127 -128 127 -128 255
> > > > +arg_out: 0 buffer char[6] 8 127 -128 127 -128 255
> > > > 
> > > >  [test]
> > > >  name: Short Definitions
> > > >  kernel_name: test_short
> > > > -arg_out: 0 buffer int[3] 32767 -32768 65535
> > > > +arg_out: 0 buffer short[3] 32767 -32768 65535
> > > > 
> > > >  [test]
> > > >  name: Int Definitions
> > > > @@ -32,7 +32,7 @@ arg_out: 0 buffer long[3] 9223372036854775807
> > > > \
> > > >18446744073709551615
> > > >  !*/
> > > > 
> > > > -kernel void test_char(global int* out) {
> > > > +kernel void test_char(global char* out) {
> > > >int i = 0;
> > > >out[i++] = CHAR_BIT;
> > > >out[i++] = CHAR_MAX;
> > > > @@ -42,7 +42,7 @@ kernel void test_char(global int* out) {
> > > >out[i++] = UCHAR_MAX;
> > > >  }
> > > > 
> > > > -kernel void test_short(global int* out) {
> > > > +kernel void test_short(global short* out) {
> > > >int i = 0;
> > > >out[i++] = SHRT_MAX;
> > > >out[i++] = (SHRT_MIN - (short2)(0)).s0;
> > > 
> > 
> > 


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v3] tbo: test a max-sized buffer

2015-09-16 Thread Ilia Mirkin
---

v2 -> v3: don't skip the test when >= 512M max elements, just go up
close to 2G.

 tests/all.py   |   1 +
 .../arb_texture_buffer_object/CMakeLists.gl.txt|   1 +
 tests/spec/arb_texture_buffer_object/max-size.c| 107 +
 3 files changed, 109 insertions(+)
 create mode 100644 tests/spec/arb_texture_buffer_object/max-size.c

diff --git a/tests/all.py b/tests/all.py
index 4fbe75b..761ec5c 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2372,6 +2372,7 @@ with profile.group_manager(
 g(['arb_texture_buffer_object-get'], 'get')
 g(['arb_texture_buffer_object-fetch-outside-bounds'],
   'fetch-outside-bounds')
+g(['arb_texture_buffer_object-max-size'], 'max-size')
 g(['arb_texture_buffer_object-minmax'], 'minmax')
 g(['arb_texture_buffer_object-negative-bad-bo'], 'negative-bad-bo')
 g(['arb_texture_buffer_object-negative-bad-format'], 'negative-bad-format')
diff --git a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt 
b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
index 5019e52..2971582 100644
--- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
@@ -14,6 +14,7 @@ piglit_add_executable (arb_texture_buffer_object-data-sync 
data-sync.c)
 piglit_add_executable (arb_texture_buffer_object-dlist dlist.c)
 piglit_add_executable (arb_texture_buffer_object-formats formats.c)
 piglit_add_executable (arb_texture_buffer_object-get get.c)
+piglit_add_executable (arb_texture_buffer_object-max-size max-size.c)
 piglit_add_executable (arb_texture_buffer_object-minmax minmax.c)
 piglit_add_executable (arb_texture_buffer_object-negative-bad-bo 
negative-bad-bo.c)
 piglit_add_executable (arb_texture_buffer_object-negative-bad-format 
negative-bad-format.c)
diff --git a/tests/spec/arb_texture_buffer_object/max-size.c 
b/tests/spec/arb_texture_buffer_object/max-size.c
new file mode 100644
index 000..6507b80
--- /dev/null
+++ b/tests/spec/arb_texture_buffer_object/max-size.c
@@ -0,0 +1,107 @@
+/* Copyright © 2015 Ilia Mirkin
+ *
+ * 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 max-size.c
+ *
+ * Tests that we can sample a maximally-sized texture buffer.
+ */
+
+#include "piglit-util-gl.h"
+
+enum piglit_result
+piglit_display(void)
+{
+   static const float green[4] = {0, 1, 0, 0};
+   bool pass;
+
+   glViewport(0, 0, piglit_width, piglit_height);
+   glClearColor(0.2, 0.2, 0.2, 0.2);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   piglit_draw_rect(-1, -1, 2, 2);
+
+   pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
+
+   piglit_present_results();
+
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   static const char *vs_source =
+   "#version 140\n"
+   "in vec4 piglit_vertex;\n"
+   "void main()\n"
+   "{\n"
+   "   gl_Position = piglit_vertex;\n"
+   "}\n";
+
+   static const char *fs_source =
+   "#version 140\n"
+   "uniform samplerBuffer s;\n"
+   "uniform int offset;\n"
+   "void main()\n"
+   "{\n"
+   "   gl_FragColor = texelFetch(s, offset);\n"
+   "}\n";
+
+   GLuint tex, tbo;
+   static const uint8_t data[4] = {0x00, 0xff, 0x00, 0x00};
+   GLuint prog;
+   GLint max;
+
+   prog = piglit_build_simple_program(vs_source, fs_source);
+   glUseProgram(prog);
+
+   glGenBuffers(1, &tbo);
+   glBindBuffer(GL_TEXTURE_BUFFER, tbo);
+
+   glGenTextures(1, &tex);
+   glBindTexture(GL_TEXTURE_BUFFER, tex);
+
+   glGetIntegerv(GL_MAX_TEXTURE_BUFFER_SIZE, &max);
+
+   printf("MAX_TEXTURE_BUFFER_SIZE: %d\n", max);
+   if (max >= 512 * 1024 * 1024) {
+ 

[Piglit] [PATCH v4] Port arb occlusion query conformance tests from Glean to Piglit

2015-09-16 Thread Juliet Fru
This test replaces the original glean toccluqry.cpp test.
---
 tests/all.py   |   1 +
 tests/spec/arb_occlusion_query/CMakeLists.gl.txt   |   1 +
 .../arb_occlusion_query/occlusion_query_conform.c  | 613 +
 3 files changed, 615 insertions(+)
 create mode 100644 tests/spec/arb_occlusion_query/occlusion_query_conform.c

diff --git a/tests/all.py b/tests/all.py
index fe088f5..748165f 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2115,6 +2115,7 @@ with profile.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'ARB_occlusion_query')) as g:
 g(['occlusion_query'])
+g(['occlusion_query_conformance'])
 g(['occlusion_query_lifetime'])
 g(['occlusion_query_meta_fragments'])
 g(['occlusion_query_meta_no_fragments'])
diff --git a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt 
b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
index 01a499d..23a19e4 100644
--- a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
+++ b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt
@@ -10,6 +10,7 @@ link_libraries (
 )
 
 piglit_add_executable (occlusion_query occlusion_query.c)
+piglit_add_executable (occlusion_query_conformance occlusion_query_conform.c)
 piglit_add_executable (occlusion_query_lifetime occlusion_query_lifetime.c)
 piglit_add_executable (occlusion_query_meta_no_fragments 
occlusion_query_meta_no_fragments.c)
 piglit_add_executable (occlusion_query_meta_fragments 
occlusion_query_meta_fragments.c)
diff --git a/tests/spec/arb_occlusion_query/occlusion_query_conform.c 
b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
new file mode 100644
index 000..699d411
--- /dev/null
+++ b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
@@ -0,0 +1,613 @@
+/*  BEGIN_COPYRIGHT -*- glean -*-
+ * 
+ *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ *  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.
+ *
+ * END_COPYRIGHT
+ */
+
+/** @file occlusion_query_conform.c
+ *
+ * Conformance test on ARB_occlusion_query extension.
+ *
+ * Authors:
+ * Wei Wang 
+ * Adapted to Piglit by Juliet Fru , September 2015
+ */
+
+#include "piglit-util-gl.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;
+
+
+config.window_width = 160;
+config.window_height = 160;
+config.window_visual =
+   PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE |
+   PIGLIT_GL_VISUAL_DEPTH;
+
+PIGLIT_GL_TEST_CONFIG_END 
+
+
+static GLuint
+find_unused_id(void)
+{
+   GLuint id;
+   glGenQueries(1, &id);
+   return id;
+
+}
+
+/* If multiple queries are issued on the same target and id prior to calling
+ * GetQueryObject[u]iVARB, the result returned will always be from the last
+ * query issued.  The results from any queries before the last one will be lost
+ * if the results are not retrieved before starting a new query on the same
+ * target and id.
+ */
+static bool
+conformOQ_GetObjivAval_multi1(GLuint id)
+{
+   GLint ready;
+   GLuint passed = 0;
+
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   glMatrixMode(GL_PROJECTION);
+   glPushMatrix();
+   glLoadIdentity();
+   glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 25.0);
+
+   glMatrixMode(GL_MODELVIEW);
+   glPushMatrix();
+   glLoadIdentity();
+   glTranslatef(0.0, 0.0, -10.0);
+
+   /* draw the occluder (red) */
+   glColorMask(1, 1, 1, 1);
+   glDepthMask(GL_TRUE);
+   glColor3f(1, 0, 0);
+   piglit_draw_rect(-0.5, 0.5, 0.5, -0.5);
+
+   glPushMatrix();
+   glTranslatef(0.0, 0.0, -5.0);
+   glColorMask(0, 0, 0, 0);
+   glDepthMask(GL_FALSE);
+
+   /* draw the 1st box (gren) which is occluded by the occluder partly */
+   glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id);
+   glColo

Re: [Piglit] [PATCH 2/2] cl: Change data types of char/short buffers in integer limits tests

2015-09-16 Thread Aaron Watry
On Tue, Sep 15, 2015 at 9:42 AM, Jan Vesely  wrote:

>
>
> On Tue, Sep 15, 2015 at 7:28 AM, Jan Vesely 
> wrote:
>
>> On Thu, 2015-09-10 at 10:12 -0500, Aaron Watry wrote:
>> > The char/short return buffers were declared as ints.
>> >
>> > Signed-off-by: Aaron Watry 
>>
>> Reviewed-by: Jan Vesely 
>> For both patches.
>>
>> though, I agree with Serge that a spec reference would be nice.
>>
>
> PS: don't we need to test this for *_MAX too? I'd expect at least char and
> short to have the same problem.
>


Yes, it seems that the _MAX values are also broken because the values are
upgraded to ints by llvm.


>
>> Jan
>>
>> > ---
>> >  tests/cl/program/execute/int-definitions.cl | 8 
>> >  1 file changed, 4 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/tests/cl/program/execute/int-definitions.cl
>> > b/tests/cl/program/execute/int-definitions.cl
>> > index 3d8ee63..a438fe4 100644
>> > --- a/tests/cl/program/execute/int-definitions.cl
>> > +++ b/tests/cl/program/execute/int-definitions.cl
>> > @@ -12,12 +12,12 @@ global_size: 1 0 0
>> >  [test]
>> >  name: Char Definitions
>> >  kernel_name: test_char
>> > -arg_out: 0 buffer int[6] 8 127 -128 127 -128 255
>> > +arg_out: 0 buffer char[6] 8 127 -128 127 -128 255
>> >
>> >  [test]
>> >  name: Short Definitions
>> >  kernel_name: test_short
>> > -arg_out: 0 buffer int[3] 32767 -32768 65535
>> > +arg_out: 0 buffer short[3] 32767 -32768 65535
>> >
>> >  [test]
>> >  name: Int Definitions
>> > @@ -32,7 +32,7 @@ arg_out: 0 buffer long[3] 9223372036854775807 \
>> >18446744073709551615
>> >  !*/
>> >
>> > -kernel void test_char(global int* out) {
>> > +kernel void test_char(global char* out) {
>> >int i = 0;
>> >out[i++] = CHAR_BIT;
>> >out[i++] = CHAR_MAX;
>> > @@ -42,7 +42,7 @@ kernel void test_char(global int* out) {
>> >out[i++] = UCHAR_MAX;
>> >  }
>> >
>> > -kernel void test_short(global int* out) {
>> > +kernel void test_short(global short* out) {
>> >int i = 0;
>> >out[i++] = SHRT_MAX;
>> >out[i++] = (SHRT_MIN - (short2)(0)).s0;
>>
>
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v8] Port basic GL rendering test from Glean to Piglit

2015-09-16 Thread Juliet Fru
This test replaces the original glean tpaths.cpp test.
---
 tests/all.py|   1 +
 tests/spec/gl-1.0/CMakeLists.gl.txt |   1 +
 tests/spec/gl-1.0/no-op-paths.c | 305 
 3 files changed, 307 insertions(+)
 create mode 100644 tests/spec/gl-1.0/no-op-paths.c

diff --git a/tests/all.py b/tests/all.py
index fcfc5cd..85973d6 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1000,6 +1000,7 @@ with profile.group_manager(
 g(['gl-1.0-ortho-pos'])
 g(['gl-1.0-readpixsanity'])
 g(['gl-1.0-logicop'])
+g(['gl-1.0-no-op-paths'])
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index d04b835..7a7f508 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -22,6 +22,7 @@ piglit_add_executable (gl-1.0-front-invalidate-back 
front-invalidate-back.c)
 piglit_add_executable (gl-1.0-logicop logicop.c)
 piglit_add_executable (gl-1.0-long-dlist long-dlist.c)
 piglit_add_executable (gl-1.0-ortho-pos orthpos.c)
+piglit_add_executable (gl-1.0-no-op-paths no-op-paths.c)
 piglit_add_executable (gl-1.0-polygon-line-aa polygon-line-aa.c)
 piglit_add_executable (gl-1.0-push-no-attribs push-no-attribs.c)
 piglit_add_executable (gl-1.0-readpixsanity readpix.c)
diff --git a/tests/spec/gl-1.0/no-op-paths.c b/tests/spec/gl-1.0/no-op-paths.c
new file mode 100644
index 000..57c3d5a
--- /dev/null
+++ b/tests/spec/gl-1.0/no-op-paths.c
@@ -0,0 +1,305 @@
+/*  BEGIN_COPYRIGHT -*- glean -*-
+ *
+ *  Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ *  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.
+ *
+ *  END_COPYRIGHT
+ */
+/** @file paths.c
+ *
+ *  Test basic GL rendering paths.
+ *
+ *
+ * Based on the original Glean tpaths.cpp test, this test verifies
+ * that basic, trival OpenGL paths work as expected. For example,
+ * glAlphaFunc(GL_GEQUAL, 0.0) should always pass and
+ * glAlphaFunc(GL_LESS, 0.0) should always fail.  We setup trivial
+ * pass and fail conditions for each of alpha test, blending, color mask,
+ * depth test, logic ops, scissor, stencil, stipple, and texture and
+ * make sure they work as expected.  We also setup trival-pass for all
+ * these paths simultaneously and test that as well.
+ *
+ * To test for pass/fail we examine the color buffer for white or black,
+ * respectively.
+ *
+ * Authors:
+ * Brian Paul 
+ * Adapted to Piglit by Juliet Fru , August 2015.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;
+
+config.window_visual = PIGLIT_GL_VISUAL_RGBA |
+   PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH |
+   PIGLIT_GL_VISUAL_STENCIL;
+
+PIGLIT_GL_TEST_CONFIG_END enum path
+{
+   ALPHA,
+   BLEND,
+   COLOR_MASK,
+   DEPTH,
+   LOGIC,
+   SCISSOR,
+   STENCIL,
+   STIPPLE,
+   TEXTURE,
+   NUM_PATHS   /* end-of-list token */
+};
+
+enum state
+{
+   DISABLE,
+   ALWAYS_PASS,
+   ALWAYS_FAIL
+};
+
+const char *
+path_name(enum path paths)
+{
+   switch (paths) {
+   case ALPHA:
+   return "Alpha Test";
+   case BLEND:
+   return "Blending";
+   case COLOR_MASK:
+   return "Color Mask";
+   case DEPTH:
+   return "Depth Test";
+   case LOGIC:
+   return "LogicOp";
+   case SCISSOR:
+   return "Scissor Test";
+   case STENCIL:
+   return "Stencil Test";
+   case STIPPLE:
+   return "Polygon Stipple";
+   case TEXTURE:
+   return "Modulated Texture";
+   case NUM_PATHS:
+   return "paths";
+   }
+}
+
+void
+set_path_state(enum path paths, enum state states)
+{
+ 

[Piglit] [PATCH v2] khr_texture_compression_astc: Add array tests

2015-09-16 Thread Nanley Chery
From: Nanley Chery 

These tests check that 2D texture arrays work for the 5x5 and
12x12 block sizes.

v2. add to all.py (Ilia).
create test for gles2.

Signed-off-by: Nanley Chery 
---
 tests/all.py   |   2 +
 .../khr_texture_compression_astc/CMakeLists.gl.txt |   1 +
 .../CMakeLists.gles2.txt   |   1 +
 .../compressed/hdr/array/waffles-12x12.ktx | Bin 0 -> 5888 bytes
 .../compressed/hdr/array/waffles-5x5.ktx   | Bin 0 -> 30400 bytes
 .../compressed/ldrl/array/waffles-12x12.ktx| Bin 0 -> 11680 bytes
 .../compressed/ldrl/array/waffles-5x5.ktx  | Bin 0 -> 30400 bytes
 .../compressed/ldrs/array/waffles-12x12.ktx| Bin 0 -> 11680 bytes
 .../compressed/ldrs/array/waffles-5x5.ktx  | Bin 0 -> 30400 bytes
 .../khr_compressed_astc-basic.c| 251 ++
 .../khr_compressed_astc-miptree-array.c| 294 +
 11 files changed, 433 insertions(+), 116 deletions(-)
 create mode 100644 
tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-12x12.ktx
 create mode 100644 
tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-5x5.ktx
 create mode 100644 
tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-12x12.ktx
 create mode 100644 
tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-5x5.ktx
 create mode 100644 
tests/spec/khr_texture_compression_astc/compressed/ldrs/array/waffles-12x12.ktx
 create mode 100644 
tests/spec/khr_texture_compression_astc/compressed/ldrs/array/waffles-5x5.ktx
 create mode 100644 
tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c

diff --git a/tests/all.py b/tests/all.py
index 7972c84..15881a3 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4157,6 +4157,8 @@ with profile.group_manager(
  PiglitGLTest,
  grouptools.join('spec', 'khr_texture_compression_astc')) as g:
 g(['arb_texture_compression-invalid-formats', 'astc'], 'invalid formats')
+g(['khr_compressed_astc-array_gl'], 'array-gl')
+g(['khr_compressed_astc-array_gles2'], 'array-gles')
 g(['khr_compressed_astc-basic_gl'], 'basic-gl')
 g(['khr_compressed_astc-basic_gles2'], 'basic-gles')
 g(['khr_compressed_astc-miptree_gl'], 'miptree-gl')
diff --git a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt 
b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
index 903d531..a70a3ed 100644
--- a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
+++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
@@ -3,6 +3,7 @@ link_libraries (
 )
 
 piglit_add_executable(khr_compressed_astc-miptree_${piglit_target_api} 
khr_compressed_astc-miptree.c)
+piglit_add_executable(khr_compressed_astc-array_${piglit_target_api} 
khr_compressed_astc-miptree-array.c)
 piglit_add_executable(khr_compressed_astc-basic_${piglit_target_api} 
khr_compressed_astc-basic.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt 
b/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt
index 89d8279..2f1e1f8 100644
--- a/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt
+++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt
@@ -1,5 +1,6 @@
 link_libraries(piglitutil_${piglit_target_api})
 piglit_add_executable(khr_compressed_astc-miptree_${piglit_target_api} 
khr_compressed_astc-miptree.c)
+piglit_add_executable(khr_compressed_astc-array_${piglit_target_api} 
khr_compressed_astc-miptree-array.c)
 piglit_add_executable(khr_compressed_astc-basic_${piglit_target_api} 
khr_compressed_astc-basic.c)
 
 # vim: ft=cmake:
diff --git 
a/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-12x12.ktx
 
b/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-12x12.ktx
new file mode 100644
index 
..88303a51ff442db1dac95f6a75695283ddb417bc
GIT binary patch
literal 5888
zcmeHLdsGuw8ovR7A%M6RTWx7Uj4kLYD72!j4O^mCtWStMERrD!5!i@4BF``hT0s;+
zl!{skYef_e#%-;y76;Ud#UivWz7QusAc6t`#k@%F-U;p5J^Z(4|Jpr#$;_GG+;6`5
zUU%;I-I_HaVeX3-{ourWlgY5Mo&pdt=o6y4LjYj20H{FMar6yDR_LI|F&ZGMcLpF@
z#r$A;`O4iZD}W&aLKv-bsVn)K!{G>G_HY0&1gdua?M<(y@Z_cHix*x>c^u(;4-z&r
zopfV}84dz^iwaUg%Rk8Qv%JYeYCbR;8qa1og5hiNtn-P}GJJ3aq=yBf}a#h8U=LA|RQZ
zl8|mbztOLUb9bv<`HkDBd^mf7O?^oBCwI$JGstt-^K7R8e-PBUUo+=)ezk>;lkmz2kj)!MxKIm10SoWUebuZLmJ()qX+jFpOmU#1RI5+(6D=>0s^bOv?=E2G>7F
z(Ip@{q~wN>ZmZizby;a!H=grt>b^|42%jmf&q*?g%$&6Xo^0C2O$(6^2W`?(0iZ
ztqdLwg(eDy;OVOj%U9IYt*xnyN|#6l{LaCgr$AUom|xHtfN=jUB@jZ2P5p?J#PCL+
zKkxPuOY>Hl${&6xj#iyGcnkycDpAOw8>~b6b~3iis{rT2XseL^cGK!*vIT#&sY#~s
zFz22I$d0QC3Ykl=lTz@aA&^9mSZItTg3sl<-VQd?&Ou4u)S3M}of{b$8HIk4F|rWe
zpK|>_tPLfF$=;DBak5{}DZHSlD7X1Wh5r(i^~fLZJf)K8$#8$Yi5rRZ@0#`tD-`aN
zn5B12MwaNl>g+#kMMG+8h#G<>48K0j-Nw^KYPhE$wL2V!RhrxxhXZ2RDY?C2+sje~
z{2}GzR)9Y%r)MLCfhq$daIf<68zJf{d-Kawl>aHXj@(2MmSGfs6z`*6m94AmG`XfQ
zZw$Zvi?fo+*2vv-d&_lIGx6*$z$1-E>V%m`w_Ys~1T%VXZhwB$V

[Piglit] [PATCH v3 3/4] khr_texture_compression_astc: Add miptree tests

2015-09-16 Thread Nanley Chery
From: Nanley Chery 

These tests run through every ASTC configuration, comparing the
render of a compressed texture against a render of the decompressed
version of that compressed texture. The compressed and decompressed
texture was generated with a reference codec.

v2. numerous changes (Chad).

Signed-off-by: Nanley Chery 
---
 tests/all.py   |   2 +
 tests/spec/CMakeLists.txt  |   1 +
 .../khr_texture_compression_astc/CMakeLists.gl.txt |   7 +
 .../CMakeLists.gles2.txt   |   4 +
 .../khr_texture_compression_astc/CMakeLists.txt|   1 +
 .../compressed/hdr/waffles-10x10.ktx   | Bin 0 -> 4000 bytes
 .../compressed/hdr/waffles-10x5.ktx| Bin 0 -> 7696 bytes
 .../compressed/hdr/waffles-10x6.ktx| Bin 0 -> 6336 bytes
 .../compressed/hdr/waffles-10x8.ktx| Bin 0 -> 4960 bytes
 .../compressed/hdr/waffles-12x10.ktx   | Bin 0 -> 3552 bytes
 .../compressed/hdr/waffles-12x12.ktx   | Bin 0 -> 2992 bytes
 .../compressed/hdr/waffles-4x4.ktx | Bin 0 -> 23456 bytes
 .../compressed/hdr/waffles-5x4.ktx | Bin 0 -> 18768 bytes
 .../compressed/hdr/waffles-5x5.ktx | Bin 0 -> 15248 bytes
 .../compressed/hdr/waffles-6x5.ktx | Bin 0 -> 13040 bytes
 .../compressed/hdr/waffles-6x6.ktx | Bin 0 -> 10720 bytes
 .../compressed/hdr/waffles-8x5.ktx | Bin 0 -> 9632 bytes
 .../compressed/hdr/waffles-8x6.ktx | Bin 0 -> 7920 bytes
 .../compressed/hdr/waffles-8x8.ktx | Bin 0 -> 6192 bytes
 .../compressed/ldrl/waffles-10x10.ktx  | Bin 0 -> 4000 bytes
 .../compressed/ldrl/waffles-10x5.ktx   | Bin 0 -> 7696 bytes
 .../compressed/ldrl/waffles-10x6.ktx   | Bin 0 -> 6336 bytes
 .../compressed/ldrl/waffles-10x8.ktx   | Bin 0 -> 4960 bytes
 .../compressed/ldrl/waffles-12x10.ktx  | Bin 0 -> 3552 bytes
 .../compressed/ldrl/waffles-12x12.ktx  | Bin 0 -> 2992 bytes
 .../compressed/ldrl/waffles-4x4.ktx| Bin 0 -> 23456 bytes
 .../compressed/ldrl/waffles-5x4.ktx| Bin 0 -> 18768 bytes
 .../compressed/ldrl/waffles-5x5.ktx| Bin 0 -> 15248 bytes
 .../compressed/ldrl/waffles-6x5.ktx| Bin 0 -> 13040 bytes
 .../compressed/ldrl/waffles-6x6.ktx| Bin 0 -> 10720 bytes
 .../compressed/ldrl/waffles-8x5.ktx| Bin 0 -> 9632 bytes
 .../compressed/ldrl/waffles-8x6.ktx| Bin 0 -> 7920 bytes
 .../compressed/ldrl/waffles-8x8.ktx| Bin 0 -> 6192 bytes
 .../compressed/ldrs/waffles-10x10.ktx  | Bin 0 -> 4000 bytes
 .../compressed/ldrs/waffles-10x5.ktx   | Bin 0 -> 7696 bytes
 .../compressed/ldrs/waffles-10x6.ktx   | Bin 0 -> 6336 bytes
 .../compressed/ldrs/waffles-10x8.ktx   | Bin 0 -> 4960 bytes
 .../compressed/ldrs/waffles-12x10.ktx  | Bin 0 -> 3552 bytes
 .../compressed/ldrs/waffles-12x12.ktx  | Bin 0 -> 2992 bytes
 .../compressed/ldrs/waffles-4x4.ktx| Bin 0 -> 23456 bytes
 .../compressed/ldrs/waffles-5x4.ktx| Bin 0 -> 18768 bytes
 .../compressed/ldrs/waffles-5x5.ktx| Bin 0 -> 15248 bytes
 .../compressed/ldrs/waffles-6x5.ktx| Bin 0 -> 13040 bytes
 .../compressed/ldrs/waffles-6x6.ktx| Bin 0 -> 10720 bytes
 .../compressed/ldrs/waffles-8x5.ktx| Bin 0 -> 9632 bytes
 .../compressed/ldrs/waffles-8x6.ktx| Bin 0 -> 7920 bytes
 .../compressed/ldrs/waffles-8x8.ktx| Bin 0 -> 6192 bytes
 .../decompressed/hdr/waffles-10x10.ktx | Bin 0 -> 135572 bytes
 .../decompressed/hdr/waffles-10x5.ktx  | Bin 0 -> 135572 bytes
 .../decompressed/hdr/waffles-10x6.ktx  | Bin 0 -> 135572 bytes
 .../decompressed/hdr/waffles-10x8.ktx  | Bin 0 -> 135572 bytes
 .../decompressed/hdr/waffles-12x10.ktx | Bin 0 -> 135572 bytes
 .../decompressed/hdr/waffles-12x12.ktx | Bin 0 -> 135572 bytes
 .../decompressed/hdr/waffles-4x4.ktx   | Bin 0 -> 135572 bytes
 .../decompressed/hdr/waffles-5x4.ktx   | Bin 0 -> 135572 bytes
 .../decompressed/hdr/waffles-5x5.ktx   | Bin 0 -> 135572 bytes
 .../decompressed/hdr/waffles-6x5.ktx   | Bin 0 -> 135572 bytes
 .../decompressed/hdr/waffles-6x6.ktx   | Bin 0 -> 135572 bytes
 .../decompressed/hdr/waffles-8x5.ktx   | Bin 0 -> 135572 bytes
 .../decompressed/hdr/waffles-8x6.ktx   | Bin 0 -> 135572 bytes
 .../decompressed/hdr/waffles-8x8.ktx   | Bin 0 -> 135572 bytes
 .../decompressed/ldrl/waffles-10x10.ktx| Bin 0 -> 67848 bytes
 .../decompressed/ldrl/waffles-10x5.ktx | Bin 0 -> 67848 bytes
 .../decompressed/ldrl/waffles-

[Piglit] [PATCH v3 1/4] arb_texture_compression/invalid-formats: Add ASTC to list of formats

2015-09-16 Thread Nanley Chery
From: Nanley Chery 

ASTC formats are added to the list of formats that should not be returned by the
COMPRESSED_TEXTURE_FORMATS query.

v2. add astc test to all.py (Chad).

Signed-off-by: Nanley Chery 
---
 tests/all.py   |  5 +++
 .../spec/arb_texture_compression/invalid-formats.c | 51 +-
 2 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/tests/all.py b/tests/all.py
index 4fbe75b..748e27e 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4154,6 +4154,11 @@ with profile.group_manager(
 g(['oes_compressed_etc1_rgb8_texture-miptree'], 'miptree')
 
 with profile.group_manager(
+ PiglitGLTest,
+ grouptools.join('spec', 'khr_texture_compression_astc')) as g:
+g(['arb_texture_compression-invalid-formats', 'astc'], 'invalid formats')
+
+with profile.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'oes_compressed_paletted_texture')) as g:
 g(['oes_compressed_paletted_texture-api'], 'basic API')
diff --git a/tests/spec/arb_texture_compression/invalid-formats.c 
b/tests/spec/arb_texture_compression/invalid-formats.c
index e67f00e..7a081bf 100644
--- a/tests/spec/arb_texture_compression/invalid-formats.c
+++ b/tests/spec/arb_texture_compression/invalid-formats.c
@@ -76,7 +76,7 @@ struct format_list {
/**
 * Formats that are part of the extension but should not be exposed.
 */
-   struct format_tuple bad[5];
+   struct format_tuple bad[29];
 };
 
 /**
@@ -267,6 +267,46 @@ static const struct format_list etc2_formats = {
 };
 
 /**
+ * Formats belonging to GL_KHR_texture_compression_astc_ldr
+ */
+static const struct format_list astc_formats = {
+   {
+   { NULL, 0 },
+   },
+   {
+   { ENUM_AND_STRING(GL_COMPRESSED_RGBA_ASTC_4x4_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_RGBA_ASTC_5x4_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_RGBA_ASTC_5x5_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_RGBA_ASTC_6x5_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_RGBA_ASTC_6x6_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_RGBA_ASTC_8x5_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_RGBA_ASTC_8x6_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_RGBA_ASTC_8x8_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_RGBA_ASTC_10x5_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_RGBA_ASTC_10x6_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_RGBA_ASTC_10x8_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_RGBA_ASTC_10x10_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_RGBA_ASTC_12x10_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_RGBA_ASTC_12x12_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR) },
+   { ENUM_AND_STRING(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR) },
+   { NULL, 0 },
+   }
+};
+
+/**
  * List of all known compression methods to test
  *
  * The dummy first element is because this list is used by \c main to replace
@@ -284,6 +324,7 @@ const char *all_formats[] = {
"paletted",
"etc1",
"etc2",
+   "astc",
 };
 
 enum piglit_result
@@ -520,6 +561,14 @@ piglit_init(int argc, char **argv)
   
piglit_is_extension_supported("GL_ARB_ES3_compatibility"),
   true)
&& pass;
+   } else if (strcmp(argv[i], "astc") == 0) {
+   pass = try_formats(&astc_formats,
+  compressed_formats,
+  num_compressed_formats,
+  check_errors,
+  
piglit_is_extension_supported("GL_KHR_texture_compression_astc_ldr"),
+  false)
+   && pass;
} else {
fpri

[Piglit] [PATCH v3 4/4] khr_texture_compression_astc: Add API tests

2015-09-16 Thread Nanley Chery
From: Nanley Chery 

These tests check that the GL error returned by valid and invalid API calls
are as defined by the spec.

v2. add test to all.py (Ilia).
update copyright date (Dylan).
numerous changes (Chad).

Signed-off-by: Nanley Chery 
---
 tests/all.py   |   2 +
 .../khr_texture_compression_astc/CMakeLists.gl.txt |   1 +
 .../CMakeLists.gles2.txt   |   1 +
 .../khr_compressed_astc-basic.c| 366 +
 4 files changed, 370 insertions(+)
 create mode 100644 
tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c

diff --git a/tests/all.py b/tests/all.py
index c6951a2..7972c84 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4157,6 +4157,8 @@ with profile.group_manager(
  PiglitGLTest,
  grouptools.join('spec', 'khr_texture_compression_astc')) as g:
 g(['arb_texture_compression-invalid-formats', 'astc'], 'invalid formats')
+g(['khr_compressed_astc-basic_gl'], 'basic-gl')
+g(['khr_compressed_astc-basic_gles2'], 'basic-gles')
 g(['khr_compressed_astc-miptree_gl'], 'miptree-gl')
 g(['khr_compressed_astc-miptree_gles2'], 'miptree-gles')
 
diff --git a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt 
b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
index 5a86e6c..903d531 100644
--- a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
+++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
@@ -3,5 +3,6 @@ link_libraries (
 )
 
 piglit_add_executable(khr_compressed_astc-miptree_${piglit_target_api} 
khr_compressed_astc-miptree.c)
+piglit_add_executable(khr_compressed_astc-basic_${piglit_target_api} 
khr_compressed_astc-basic.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt 
b/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt
index 83bd3e7..89d8279 100644
--- a/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt
+++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt
@@ -1,4 +1,5 @@
 link_libraries(piglitutil_${piglit_target_api})
 piglit_add_executable(khr_compressed_astc-miptree_${piglit_target_api} 
khr_compressed_astc-miptree.c)
+piglit_add_executable(khr_compressed_astc-basic_${piglit_target_api} 
khr_compressed_astc-basic.c)
 
 # vim: ft=cmake:
diff --git 
a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c 
b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c
new file mode 100644
index 000..b2bd98d
--- /dev/null
+++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c
@@ -0,0 +1,366 @@
+/*
+ * Copyright © 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.
+ */
+
+#include "piglit-util-gl.h"
+
+static const GLenum cube_map_face_targets[] = {
+   GL_TEXTURE_CUBE_MAP_POSITIVE_X,
+   GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
+   GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
+   GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
+   GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
+   GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
+};
+
+static const GLenum good_targets[] = {
+   GL_TEXTURE_2D_ARRAY,
+   GL_TEXTURE_CUBE_MAP_ARRAY_EXT,
+   GL_TEXTURE_3D,
+};
+
+typedef struct _astc_fmt {
+   GLenum fmt;
+   int bw;
+   int bh;
+   int bb;
+} astc_fmt;
+
+static const astc_fmt formats[] = {
+{GL_COMPRESSED_RGBA_ASTC_4x4_KHR  ,  4,  4, 16},
+{GL_COMPRESSED_RGBA_ASTC_5x4_KHR  ,  5,  4, 16},
+{GL_COMPRESSED_RGBA_ASTC_5x5_KHR  ,  5,  5, 16},
+{GL_COMPRESSED_RGBA_ASTC_6x5_KHR  ,  6,  5, 16},
+{GL_COMPRESSED_RGBA_ASTC_6x6_KHR  ,  6,  6, 16},
+{GL_COMPRESSED_RGBA_ASTC_8x5_KHR  ,  8,  5, 16},
+{GL_COMPRESSED_RGBA_ASTC_8x6_KHR  ,  8,  6, 16},
+{GL_COMPRESSED_RGBA_ASTC_8x8_KHR  ,  8,  8, 16},
+{GL_COMPRESSED_RGBA_ASTC_10x5_KHR , 10,  5, 16},
+{GL_COMPRESSED_RGBA_ASTC_10x6

[Piglit] [PATCH] cmake: Link libpiglitutil_gl to libGL

2015-09-16 Thread Chad Versace
This is the obvious thing to do. This eliminates the need to explicitly
link to libGL in every other CMakeLists.gl.txt.

Tested-by: Nanley Chery 
---
 tests/util/CMakeLists.gl.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/util/CMakeLists.gl.txt b/tests/util/CMakeLists.gl.txt
index 34ad63e..a01fce3 100644
--- a/tests/util/CMakeLists.gl.txt
+++ b/tests/util/CMakeLists.gl.txt
@@ -4,6 +4,7 @@ include_directories(
 
 link_libraries(
${UTIL_GL_LIBS}
+   ${OPENGL_gl_LIBRARY}
)
 
 IF(PIGLIT_BUILD_GLX_TESTS)
-- 
2.5.0.342.g44e0223

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/2] shader_runner: make active_uniforms's all_types variable be global

2015-09-16 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez 
---
 tests/shaders/shader_runner.c | 156 +-
 1 file changed, 78 insertions(+), 78 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 0614c7f..7a647a1 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -158,6 +158,84 @@ enum comparison {
less_equal
 };
 
+static const struct string_to_enum all_types[] = {
+   ENUM_STRING(GL_FLOAT),
+   ENUM_STRING(GL_FLOAT_VEC2),
+   ENUM_STRING(GL_FLOAT_VEC3),
+   ENUM_STRING(GL_FLOAT_VEC4),
+   ENUM_STRING(GL_DOUBLE),
+   ENUM_STRING(GL_DOUBLE_VEC2),
+   ENUM_STRING(GL_DOUBLE_VEC3),
+   ENUM_STRING(GL_DOUBLE_VEC4),
+   ENUM_STRING(GL_INT),
+   ENUM_STRING(GL_INT_VEC2),
+   ENUM_STRING(GL_INT_VEC3),
+   ENUM_STRING(GL_INT_VEC4),
+   ENUM_STRING(GL_UNSIGNED_INT),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC2),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC3),
+   ENUM_STRING(GL_UNSIGNED_INT_VEC4),
+   ENUM_STRING(GL_BOOL),
+   ENUM_STRING(GL_BOOL_VEC2),
+   ENUM_STRING(GL_BOOL_VEC3),
+   ENUM_STRING(GL_BOOL_VEC4),
+   ENUM_STRING(GL_FLOAT_MAT2),
+   ENUM_STRING(GL_FLOAT_MAT3),
+   ENUM_STRING(GL_FLOAT_MAT4),
+   ENUM_STRING(GL_FLOAT_MAT2x3),
+   ENUM_STRING(GL_FLOAT_MAT2x4),
+   ENUM_STRING(GL_FLOAT_MAT3x2),
+   ENUM_STRING(GL_FLOAT_MAT3x4),
+   ENUM_STRING(GL_FLOAT_MAT4x2),
+   ENUM_STRING(GL_FLOAT_MAT4x3),
+   ENUM_STRING(GL_DOUBLE_MAT2),
+   ENUM_STRING(GL_DOUBLE_MAT3),
+   ENUM_STRING(GL_DOUBLE_MAT4),
+   ENUM_STRING(GL_DOUBLE_MAT2x3),
+   ENUM_STRING(GL_DOUBLE_MAT2x4),
+   ENUM_STRING(GL_DOUBLE_MAT3x2),
+   ENUM_STRING(GL_DOUBLE_MAT3x4),
+   ENUM_STRING(GL_DOUBLE_MAT4x2),
+   ENUM_STRING(GL_DOUBLE_MAT4x3),
+   ENUM_STRING(GL_SAMPLER_1D),
+   ENUM_STRING(GL_SAMPLER_2D),
+   ENUM_STRING(GL_SAMPLER_3D),
+   ENUM_STRING(GL_SAMPLER_CUBE),
+   ENUM_STRING(GL_SAMPLER_1D_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_SHADOW),
+   ENUM_STRING(GL_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_SAMPLER_1D_ARRAY_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_ARRAY_SHADOW),
+   ENUM_STRING(GL_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_SAMPLER_CUBE_SHADOW),
+   ENUM_STRING(GL_SAMPLER_BUFFER),
+   ENUM_STRING(GL_SAMPLER_2D_RECT),
+   ENUM_STRING(GL_SAMPLER_2D_RECT_SHADOW),
+   ENUM_STRING(GL_INT_SAMPLER_1D),
+   ENUM_STRING(GL_INT_SAMPLER_2D),
+   ENUM_STRING(GL_INT_SAMPLER_3D),
+   ENUM_STRING(GL_INT_SAMPLER_CUBE),
+   ENUM_STRING(GL_INT_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_INT_SAMPLER_BUFFER),
+   ENUM_STRING(GL_INT_SAMPLER_2D_RECT),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_1D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_3D),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_CUBE),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_1D_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_BUFFER),
+   ENUM_STRING(GL_UNSIGNED_INT_SAMPLER_2D_RECT),
+   { NULL, 0 }
+};
+
 GLenum
 lookup_enum_string(const struct string_to_enum *table, const char **line,
   const char *error_desc)
@@ -1860,84 +1938,6 @@ active_uniform(const char *line)
{ NULL, 0 }
};
 
-   static const struct string_to_enum all_types[] = {
-   ENUM_STRING(GL_FLOAT),
-   ENUM_STRING(GL_FLOAT_VEC2),
-   ENUM_STRING(GL_FLOAT_VEC3),
-   ENUM_STRING(GL_FLOAT_VEC4),
-   ENUM_STRING(GL_DOUBLE),
-   ENUM_STRING(GL_DOUBLE_VEC2),
-   ENUM_STRING(GL_DOUBLE_VEC3),
-   ENUM_STRING(GL_DOUBLE_VEC4),
-   ENUM_STRING(GL_INT),
-   ENUM_STRING(GL_INT_VEC2),
-   ENUM_STRING(GL_INT_VEC3),
-   ENUM_STRING(GL_INT_VEC4),
-   ENUM_STRING(GL_UNSIGNED_INT),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC2),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC3),
-   ENUM_STRING(GL_UNSIGNED_INT_VEC4),
-   ENUM_STRING(GL_BOOL),
-   ENUM_STRING(GL_BOOL_VEC2),
-   ENUM_STRING(GL_BOOL_VEC3),
-   ENUM_STRING(GL_BOOL_VEC4),
-   ENUM_STRING(GL_FLOAT_MAT2),
-   ENUM_STRING(GL_FLOAT_MAT3),
-   ENUM_STRING(GL_FLOAT_MAT4),
-   ENUM_STRING(GL_FLOAT_MAT2x3),
-   ENUM_STRING(GL_FLOAT_MAT2x4),
-   ENUM_STRING(GL_FLOAT_MA

[Piglit] [PATCH 0/2] shader_runner: Add ARB_program_interface_query support

2015-09-16 Thread Samuel Iglesias Gonsalvez
Hello,

Following my idea described here [0], I modified shader_runner to accept
other program interfaces.

The format of the command is:

 active program_interface GL_INTERFACE_TYPE_ENUM var_name GL_PROPS_ENUM integer
 
or, if we include the GL type enum:

 active program_interface GL_INTERFACE_TYPE_ENUM var_name GL_PROPS_ENUM 
GL_TYPE_ENUM

Some examples:

active program_interface GL_UNIFORM i1 GL_MATRIX_STRIDE 0
active program_interface GL_UNIFORM i1 GL_IS_ROW_MAJOR 0
active program_interface GL_PROGRAM_OUTPUT piglit_fragcolor GL_TYPE 
GL_FLOAT_VEC4
active program_interface GL_PROGRAM_INPUT piglit_vertex GL_TYPE GL_FLOAT_VEC4

What do you think?

Thanks,

Sam

[0] http://lists.freedesktop.org/archives/piglit/2015-September/017080.html 

Samuel Iglesias Gonsalvez (2):
  shader_runner: make active_uniforms's all_types variable be global
  shader_runner: Add ARB_program_interface_query support

 tests/shaders/shader_runner.c | 322 --
 1 file changed, 244 insertions(+), 78 deletions(-)

-- 
2.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/2] shader_runner: Add ARB_program_interface_query support

2015-09-16 Thread Samuel Iglesias Gonsalvez
Signed-off-by: Samuel Iglesias Gonsalvez 
---
 tests/shaders/shader_runner.c | 166 ++
 1 file changed, 166 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 7a647a1..814db33 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2046,6 +2046,170 @@ active_uniform(const char *line)
return;
 }
 
+/**
+ * Query a uniform using glGetActiveUniformsiv
+ *
+ * Format of the command:
+ *
+ *  active program_interface GL_INTERFACE_TYPE_ENUM name GL_PNAME_ENUM integer
+ *
+ * or
+ *
+ *  active program_interface GL_INTERFACE_TYPE_ENUM name GL_PNAME_ENUM 
GL_TYPE_ENUM
+ */
+void
+active_program_interface(const char *line)
+{
+   static const struct string_to_enum all_props[] = {
+   ENUM_STRING(GL_TYPE),
+   ENUM_STRING(GL_ARRAY_SIZE),
+   ENUM_STRING(GL_NAME_LENGTH),
+   ENUM_STRING(GL_BLOCK_INDEX),
+   ENUM_STRING(GL_OFFSET),
+   ENUM_STRING(GL_ARRAY_STRIDE),
+   ENUM_STRING(GL_MATRIX_STRIDE),
+   ENUM_STRING(GL_IS_ROW_MAJOR),
+   ENUM_STRING(GL_ATOMIC_COUNTER_BUFFER_INDEX),
+   ENUM_STRING(GL_BUFFER_BINDING),
+   ENUM_STRING(GL_BUFFER_DATA_SIZE),
+   ENUM_STRING(GL_NUM_ACTIVE_VARIABLES),
+   ENUM_STRING(GL_REFERENCED_BY_VERTEX_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_TESS_CONTROL_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_TESS_EVALUATION_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_GEOMETRY_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_FRAGMENT_SHADER),
+   ENUM_STRING(GL_REFERENCED_BY_COMPUTE_SHADER),
+   ENUM_STRING(GL_TOP_LEVEL_ARRAY_SIZE),
+   ENUM_STRING(GL_TOP_LEVEL_ARRAY_STRIDE),
+   ENUM_STRING(GL_LOCATION),
+   ENUM_STRING(GL_LOCATION_INDEX),
+   ENUM_STRING(GL_IS_PER_PATCH),
+   ENUM_STRING(GL_NUM_COMPATIBLE_SUBROUTINES),
+   ENUM_STRING(GL_COMPATIBLE_SUBROUTINES),
+   { NULL, 0 }
+   };
+
+   static const struct string_to_enum all_program_interface[] = {
+   ENUM_STRING(GL_UNIFORM),
+   ENUM_STRING(GL_UNIFORM_BLOCK),
+   ENUM_STRING(GL_PROGRAM_INPUT),
+   ENUM_STRING(GL_PROGRAM_OUTPUT),
+   ENUM_STRING(GL_BUFFER_VARIABLE),
+   ENUM_STRING(GL_SHADER_STORAGE_BUFFER),
+   ENUM_STRING(GL_ATOMIC_COUNTER_BUFFER),
+   ENUM_STRING(GL_VERTEX_SUBROUTINE),
+   ENUM_STRING(GL_TESS_CONTROL_SUBROUTINE),
+   ENUM_STRING(GL_TESS_EVALUATION_SUBROUTINE),
+   ENUM_STRING(GL_GEOMETRY_SUBROUTINE),
+   ENUM_STRING(GL_FRAGMENT_SUBROUTINE),
+   ENUM_STRING(GL_COMPUTE_SUBROUTINE),
+   ENUM_STRING(GL_VERTEX_SUBROUTINE_UNIFORM),
+   ENUM_STRING(GL_TESS_CONTROL_SUBROUTINE_UNIFORM),
+   ENUM_STRING(GL_TESS_EVALUATION_SUBROUTINE_UNIFORM),
+   ENUM_STRING(GL_GEOMETRY_SUBROUTINE_UNIFORM),
+   ENUM_STRING(GL_FRAGMENT_SUBROUTINE_UNIFORM),
+   ENUM_STRING(GL_COMPUTE_SUBROUTINE_UNIFORM),
+   ENUM_STRING(GL_TRANSFORM_FEEDBACK_VARYING),
+   { NULL, 0 }
+   };
+
+   char name[512];
+   char name_buf[512];
+   char prop_string[512];
+   char interface_type_string[512];
+   GLenum prop, interface_type;
+   GLint expected;
+   int i;
+   int num_active_buffers;
+
+   if (!piglit_is_extension_supported("GL_ARB_program_interface_query") &&
+   piglit_get_gl_version() < 43) {
+   fprintf(stderr,
+   "GL_ARB_program_interface_query not supported or "
+   "OpenGL version < 4.3\n");
+   return;
+   }
+
+   strcpy_to_space(interface_type_string, eat_whitespace(line));
+   interface_type = lookup_enum_string(all_program_interface, &line,
+   "glGetProgramResourceiv "
+   "programInterface");
+   line = strcpy_to_space(name, eat_whitespace(line));
+
+   strcpy_to_space(prop_string, eat_whitespace(line));
+   prop = lookup_enum_string(all_props, &line,
+ "glGetProgramResourceiv pname");
+
+   line = eat_whitespace(line);
+   if (isdigit(line[0])) {
+   expected = strtol(line, NULL, 0);
+   } else {
+   expected = lookup_enum_string(all_types, &line, "type enum");
+   }
+
+   glGetProgramInterfaceiv(prog, interface_type,
+   GL_ACTIVE_RESOURCES, &num_active_buffers);
+   for (i = 0; i < num_active_buffers; i++) {
+   GLint got;
+   GLint length;
+   GLsizei name_len;
+   bool pass = true;
+
+   glGetP