Re: [Piglit] [PATCH v4 1/1] viewport-clamp: to test the viewport clamping

2019-02-26 Thread Nanley Chery
On Tue, Feb 26, 2019 at 09:22:57AM +0200, Eleni Maria Stea wrote:
> A test to check the viewport clamping and to reproduce the following bug
> on i965:
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108999
> 
> v2:
>   - Renamed the test to something more relevant (Nanley Chery)
>   - Fixed the description (Nanley Chery)
>   - Used the piglit_build_simple_program function instead of my own code
>   to compile and link the shaders (Nanley Chery)
> 
> v3:
>   - Changed the OpenGL version to 3.0 (Nanley Chery)
>   - Used build_simple_program_unlinked instead of build_simple_program
>   (Nanley Chery)
> 
> v4:
>   - The piglit test runner passes the -fbo argument and doesn't trigger
>   the bug. Used the PIGLIT_STRIP_ARG macro to ignore it. (Kenneth
>   Graunke, Nanley Chery)


This patch is
Reviewed-by: Nanley Chery 
...and pushed, thanks!

> ---
>  tests/general/CMakeLists.gl.txt |   1 +
>  tests/general/viewport-clamp.c  | 117 
>  tests/opengl.py |   1 +
>  3 files changed, 119 insertions(+)
>  create mode 100644 tests/general/viewport-clamp.c
> 
> diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
> index 83189fc42..a0da78bbe 100644
> --- a/tests/general/CMakeLists.gl.txt
> +++ b/tests/general/CMakeLists.gl.txt
> @@ -132,5 +132,6 @@ piglit_add_executable (clear-accum clear-accum.c)
>  piglit_add_executable (vs-point_size-zero vs-point_size-zero.c)
>  piglit_add_executable (triangle-guardband-viewport 
> triangle-guardband-viewport.c)
>  piglit_add_executable (teximage-scale-bias teximage-scale-bias.c)
> +piglit_add_executable (viewport-clamp viewport-clamp.c)
>  
>  # vim: ft=cmake:
> diff --git a/tests/general/viewport-clamp.c b/tests/general/viewport-clamp.c
> new file mode 100644
> index 0..3865ed96d
> --- /dev/null
> +++ b/tests/general/viewport-clamp.c
> @@ -0,0 +1,117 @@
> +/*
> + * Copyright © 2019 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.
> + *
> + * Author:
> + *Eleni Maria Stea 
> + */
> +
> +/* The purpose of this test is to validate the viewport clamping
> + * when the Y is flipped (0 on top). It can be used to reproduce this bug:
> + * https://bugs.freedesktop.org/show_bug.cgi?id=108999
> + * and test the fix: https://patchwork.freedesktop.org/series/53830/
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +PIGLIT_STRIP_ARG("-fbo");
> +config.supports_gl_compat_version = 30;
> +config.window_width = 800;
> +config.window_height = 600;
> +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
> +config.khr_no_error_support = PIGLIT_NO_ERRORS;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static int piglit_error;
> +static unsigned int vao, vbo;
> +static unsigned int sdrprog;
> +static const float varr[] = { -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 };
> +
> +static const char *vsdr_src =
> + "attribute vec4 vertex;\n"
> + "void main()\n" "{\n" "gl_Position = vertex;\n" "}\n";
> +
> +static const char *fsdr_src =
> + "void main()\n"
> + "{\n" "gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n" "}\n";
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> + int status;
> +
> + glGenBuffers(1, );
> + glBindBuffer(GL_ARRAY_BUFFER, vbo);
> + glBufferData(GL_ARRAY_BUFFER, sizeof varr, varr, GL_STATIC_DRAW);
> +
> + glGenVertexArrays(1, );
> 

Re: [Piglit] [PATCH v3 1/1] viewport-clamp: to test the viewport clamping

2019-02-25 Thread Nanley Chery
On Mon, Feb 25, 2019 at 05:34:15PM +0200, Eleni Maria Stea wrote:
> A test to check the viewport clamping and to reproduce the following bug
> on i965:
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108999
> 
> v2:
>   - Renamed the test to something more relevant (Nanley Chery)
>   - Fixed the description (Nanley Chery)
>   - Used the piglit_build_simple_program function instead of my own code
>   to compile and link the shaders (Nanley Chery)
> 
> v3:
>   - Changed the OpenGL version to 3.0 (Nanley Chery)
>   - Used build_simple_program_unlinked instead of build_simple_program
>   (Nanley Chery)
> ---
>  tests/general/CMakeLists.gl.txt |   1 +
>  tests/general/viewport-clamp.c  | 116 
>  tests/opengl.py |   1 +
>  3 files changed, 118 insertions(+)
>  create mode 100644 tests/general/viewport-clamp.c
> 
> diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
> index 83189fc42..a0da78bbe 100644
> --- a/tests/general/CMakeLists.gl.txt
> +++ b/tests/general/CMakeLists.gl.txt
> @@ -132,5 +132,6 @@ piglit_add_executable (clear-accum clear-accum.c)
>  piglit_add_executable (vs-point_size-zero vs-point_size-zero.c)
>  piglit_add_executable (triangle-guardband-viewport 
> triangle-guardband-viewport.c)
>  piglit_add_executable (teximage-scale-bias teximage-scale-bias.c)
> +piglit_add_executable (viewport-clamp viewport-clamp.c)
>  
>  # vim: ft=cmake:
> diff --git a/tests/general/viewport-clamp.c b/tests/general/viewport-clamp.c
> new file mode 100644
> index 0..dd9e23226
> --- /dev/null
> +++ b/tests/general/viewport-clamp.c
> @@ -0,0 +1,116 @@
> +/*
> + * Copyright © 2019 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.
> + *
> + * Author:
> + *Eleni Maria Stea 
> + */
> +
> +/* The purpose of this test is to validate the viewport clamping
> + * when the Y is flipped (0 on top). It can be used to reproduce this bug:
> + * https://bugs.freedesktop.org/show_bug.cgi?id=108999
> + * and test the fix: https://patchwork.freedesktop.org/series/53830/
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +

This test triggers an assertion as expected when executing the binary
directly, but when using the piglit test runner (which is used by our
CI), it passes. The difference is that the runner passes the -fbo flag
to the binary which gives the test a buffer whose Y coordinate is not
flipped.

Ken suggested the following fix:

piglit_strip_arg(, argv, "-fbo");

We could also use the macro version in this config block:

PIGLIT_STRIP_ARG("-fbo");

I can confirm that it works on my end.

-Nanley

> +config.supports_gl_compat_version = 30;
> +config.window_width = 800;
> +config.window_height = 600;
> +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
> +config.khr_no_error_support = PIGLIT_NO_ERRORS;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static int piglit_error;
> +static unsigned int vao, vbo;
> +static unsigned int sdrprog;
> +static const float varr[] = { -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 };
> +
> +static const char *vsdr_src =
> + "attribute vec4 vertex;\n"
> + "void main()\n" "{\n" "gl_Position = vertex;\n" "}\n";
> +
> +static const char *fsdr_src =
> + "void main()\n"
> + "{\n" "gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n" "}\n";
> +
> +void
> +piglit_init(int argc, char **arg

Re: [Piglit] [PATCH 1/1] viewport-scissors-clamp: to test the 2d scissors rect clamping

2019-02-20 Thread Nanley Chery
On Wed, Feb 20, 2019 at 10:22:18PM +0200, Eleni Maria Stea wrote:
> A test to check the 2D scissors rect clamping and to reproduce the
> following bug on i965:
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108999
> ---
>  tests/general/CMakeLists.gl.txt |   1 +
>  tests/general/viewport-scissors-clamp.c | 143 

This name of this test is misleading as it doesn't call glScissor().

>  tests/opengl.py |   1 +
>  3 files changed, 145 insertions(+)
>  create mode 100644 tests/general/viewport-scissors-clamp.c
> 
> diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
> index 83189fc42..e60e47cbe 100644
> --- a/tests/general/CMakeLists.gl.txt
> +++ b/tests/general/CMakeLists.gl.txt
> @@ -132,5 +132,6 @@ piglit_add_executable (clear-accum clear-accum.c)
>  piglit_add_executable (vs-point_size-zero vs-point_size-zero.c)
>  piglit_add_executable (triangle-guardband-viewport 
> triangle-guardband-viewport.c)
>  piglit_add_executable (teximage-scale-bias teximage-scale-bias.c)
> +piglit_add_executable (viewport-scissors-clamp viewport-scissors-clamp.c)
>  
>  # vim: ft=cmake:
> diff --git a/tests/general/viewport-scissors-clamp.c 
> b/tests/general/viewport-scissors-clamp.c
> new file mode 100644
> index 0..590e294a3
> --- /dev/null
> +++ b/tests/general/viewport-scissors-clamp.c
> @@ -0,0 +1,143 @@
> +/*
> + * Copyright © 2019 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.
> + *
> + * Author:
> + *Eleni Maria Stea 
> + */
> +
> +/* The purpose of this test is to validate the 2d scissors bbox clamping

This is more validating viewport clamping isn't it?

> + * when the Y is flipped (0 on top). It can be used to reproduce this bug:
> + * https://bugs.freedesktop.org/show_bug.cgi?id=108999
> + * and test the fix: https://patchwork.freedesktop.org/series/53830/
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +int win_width = 800;
> +int win_height = 600;
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +config.supports_gl_compat_version = 20;
> +config.window_width = win_width;
> +config.window_height = win_height;

Have you considered hardcoding these values?

> +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
> +config.khr_no_error_support = PIGLIT_NO_ERRORS;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static int piglit_error;
> +static unsigned int vao, vbo;
> +static unsigned int sdrprog;
> +static const float varr[] = { -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1 };
> +
> +static const char *vsdr_src =
> + "attribute vec4 vertex;\n"
> + "void main()\n" "{\n" "gl_Position = vertex;\n" "}\n";
> +
> +static const char *fsdr_src =
> + "void main()\n"
> + "{\n" "gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n" "}\n";
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> + unsigned int vsdr, fsdr;
> + int status;
> +
> + glGenBuffers(1, );
> + glBindBuffer(GL_ARRAY_BUFFER, vbo);
> + glBufferData(GL_ARRAY_BUFFER, sizeof varr, varr, GL_STATIC_DRAW);
> +
> + glGenVertexArrays(1, );
> + glBindVertexArray(vao);
> + glEnableVertexAttribArray(0);
> + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);
> + glBindBuffer(GL_ARRAY_BUFFER, 0);
> + glBindVertexArray(0);
> +
> + /* create shaders */
> +
> + vsdr = glCreateShader(GL_VERTEX_SHADER);
> + glShaderSource(vsdr, 1, _src, 0);
> + glCompileShader(vsdr);
> + glGetShaderiv(vsdr, GL_COMPILE_STATUS, );
> + if (!status) {
> + fprintf(stderr, "failed to compile vertex shader\n");
> + piglit_error = 1;
> + return;
> + }
> + fsdr = glCreateShader(GL_FRAGMENT_SHADER);
> + glShaderSource(fsdr, 1, _src, 0);
> + glCompileShader(fsdr);
> + glGetShaderiv(fsdr, GL_COMPILE_STATUS, );
> + if (!status) {
> + 

Re: [Piglit] [PATCH v3] arb_shader_image_load_store: Test format incompatible texture buffer

2018-10-09 Thread Nanley Chery
On Tue, Oct 09, 2018 at 11:07:35AM +0300, Danylo Piliaiev wrote:
> 
> 
> On 10/8/18 7:41 PM, Nanley Chery wrote:
> > On Mon, Jul 23, 2018 at 03:13:34PM +0300, Danylo Piliaiev wrote:
> > > Test for the regression which happened when GL_TEXTURE_BUFFER was
> > > allowed to have incompatible format.
> > > 
> > > v2: Removed unnecessary code duplication - use upload_image instead
> > >   of init_level. (Francisco Jerez)
> > > v3: Removed upload_image call because image is already called
> > >   by init_image. (Francisco Jerez)
> > > 
> > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106465
> > > 
> > > Signed-off-by: Danylo Piliaiev 
> > > Reviewed-by: Francisco Jerez 
> > I noticed that this test has a reviewed-by, but isn't upstream. Does
> > someone just need to push it?
> > 
> > -Nanley
> Indeed, thank you for noticing it. I need someone to push the test.
> 

Done! Thank you for the test.

-Nanley

> - Danil
> > > ---
> > >   .../arb_shader_image_load_store/invalid.c | 19 ++-
> > >   1 file changed, 14 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/tests/spec/arb_shader_image_load_store/invalid.c 
> > > b/tests/spec/arb_shader_image_load_store/invalid.c
> > > index ed4b6c064..719304237 100644
> > > --- a/tests/spec/arb_shader_image_load_store/invalid.c
> > > +++ b/tests/spec/arb_shader_image_load_store/invalid.c
> > > @@ -268,13 +268,11 @@ invalidate_incompatible_format(const struct 
> > > image_info img, GLuint prog)
> > >   GLenum base_format = image_base_internal_format(img.format);
> > >   /* Pick an incompatible texture format with a compatible base
> > >* type. */
> > > -bool ret = init_level(img, 0, (base_format == GL_RGBA32F ?
> > > -   GL_RGBA8 : GL_RG32UI), W, H);
> > > -
> > >   glBindImageTexture(0, get_texture(0), 0, GL_TRUE, 0,
> > > -   GL_READ_WRITE, img.format->format);
> > > +   GL_READ_WRITE, (base_format == GL_RGBA32F ?
> > > +   GL_RGBA8 : GL_RG32UI));
> > > -return ret && piglit_check_gl_error(GL_NO_ERROR);
> > > +return piglit_check_gl_error(GL_NO_ERROR);
> > >   }
> > >   static bool
> > > @@ -346,6 +344,8 @@ piglit_init(int argc, char **argv)
> > >   for (op = image_ops; op->name; ++op) {
> > >   const struct image_info def_img = image_info(
> > >   GL_TEXTURE_2D, op->formats[0].format, W, H);
> > > +const struct image_info def_img_buffer = image_info(
> > > +GL_TEXTURE_BUFFER, op->formats[0].format, W, H);
> > >   /*
> > >* According to the spec, an access is considered
> > > @@ -399,6 +399,15 @@ piglit_init(int argc, char **argv)
> > >invalidate_incompatible_format, false),
> > >   "%s/incompatible format test", op->name);
> > > +/* Test for the regression which happened when
> > > + * GL_TEXTURE_BUFFER was allowed to have incompatible 
> > > format.
> > > + */
> > > +subtest(, true,
> > > +run_test(op, def_img_buffer, def_img_buffer,
> > > + invalidate_incompatible_format, false),
> > > +"%s/incompatible format test/image%s",
> > > +op->name, def_img_buffer.target->name);
> > > +
> > >   /*
> > >* " * the texture bound to the image unit has layers,
> > >* and the selected layer or cube map face doesn't
> > > -- 
> > > 2.17.1
> > > 
> > > ___
> > > Piglit mailing list
> > > Piglit@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/piglit
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v3] arb_shader_image_load_store: Test format incompatible texture buffer

2018-10-08 Thread Nanley Chery
On Mon, Jul 23, 2018 at 03:13:34PM +0300, Danylo Piliaiev wrote:
> Test for the regression which happened when GL_TEXTURE_BUFFER was
> allowed to have incompatible format.
> 
> v2: Removed unnecessary code duplication - use upload_image instead
>  of init_level. (Francisco Jerez)
> v3: Removed upload_image call because image is already called
>  by init_image. (Francisco Jerez)
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106465
> 
> Signed-off-by: Danylo Piliaiev 
> Reviewed-by: Francisco Jerez 

I noticed that this test has a reviewed-by, but isn't upstream. Does
someone just need to push it?

-Nanley

> ---
>  .../arb_shader_image_load_store/invalid.c | 19 ++-
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/spec/arb_shader_image_load_store/invalid.c 
> b/tests/spec/arb_shader_image_load_store/invalid.c
> index ed4b6c064..719304237 100644
> --- a/tests/spec/arb_shader_image_load_store/invalid.c
> +++ b/tests/spec/arb_shader_image_load_store/invalid.c
> @@ -268,13 +268,11 @@ invalidate_incompatible_format(const struct image_info 
> img, GLuint prog)
>  GLenum base_format = image_base_internal_format(img.format);
>  /* Pick an incompatible texture format with a compatible base
>   * type. */
> -bool ret = init_level(img, 0, (base_format == GL_RGBA32F ?
> -   GL_RGBA8 : GL_RG32UI), W, H);
> -
>  glBindImageTexture(0, get_texture(0), 0, GL_TRUE, 0,
> -   GL_READ_WRITE, img.format->format);
> +   GL_READ_WRITE, (base_format == GL_RGBA32F ?
> +   GL_RGBA8 : GL_RG32UI));
>  
> -return ret && piglit_check_gl_error(GL_NO_ERROR);
> +return piglit_check_gl_error(GL_NO_ERROR);
>  }
>  
>  static bool
> @@ -346,6 +344,8 @@ piglit_init(int argc, char **argv)
>  for (op = image_ops; op->name; ++op) {
>  const struct image_info def_img = image_info(
>  GL_TEXTURE_2D, op->formats[0].format, W, H);
> +const struct image_info def_img_buffer = image_info(
> +GL_TEXTURE_BUFFER, op->formats[0].format, W, H);
>  
>  /*
>   * According to the spec, an access is considered
> @@ -399,6 +399,15 @@ piglit_init(int argc, char **argv)
>   invalidate_incompatible_format, false),
>  "%s/incompatible format test", op->name);
>  
> +/* Test for the regression which happened when
> + * GL_TEXTURE_BUFFER was allowed to have incompatible format.
> + */
> +subtest(, true,
> +run_test(op, def_img_buffer, def_img_buffer,
> + invalidate_incompatible_format, false),
> +"%s/incompatible format test/image%s",
> +op->name, def_img_buffer.target->name);
> +
>  /*
>   * " * the texture bound to the image unit has layers,
>   * and the selected layer or cube map face doesn't
> -- 
> 2.17.1
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/2] tests: Split out ASTC formats into a header

2018-10-03 Thread Nanley Chery
On Wed, Oct 03, 2018 at 05:43:03PM +0300, Tapani Pälli wrote:
> Hi;
> 
> I'm not really familiar with single color block ("void extent") encoding but
> the test looks good to me!
> 
> Series is:
> Reviewed-by: Tapani Pälli 
> 

Thanks! I was able to demonstrate the issue on SKL, so I think we're
good for the encoding.

-Nanley

> On 10/3/18 2:39 AM, Nanley Chery wrote:
> > This array will be reused in the next patch.
> > ---
> >   .../khr_texture_compression_astc/common.h | 65 +++
> >   .../khr_compressed_astc-basic.c   | 45 +
> >   2 files changed, 66 insertions(+), 44 deletions(-)
> >   create mode 100644 tests/spec/khr_texture_compression_astc/common.h
> > 
> > diff --git a/tests/spec/khr_texture_compression_astc/common.h 
> > b/tests/spec/khr_texture_compression_astc/common.h
> > new file mode 100644
> > index 0..eeab70f7e
> > --- /dev/null
> > +++ b/tests/spec/khr_texture_compression_astc/common.h
> > @@ -0,0 +1,65 @@
> > +/*
> > + * Copyright © 2018 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.
> > + */
> > +
> > +static const struct astc_fmt {
> > +   /** The GLenum for the ASTC format. */
> > +   GLenum fmt;
> > +
> > +   /** The block width. */
> > +   int bw;
> > +
> > +   /** The block height. */
> > +   int bh;
> > +
> > +   /** The number of bytes per block. */
> > +   int bb;
> > +} 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_KHR , 10,  6, 16},
> > +   {GL_COMPRESSED_RGBA_ASTC_10x8_KHR , 10,  8, 16},
> > +   {GL_COMPRESSED_RGBA_ASTC_10x10_KHR, 10, 10, 16},
> > +   {GL_COMPRESSED_RGBA_ASTC_12x10_KHR, 12, 10, 16},
> > +   {GL_COMPRESSED_RGBA_ASTC_12x12_KHR, 12, 12, 16},
> > +   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR  ,  4,  4, 16},
> > +   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR  ,  5,  4, 16},
> > +   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR  ,  5,  5, 16},
> > +   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR  ,  6,  5, 16},
> > +   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR  ,  6,  6, 16},
> > +   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR  ,  8,  5, 16},
> > +   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR  ,  8,  6, 16},
> > +   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR  ,  8,  8, 16},
> > +   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR , 10,  5, 16},
> > +   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR , 10,  6, 16},
> > +   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR , 10,  8, 16},
> > +   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, 10, 10, 16},
> > +   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, 12, 10, 16},
> > +   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, 12, 12, 16}
>

[Piglit] [PATCH 1/2] tests: Split out ASTC formats into a header

2018-10-02 Thread Nanley Chery
This array will be reused in the next patch.
---
 .../khr_texture_compression_astc/common.h | 65 +++
 .../khr_compressed_astc-basic.c   | 45 +
 2 files changed, 66 insertions(+), 44 deletions(-)
 create mode 100644 tests/spec/khr_texture_compression_astc/common.h

diff --git a/tests/spec/khr_texture_compression_astc/common.h 
b/tests/spec/khr_texture_compression_astc/common.h
new file mode 100644
index 0..eeab70f7e
--- /dev/null
+++ b/tests/spec/khr_texture_compression_astc/common.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright © 2018 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.
+ */
+
+static const struct astc_fmt {
+   /** The GLenum for the ASTC format. */
+   GLenum fmt;
+
+   /** The block width. */
+   int bw;
+
+   /** The block height. */
+   int bh;
+
+   /** The number of bytes per block. */
+   int bb;
+} 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_KHR , 10,  6, 16},
+   {GL_COMPRESSED_RGBA_ASTC_10x8_KHR , 10,  8, 16},
+   {GL_COMPRESSED_RGBA_ASTC_10x10_KHR, 10, 10, 16},
+   {GL_COMPRESSED_RGBA_ASTC_12x10_KHR, 12, 10, 16},
+   {GL_COMPRESSED_RGBA_ASTC_12x12_KHR, 12, 12, 16},
+   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR  ,  4,  4, 16},
+   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR  ,  5,  4, 16},
+   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR  ,  5,  5, 16},
+   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR  ,  6,  5, 16},
+   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR  ,  6,  6, 16},
+   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR  ,  8,  5, 16},
+   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR  ,  8,  6, 16},
+   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR  ,  8,  8, 16},
+   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR , 10,  5, 16},
+   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR , 10,  6, 16},
+   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR , 10,  8, 16},
+   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, 10, 10, 16},
+   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, 12, 10, 16},
+   {GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, 12, 12, 16}
+};
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
index dda8229f5..4f23e66f8 100644
--- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c
+++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c
@@ -22,6 +22,7 @@
  */
 
 #include "piglit-util-gl.h"
+#include "common.h"
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
@@ -46,50 +47,6 @@ static const GLenum good_compressed_tex_3d_targets[] = {
GL_TEXTURE_3D,
 };
 
-static const struct astc_fmt {
-   /** The GLenum for the ASTC format. */
-   GLenum fmt;
-
-   /** The block width. */
-   int bw;
-
-   /** The block height. */
-   int bh;
-
-   /** The number of bytes per block. */
-   int bb;
-} 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},
-

[Piglit] [PATCH 2/2] khr_texture_compression_astc: Add void-extent-dl-bug

2018-10-02 Thread Nanley Chery
Mesa commit 710b1d2e665ed654fb8d52b146fa22469e1dc3a7 introduced a bug
with downloading void-extent blocks that have channel values between 0
and 4 (exclusive). Test this case.
---
 tests/opengl.py   |  1 +
 .../CMakeLists.gl.txt |  1 +
 .../void-extent-dl-bug.c  | 79 +++
 3 files changed, 81 insertions(+)
 create mode 100644 tests/spec/khr_texture_compression_astc/void-extent-dl-bug.c

diff --git a/tests/opengl.py b/tests/opengl.py
index c599eb180..c6512b467 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4390,6 +4390,7 @@ with profile.test_list.group_manager(
 g(['khr_compressed_astc-array_gles3'], 'array-gles')
 g(['khr_compressed_astc-basic_gl'], 'basic-gl')
 g(['khr_compressed_astc-basic_gles2'], 'basic-gles')
+g(['void-extent-dl-bug'], 'void-extent-dl-bug')
 
 for subtest in ('hdr', 'ldr', 'srgb', "srgb-fp", "srgb-sd"):
 g(['khr_compressed_astc-miptree_gl', '-subtest', subtest],
diff --git a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt 
b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
index 089da8488..adaff94f5 100644
--- a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
+++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
@@ -6,5 +6,6 @@ 
piglit_add_executable(khr_compressed_astc-miptree_${piglit_target_api} khr_compr
 
piglit_add_executable(khr_compressed_astc-sliced-3d-miptree_${piglit_target_api}
 khr_compressed_astc-sliced-3d-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)
+piglit_add_executable(void-extent-dl-bug void-extent-dl-bug.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/khr_texture_compression_astc/void-extent-dl-bug.c 
b/tests/spec/khr_texture_compression_astc/void-extent-dl-bug.c
new file mode 100644
index 0..2a9423906
--- /dev/null
+++ b/tests/spec/khr_texture_compression_astc/void-extent-dl-bug.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright © 2018 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"
+#include "common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 11;
+   config.supports_gl_es_version = 20;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+piglit_init(int argc, char **argv)
+{
+   piglit_require_extension("GL_KHR_texture_compression_astc_ldr");
+}
+
+enum piglit_result
+piglit_display(void)
+{
+   /* Mesa commit 710b1d2e665ed654fb8d52b146fa22469e1dc3a7 introduced a
+* bug with void-extent blocks that have channel values between 0 and
+* 4. Test this case.
+*/
+   const short void_extent_block_upload[8] = {0x0DFC,   // ve header
+  0x,   // don't care
+  0x,   // don't care
+  0x,   // don't care
+  0x0001,   // r channel
+  0x0002,   // g channel
+  0x0003,   // b channel
+  0x0004,}; // a channel
+   short void_extent_block_download[8] = {0,};
+
+   bool pass = true;
+   for (int i = 0; i < ARRAY_SIZE(formats); i++) {
+   GLuint tex;
+   glGenTextures(1, );
+   glBindTexture(GL_TEXTURE_2D, tex);
+
+   glCompressedTexImage2D(GL_TEXTURE_2D, 0, formats[i].fmt,
+  formats[i].bw, formats[i].bh, 0,
+  formats[i].bb, 

Re: [Piglit] [PATCH] ext_render_snorm-render: fix read back assumptions

2018-08-29 Thread Nanley Chery
On Wed, Aug 29, 2018 at 10:15:41AM +0300, Tapani Pälli wrote:
> 
> 
> On 29.08.2018 00:23, Nanley Chery wrote:
> > On Tue, Aug 28, 2018 at 09:58:14AM +0300, Tapani Pälli wrote:
> > > Test assumed that we can read back directly from R8, RG8 fbo but
> > > this is not actually enabled by the extension. Patch introduces
> > > additional read from window to sanity check fbo contents.
> > > 
> > 
> > I think we're allowed to read from R8 and RG8 SNORM FBOs. Page 340 of
> > the GLES 3.1 spec says that apps can query the driver to find out which
> > formats are supported for ReadPixels:
> > 
> > The second is an implementation-chosen format from among those
> > defined in table 8.2, excluding formats DEPTH_COMPONENT and
> > DEPTH_STENCIL. The values of format and type for this format may be
> > determined by calling GetIntegerv with the symbolic constants
> > IMPLEMENTATION_COLOR_READ_FORMAT and IMPLEMENTATION_COLOR_READ_TYPE,
> > respectively. The implementation-chosen format may vary depending on
> > the format of the selected read buffer of the currently bound read
> > framebuffer.
> > 
> > Table 8.2 has entries for R8 and RG8 SNORM.
> 
> Maybe the issue is that reading should be allowed only to matching number of
> components with GL_BYTE? I'm currently reading every format as GL_RGBA but I
> could change to use GL_RED, GL_RG, GL_RGBA depending on the base format. If
> I enforce such rules for GL_BYTE formats in Mesa the rest of failing dEQP
> tests start to pass. So for example, reading fbo with internalFormat of
> GL_R8_SNORM would require:
> 
> glReadPixels(0, 0, w, h, GL_RED, GL_BYTE, pix);
> 
> Does this make sense?
> 

I think we're also allowed to have mismatching component numbers when
the format is RGBA. In section 16.1.3 of the GLES3.1 spec:

   If G, B, or A values are not present in the internal format, they are
   taken to be zero, zero, and one respectively.

I think this agrees with the extension spec which allows any 8bit SNORM
format to be read with RGBA:

   For 8bit signed normalized fixed-point rendering surfaces, the
   combination format RGBA and type BYTE is accepted. For a 16bit signed
   normalized fixed point buffer, the combination RGBA and SHORT is
   accepted.

Maybe there's a dEQP bug?

-Nanley

> 
> 
> > -Nanley
> > 
> > > Signed-off-by: Tapani Pälli 
> > > ---
> > >   tests/spec/ext_render_snorm/render.c | 32 
> > > 
> > >   1 file changed, 28 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/tests/spec/ext_render_snorm/render.c 
> > > b/tests/spec/ext_render_snorm/render.c
> > > index 1d4a69c2d..ad309f17c 100644
> > > --- a/tests/spec/ext_render_snorm/render.c
> > > +++ b/tests/spec/ext_render_snorm/render.c
> > > @@ -82,10 +82,11 @@ static const struct fmt_test {
> > >   GLenum iformat;
> > >   GLenum base_format;
> > >   unsigned bpp;
> > > + bool can_read;
> > >   } tests[] = {
> > > - { GL_R8_SNORM,  GL_RED, 1, },
> > > - { GL_RG8_SNORM, GL_RG,  2, },
> > > - { GL_RGBA8_SNORM,   GL_RGBA,4, },
> > > + { GL_R8_SNORM,  GL_RED, 1,  false },
> > > + { GL_RG8_SNORM, GL_RG,  2,  false },
> > > + { GL_RGBA8_SNORM,   GL_RGBA,4,  true  },
> > >   };
> > >   static GLuint prog;
> > > @@ -229,6 +230,25 @@ verify_contents(const struct fmt_test *test)
> > >   return result;
> > >   }
> > > +static bool
> > > +verify_contents_float(const struct fmt_test *test)
> > > +{
> > > + /* Setup expected value, alpha is always max in the test. */
> > > + char value[4] = { 0, 0, 0, SCHAR_MAX };
> > > + value_for_format(test, value);
> > > +
> > > + const float expected[4] = {
> > > + value[0] / SCHAR_MAX,
> > > + value[1] / SCHAR_MAX,
> > > + value[2] / SCHAR_MAX,
> > > + value[3] / SCHAR_MAX,
> > > + };
> > > +
> > > + bool res = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
> > > +   expected);
> > > + return res;
> > > +}
> > > +
> > >   static bool
> > >   test_format(const struct fmt_test *test)
> > >   {
> > > @@ -282,13 +302,17 @@ test_format(const struct fmt_test *test)
> > >   glDeleteTextures(1, _tex);
> > >   

Re: [Piglit] [PATCH] ext_render_snorm-render: fix read back assumptions

2018-08-28 Thread Nanley Chery
On Tue, Aug 28, 2018 at 09:58:14AM +0300, Tapani Pälli wrote:
> Test assumed that we can read back directly from R8, RG8 fbo but
> this is not actually enabled by the extension. Patch introduces
> additional read from window to sanity check fbo contents.
> 

I think we're allowed to read from R8 and RG8 SNORM FBOs. Page 340 of
the GLES 3.1 spec says that apps can query the driver to find out which
formats are supported for ReadPixels:

   The second is an implementation-chosen format from among those
   defined in table 8.2, excluding formats DEPTH_COMPONENT and
   DEPTH_STENCIL. The values of format and type for this format may be
   determined by calling GetIntegerv with the symbolic constants
   IMPLEMENTATION_COLOR_READ_FORMAT and IMPLEMENTATION_COLOR_READ_TYPE,
   respectively. The implementation-chosen format may vary depending on
   the format of the selected read buffer of the currently bound read
   framebuffer.

Table 8.2 has entries for R8 and RG8 SNORM.

-Nanley

> Signed-off-by: Tapani Pälli 
> ---
>  tests/spec/ext_render_snorm/render.c | 32 
>  1 file changed, 28 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/spec/ext_render_snorm/render.c 
> b/tests/spec/ext_render_snorm/render.c
> index 1d4a69c2d..ad309f17c 100644
> --- a/tests/spec/ext_render_snorm/render.c
> +++ b/tests/spec/ext_render_snorm/render.c
> @@ -82,10 +82,11 @@ static const struct fmt_test {
>   GLenum iformat;
>   GLenum base_format;
>   unsigned bpp;
> + bool can_read;
>  } tests[] = {
> - { GL_R8_SNORM,  GL_RED, 1, },
> - { GL_RG8_SNORM, GL_RG,  2, },
> - { GL_RGBA8_SNORM,   GL_RGBA,4, },
> + { GL_R8_SNORM,  GL_RED, 1,  false },
> + { GL_RG8_SNORM, GL_RG,  2,  false },
> + { GL_RGBA8_SNORM,   GL_RGBA,4,  true  },
>  };
>  
>  static GLuint prog;
> @@ -229,6 +230,25 @@ verify_contents(const struct fmt_test *test)
>   return result;
>  }
>  
> +static bool
> +verify_contents_float(const struct fmt_test *test)
> +{
> + /* Setup expected value, alpha is always max in the test. */
> + char value[4] = { 0, 0, 0, SCHAR_MAX };
> + value_for_format(test, value);
> +
> + const float expected[4] = {
> + value[0] / SCHAR_MAX,
> + value[1] / SCHAR_MAX,
> + value[2] / SCHAR_MAX,
> + value[3] / SCHAR_MAX,
> + };
> +
> + bool res = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
> +   expected);
> + return res;
> +}
> +
>  static bool
>  test_format(const struct fmt_test *test)
>  {
> @@ -282,13 +302,17 @@ test_format(const struct fmt_test *test)
>   glDeleteTextures(1, _tex);
>  
>   /* Verify contents. */
> - pass &= verify_contents(test);
> + if (test->can_read)
> + pass &= verify_contents(test);
>  
>   glDeleteFramebuffers(1, );
>  
>   /* Render fbo contents to window. */
>   render_texture(fbo_tex, GL_TEXTURE_2D, 0);
>  
> + /* Verify window contents. */
> + pass &= verify_contents_float(test);
> +
>   piglit_present_results();
>  
>   glDeleteTextures(1, _tex);
> -- 
> 2.14.4
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2] ext_render_snorm-render: test for GL_EXT_render_snorm

2018-08-15 Thread Nanley Chery
On Wed, Aug 15, 2018 at 02:26:27PM +0300, Tapani Pälli wrote:
> Test includes:
>- texture uploads
>- mipmap generation
>- framebuffer creation
>- rendering to
>- reading from
> 
> This test includes only GL_BYTE based formats. R16_SNORM, RG16_SNORM
> and RGBA16_SNORM are tested in GL_EXT_texture_norm16 tests.
> 
> v2: cleanups and fixes (Nanley Chery)
> 
> Signed-off-by: Tapani Pälli 
> ---
>  tests/opengl.py  |   5 +
>  tests/spec/CMakeLists.txt|   1 +
>  tests/spec/ext_render_snorm/CMakeLists.gles2.txt |   7 +
>  tests/spec/ext_render_snorm/CMakeLists.txt   |   1 +
>  tests/spec/ext_render_snorm/render.c | 336 
> +++
>  5 files changed, 350 insertions(+)
>  create mode 100644 tests/spec/ext_render_snorm/CMakeLists.gles2.txt
>  create mode 100644 tests/spec/ext_render_snorm/CMakeLists.txt
>  create mode 100644 tests/spec/ext_render_snorm/render.c
> 
> diff --git a/tests/opengl.py b/tests/opengl.py
> index 7026395fa..9c5290f49 100644
> --- a/tests/opengl.py
> +++ b/tests/opengl.py
> @@ -3078,6 +3078,11 @@ with profile.test_list.group_manager(
>  
>  with profile.test_list.group_manager(
>  PiglitGLTest,
> +grouptools.join('spec', 'ext_render_snorm')) as g:
> +g(['ext_render_snorm-render'], 'render')
> +
> +with profile.test_list.group_manager(
> +PiglitGLTest,
>  grouptools.join('spec', 'ext_frag_depth')) as g:
>  g(['fragdepth_gles2'])
>  
> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
> index 26ee3ebf0..bb3f02744 100644
> --- a/tests/spec/CMakeLists.txt
> +++ b/tests/spec/CMakeLists.txt
> @@ -182,3 +182,4 @@ add_subdirectory (ext_occlusion_query_boolean)
>  add_subdirectory (ext_disjoint_timer_query)
>  add_subdirectory (intel_blackhole_render)
>  add_subdirectory (ext_texture_norm16)
> +add_subdirectory (ext_render_snorm)
> diff --git a/tests/spec/ext_render_snorm/CMakeLists.gles2.txt 
> b/tests/spec/ext_render_snorm/CMakeLists.gles2.txt
> new file mode 100644
> index 0..4b90257cc
> --- /dev/null
> +++ b/tests/spec/ext_render_snorm/CMakeLists.gles2.txt
> @@ -0,0 +1,7 @@
> +link_libraries (
> + piglitutil_${piglit_target_api}
> +)
> +
> +piglit_add_executable (ext_render_snorm-render render.c)
> +
> +# vim: ft=cmake:
> diff --git a/tests/spec/ext_render_snorm/CMakeLists.txt 
> b/tests/spec/ext_render_snorm/CMakeLists.txt
> new file mode 100644
> index 0..144a306f4
> --- /dev/null
> +++ b/tests/spec/ext_render_snorm/CMakeLists.txt
> @@ -0,0 +1 @@
> +piglit_include_target_api()
> diff --git a/tests/spec/ext_render_snorm/render.c 
> b/tests/spec/ext_render_snorm/render.c
> new file mode 100644
> index 0..3df16991e
> --- /dev/null
> +++ b/tests/spec/ext_render_snorm/render.c
> @@ -0,0 +1,336 @@
> +/*
> + * Copyright © 2018 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
> + * Basic tests for formats added by GL_EXT_render_snorm extension
> + *
> + * 
> https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_render_snorm.txt
> + *
> + * Test includes:
> + *   - texture uploads
> + *   - mipmap generation
> + *   - framebuffer creation
> + *   - rendering to
> + *   - reading from
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> + config.supports_gl_es_version = 31;
> + config.window_visual = PIGLIT_GL_VISUAL

Re: [Piglit] [PATCH] ext_render_snorm-render: test for GL_EXT_render_snorm

2018-08-15 Thread Nanley Chery
On Tue, Aug 14, 2018 at 09:25:01AM +0300, Tapani Pälli wrote:
> 
> 
> On 08/13/2018 07:59 PM, Nanley Chery wrote:
> > On Mon, Aug 13, 2018 at 02:59:39PM +0300, Tapani Pälli wrote:
> > > 
> > > 
> > > On 08/13/2018 01:31 PM, Tapani Pälli wrote:
> > > > 
> > > > 
> > > > On 08/11/2018 01:12 AM, Nanley Chery wrote:
> > > > > On Thu, Aug 02, 2018 at 02:06:26PM +0300, Tapani Pälli wrote:
> > > > > > Test includes:
> > > > > >      - texture uploads
> > > > > >      - mipmap generation
> > > > > >      - framebuffer creation
> > > > > >      - rendering to
> > > > > >      - reading from
> > > > > >      - interaction with GL_EXT_copy_image
> > > > > 
> > > > > I don't see any interaction with this extension..
> > > > 
> > > > Oops yes, this is leftover (as this test was copy-paste from
> > > > ext_texture_norm16 test), will remove this.
> > > > 
> > > > 
> > > > > > 
> > > > > > This test includes only GL_BYTE based formats. R16_SNORM, RG16_SNORM
> > > > > > and RGBA16_SNORM are tested in GL_EXT_texture_norm16 tests.
> > > > > > 
> > > > > > Signed-off-by: Tapani Pälli 
> > > > > > ---
> > > > > >    tests/opengl.py  |   5 +
> > > > > >    tests/spec/CMakeLists.txt    |   1 +
> > > > > >    tests/spec/ext_render_snorm/CMakeLists.gles2.txt |   7 +
> > > > > >    tests/spec/ext_render_snorm/CMakeLists.txt   |   1 +
> > > > > >    tests/spec/ext_render_snorm/render.c | 335
> > > > > > +++
> > > > > >    5 files changed, 349 insertions(+)
> > > > > >    create mode 100644 
> > > > > > tests/spec/ext_render_snorm/CMakeLists.gles2.txt
> > > > > >    create mode 100644 tests/spec/ext_render_snorm/CMakeLists.txt
> > > > > >    create mode 100644 tests/spec/ext_render_snorm/render.c
> > > > > > 
> > > > > > diff --git a/tests/opengl.py b/tests/opengl.py
> > > > > > index 397676e65..6a8c513b4 100644
> > > > > > --- a/tests/opengl.py
> > > > > > +++ b/tests/opengl.py
> > > > > > @@ -3070,6 +3070,11 @@ with profile.test_list.group_manager(
> > > > > >    grouptools.join('spec', 'ext_texture_norm16')) as g:
> > > > > >    g(['ext_texture_norm16-render'], 'render')
> > > > > > +with profile.test_list.group_manager(
> > > > > > +    PiglitGLTest,
> > > > > > +    grouptools.join('spec', 'ext_render_snorm')) as g:
> > > > > > +    g(['ext_render_snorm-render'], 'render')
> > > > > > +
> > > > > >    with profile.test_list.group_manager(
> > > > > >    PiglitGLTest,
> > > > > >    grouptools.join('spec', 'ext_frag_depth')) as g:
> > > > > > diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
> > > > > > index 6cf3f76ed..0a2d4bb25 100644
> > > > > > --- a/tests/spec/CMakeLists.txt
> > > > > > +++ b/tests/spec/CMakeLists.txt
> > > > > > @@ -181,3 +181,4 @@ add_subdirectory (ext_occlusion_query_boolean)
> > > > > >    add_subdirectory (ext_disjoint_timer_query)
> > > > > >    add_subdirectory (intel_blackhole_render)
> > > > > >    add_subdirectory (ext_texture_norm16)
> > > > > > +add_subdirectory (ext_render_snorm)
> > > > > > diff --git a/tests/spec/ext_render_snorm/CMakeLists.gles2.txt
> > > > > > b/tests/spec/ext_render_snorm/CMakeLists.gles2.txt
> > > > > > new file mode 100644
> > > > > > index 0..4b90257cc
> > > > > > --- /dev/null
> > > > > > +++ b/tests/spec/ext_render_snorm/CMakeLists.gles2.txt
> > > > > > @@ -0,0 +1,7 @@
> > > > > > +link_libraries (
> > > > > > +    piglitutil_${piglit_target_api}
> > > > > > +)
> > > > > > +
> > > > > > +piglit_add_executable (ext_render_snorm-render render.c)
> > > > > > +
> > > > > > +# vim: ft=cmake:
> > >

Re: [Piglit] [PATCH] ext_render_snorm-render: test for GL_EXT_render_snorm

2018-08-13 Thread Nanley Chery
On Mon, Aug 13, 2018 at 02:59:39PM +0300, Tapani Pälli wrote:
> 
> 
> On 08/13/2018 01:31 PM, Tapani Pälli wrote:
> > 
> > 
> > On 08/11/2018 01:12 AM, Nanley Chery wrote:
> > > On Thu, Aug 02, 2018 at 02:06:26PM +0300, Tapani Pälli wrote:
> > > > Test includes:
> > > >     - texture uploads
> > > >     - mipmap generation
> > > >     - framebuffer creation
> > > >     - rendering to
> > > >     - reading from
> > > >     - interaction with GL_EXT_copy_image
> > > 
> > > I don't see any interaction with this extension..
> > 
> > Oops yes, this is leftover (as this test was copy-paste from
> > ext_texture_norm16 test), will remove this.
> > 
> > 
> > > > 
> > > > This test includes only GL_BYTE based formats. R16_SNORM, RG16_SNORM
> > > > and RGBA16_SNORM are tested in GL_EXT_texture_norm16 tests.
> > > > 
> > > > Signed-off-by: Tapani Pälli 
> > > > ---
> > > >   tests/opengl.py  |   5 +
> > > >   tests/spec/CMakeLists.txt    |   1 +
> > > >   tests/spec/ext_render_snorm/CMakeLists.gles2.txt |   7 +
> > > >   tests/spec/ext_render_snorm/CMakeLists.txt   |   1 +
> > > >   tests/spec/ext_render_snorm/render.c | 335
> > > > +++
> > > >   5 files changed, 349 insertions(+)
> > > >   create mode 100644 tests/spec/ext_render_snorm/CMakeLists.gles2.txt
> > > >   create mode 100644 tests/spec/ext_render_snorm/CMakeLists.txt
> > > >   create mode 100644 tests/spec/ext_render_snorm/render.c
> > > > 
> > > > diff --git a/tests/opengl.py b/tests/opengl.py
> > > > index 397676e65..6a8c513b4 100644
> > > > --- a/tests/opengl.py
> > > > +++ b/tests/opengl.py
> > > > @@ -3070,6 +3070,11 @@ with profile.test_list.group_manager(
> > > >   grouptools.join('spec', 'ext_texture_norm16')) as g:
> > > >   g(['ext_texture_norm16-render'], 'render')
> > > > +with profile.test_list.group_manager(
> > > > +    PiglitGLTest,
> > > > +    grouptools.join('spec', 'ext_render_snorm')) as g:
> > > > +    g(['ext_render_snorm-render'], 'render')
> > > > +
> > > >   with profile.test_list.group_manager(
> > > >   PiglitGLTest,
> > > >   grouptools.join('spec', 'ext_frag_depth')) as g:
> > > > diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
> > > > index 6cf3f76ed..0a2d4bb25 100644
> > > > --- a/tests/spec/CMakeLists.txt
> > > > +++ b/tests/spec/CMakeLists.txt
> > > > @@ -181,3 +181,4 @@ add_subdirectory (ext_occlusion_query_boolean)
> > > >   add_subdirectory (ext_disjoint_timer_query)
> > > >   add_subdirectory (intel_blackhole_render)
> > > >   add_subdirectory (ext_texture_norm16)
> > > > +add_subdirectory (ext_render_snorm)
> > > > diff --git a/tests/spec/ext_render_snorm/CMakeLists.gles2.txt
> > > > b/tests/spec/ext_render_snorm/CMakeLists.gles2.txt
> > > > new file mode 100644
> > > > index 0..4b90257cc
> > > > --- /dev/null
> > > > +++ b/tests/spec/ext_render_snorm/CMakeLists.gles2.txt
> > > > @@ -0,0 +1,7 @@
> > > > +link_libraries (
> > > > +    piglitutil_${piglit_target_api}
> > > > +)
> > > > +
> > > > +piglit_add_executable (ext_render_snorm-render render.c)
> > > > +
> > > > +# vim: ft=cmake:
> > > > diff --git a/tests/spec/ext_render_snorm/CMakeLists.txt
> > > > b/tests/spec/ext_render_snorm/CMakeLists.txt
> > > > new file mode 100644
> > > > index 0..144a306f4
> > > > --- /dev/null
> > > > +++ b/tests/spec/ext_render_snorm/CMakeLists.txt
> > > > @@ -0,0 +1 @@
> > > > +piglit_include_target_api()
> > > > diff --git a/tests/spec/ext_render_snorm/render.c
> > > > b/tests/spec/ext_render_snorm/render.c
> > > > new file mode 100644
> > > > index 0..241812e12
> > > > --- /dev/null
> > > > +++ b/tests/spec/ext_render_snorm/render.c
> > > > @@ -0,0 +1,335 @@
> > > > +/*
> > > > + * Copyright © 2018 Intel Corporation
> > > > + *
> > > > + * Permission is hereby granted, free of charge, to any person
> > > > obtain

Re: [Piglit] [PATCH] ext_render_snorm-render: test for GL_EXT_render_snorm

2018-08-10 Thread Nanley Chery
On Thu, Aug 02, 2018 at 02:06:26PM +0300, Tapani Pälli wrote:
> Test includes:
>- texture uploads
>- mipmap generation
>- framebuffer creation
>- rendering to
>- reading from
>- interaction with GL_EXT_copy_image

I don't see any interaction with this extension..

> 
> This test includes only GL_BYTE based formats. R16_SNORM, RG16_SNORM
> and RGBA16_SNORM are tested in GL_EXT_texture_norm16 tests.
> 
> Signed-off-by: Tapani Pälli 
> ---
>  tests/opengl.py  |   5 +
>  tests/spec/CMakeLists.txt|   1 +
>  tests/spec/ext_render_snorm/CMakeLists.gles2.txt |   7 +
>  tests/spec/ext_render_snorm/CMakeLists.txt   |   1 +
>  tests/spec/ext_render_snorm/render.c | 335 
> +++
>  5 files changed, 349 insertions(+)
>  create mode 100644 tests/spec/ext_render_snorm/CMakeLists.gles2.txt
>  create mode 100644 tests/spec/ext_render_snorm/CMakeLists.txt
>  create mode 100644 tests/spec/ext_render_snorm/render.c
> 
> diff --git a/tests/opengl.py b/tests/opengl.py
> index 397676e65..6a8c513b4 100644
> --- a/tests/opengl.py
> +++ b/tests/opengl.py
> @@ -3070,6 +3070,11 @@ with profile.test_list.group_manager(
>  grouptools.join('spec', 'ext_texture_norm16')) as g:
>  g(['ext_texture_norm16-render'], 'render')
>  
> +with profile.test_list.group_manager(
> +PiglitGLTest,
> +grouptools.join('spec', 'ext_render_snorm')) as g:
> +g(['ext_render_snorm-render'], 'render')
> +
>  with profile.test_list.group_manager(
>  PiglitGLTest,
>  grouptools.join('spec', 'ext_frag_depth')) as g:
> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
> index 6cf3f76ed..0a2d4bb25 100644
> --- a/tests/spec/CMakeLists.txt
> +++ b/tests/spec/CMakeLists.txt
> @@ -181,3 +181,4 @@ add_subdirectory (ext_occlusion_query_boolean)
>  add_subdirectory (ext_disjoint_timer_query)
>  add_subdirectory (intel_blackhole_render)
>  add_subdirectory (ext_texture_norm16)
> +add_subdirectory (ext_render_snorm)
> diff --git a/tests/spec/ext_render_snorm/CMakeLists.gles2.txt 
> b/tests/spec/ext_render_snorm/CMakeLists.gles2.txt
> new file mode 100644
> index 0..4b90257cc
> --- /dev/null
> +++ b/tests/spec/ext_render_snorm/CMakeLists.gles2.txt
> @@ -0,0 +1,7 @@
> +link_libraries (
> + piglitutil_${piglit_target_api}
> +)
> +
> +piglit_add_executable (ext_render_snorm-render render.c)
> +
> +# vim: ft=cmake:
> diff --git a/tests/spec/ext_render_snorm/CMakeLists.txt 
> b/tests/spec/ext_render_snorm/CMakeLists.txt
> new file mode 100644
> index 0..144a306f4
> --- /dev/null
> +++ b/tests/spec/ext_render_snorm/CMakeLists.txt
> @@ -0,0 +1 @@
> +piglit_include_target_api()
> diff --git a/tests/spec/ext_render_snorm/render.c 
> b/tests/spec/ext_render_snorm/render.c
> new file mode 100644
> index 0..241812e12
> --- /dev/null
> +++ b/tests/spec/ext_render_snorm/render.c
> @@ -0,0 +1,335 @@
> +/*
> + * Copyright © 2018 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
> + * Basic tests for formats added by GL_EXT_render_snorm extension
> + *
> + * 
> https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_render_snorm.txt
> + *
> + * Test includes:
> + *   - texture uploads
> + *   - mipmap generation
> + *   - framebuffer creation
> + *   - rendering to
> + *   - reading from
> + *   - interaction with GL_EXT_copy_image

Same as above.

> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> + config.supports_gl_es_version = 31;
> + config.window_visual = PIGLIT_GL_VISUAL_RGBA;
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +#define PIGLIT_RESULT(x) x ? PIGLIT_PASS : PIGLIT_FAIL
> +
> +static const char vs_source[] =
> + "#version 310 es\n"
> + "layout(location = 0) in highp vec4 vertex;\n"
> + 

Re: [Piglit] [PATCH v2 4/4] getteximage-simple: Stress an i965 blitter path

2018-06-20 Thread Nanley Chery
On Wed, Jun 20, 2018 at 09:35:21PM +0100, Lionel Landwerlin wrote:
> On 20/06/18 20:49, Nanley Chery wrote:
> > On Wed, Jun 20, 2018 at 06:32:58PM +0100, Lionel Landwerlin wrote:
> > > On 19/06/18 18:53, Nanley Chery wrote:
> > > > On Tue, Jun 19, 2018 at 11:03:17AM +0100, Lionel Landwerlin wrote:
> > > > > On 18/06/18 19:57, Nanley Chery wrote:
> > > > > > Change the dimension of the texture to test how i965 handles having 
> > > > > > a
> > > > > > row pitch too large for the BLT engine.
> > > > > > 
> > > > > > v2: Query the maximum supported texture width (Ilia Mirkin)
> > > > > > ---
> > > > > > tests/texturing/getteximage-simple.c | 25 
> > > > > > +
> > > > > > 1 file changed, 17 insertions(+), 8 deletions(-)
> > > > > > 
> > > > > > diff --git a/tests/texturing/getteximage-simple.c 
> > > > > > b/tests/texturing/getteximage-simple.c
> > > > > > index 525e6a392..5b87b7ccd 100644
> > > > > > --- a/tests/texturing/getteximage-simple.c
> > > > > > +++ b/tests/texturing/getteximage-simple.c
> > > > > > @@ -8,6 +8,10 @@
> > > > > >  * texture images is executed before the readback.
> > > > > >  *
> > > > > >  * This used to crash for R300+bufmgr.
> > > > > > + *
> > > > > > + * This also used to stress test the blit methods in i965. The BLT 
> > > > > > engine only
> > > > > > + * supports pitch sizes up to but not including 32768 dwords. 
> > > > > > BLORP supports
> > > > > > + * even larger sizes.
> > > > > >  */
> > > > > > #include "piglit-util-gl.h"
> > > > > > @@ -21,10 +25,10 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
> > > > > > PIGLIT_GL_TEST_CONFIG_END
> > > > > > -#define MAX_TYPE_VAL UINT8_MAX
> > > > > > -#define PIX_TYPE GLubyte
> > > > > > -#define TEX_TYPE GL_UNSIGNED_BYTE
> > > > > > -#define TEX_INT_FMT GL_RGBA8
> > > > > > +#define MAX_TYPE_VAL 1.0
> > > > > > +#define PIX_TYPE GLfloat
> > > > > > +#define TEX_TYPE GL_FLOAT
> > > > > > +#define TEX_INT_FMT GL_RGBA32F
> > > > > > #define TEX_FMT GL_RGBA
> > > > > > #define CHANNELS_PER_PIXEL 4
> > > > > This is changing the format of the texture we're testing with.
> > > > Yes, a higher resolution format is needed to hit the row pitch of
> > > > interest on the older gens which have a max width of 8K.
> > > > 
> > > > > In patch 3 I thought you wanted to make this configurable (through 
> > > > > arguments
> > > > > to the test maybe?), but this is just switching the format.
> > > > In patch 3, I attempted to make the test configurable via a group of
> > > > #defines.
> > > > 
> > > > > Why not add a command line parameter?
> > > > > 
> > > > I didn't want to add a command line parameter because there didn't seem
> > > > to be any benefit to doing so. By changing the format and width, we're
> > > > able to continue testing the issue in R300 as well as the teximage
> > > > upload and download paths of interest in i965. Thoughts?
> > > Not really, I was just wondering whether that format change would mean 
> > > that
> > > some driver wouldn't get tested anymore.
> > Sorry for not mentioning it in the cover letter, but we do lose testing
> > on i915 which doesn't support GL_ARB_texture_float. I didn't feel bad
> > about this because it's not actively developed and the test was written
> > to catch a regression in the R300 driver (which does support the
> > extension AFACIT). Is that okay with you?
> 
> Yeah, I just wasn't sure whether you thought about it :)
> 

Ah, okay :). Thanks for the reviews!

-Nanley

> > 
> > -Nanley
> > 
> > > I guess it's a common enough format that everybody probably supports it.
> > > 
> > > Thanks for the explanation :
> > > 
> > > 
> > > Reviewed-by: Lionel Landwerlin 
> > > 
> > > > -Nanley
> > > > 
> > > > > Thanks,
> > > > > 
> > > > > -
> > > > &g

Re: [Piglit] [PATCH v2 4/4] getteximage-simple: Stress an i965 blitter path

2018-06-20 Thread Nanley Chery
On Wed, Jun 20, 2018 at 06:32:58PM +0100, Lionel Landwerlin wrote:
> On 19/06/18 18:53, Nanley Chery wrote:
> > On Tue, Jun 19, 2018 at 11:03:17AM +0100, Lionel Landwerlin wrote:
> > > On 18/06/18 19:57, Nanley Chery wrote:
> > > > Change the dimension of the texture to test how i965 handles having a
> > > > row pitch too large for the BLT engine.
> > > > 
> > > > v2: Query the maximum supported texture width (Ilia Mirkin)
> > > > ---
> > > >tests/texturing/getteximage-simple.c | 25 +
> > > >1 file changed, 17 insertions(+), 8 deletions(-)
> > > > 
> > > > diff --git a/tests/texturing/getteximage-simple.c 
> > > > b/tests/texturing/getteximage-simple.c
> > > > index 525e6a392..5b87b7ccd 100644
> > > > --- a/tests/texturing/getteximage-simple.c
> > > > +++ b/tests/texturing/getteximage-simple.c
> > > > @@ -8,6 +8,10 @@
> > > > * texture images is executed before the readback.
> > > > *
> > > > * This used to crash for R300+bufmgr.
> > > > + *
> > > > + * This also used to stress test the blit methods in i965. The BLT 
> > > > engine only
> > > > + * supports pitch sizes up to but not including 32768 dwords. BLORP 
> > > > supports
> > > > + * even larger sizes.
> > > > */
> > > >#include "piglit-util-gl.h"
> > > > @@ -21,10 +25,10 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
> > > >PIGLIT_GL_TEST_CONFIG_END
> > > > -#define MAX_TYPE_VAL UINT8_MAX
> > > > -#define PIX_TYPE GLubyte
> > > > -#define TEX_TYPE GL_UNSIGNED_BYTE
> > > > -#define TEX_INT_FMT GL_RGBA8
> > > > +#define MAX_TYPE_VAL 1.0
> > > > +#define PIX_TYPE GLfloat
> > > > +#define TEX_TYPE GL_FLOAT
> > > > +#define TEX_INT_FMT GL_RGBA32F
> > > >#define TEX_FMT GL_RGBA
> > > >#define CHANNELS_PER_PIXEL 4
> > > This is changing the format of the texture we're testing with.
> > Yes, a higher resolution format is needed to hit the row pitch of
> > interest on the older gens which have a max width of 8K.
> > 
> > > In patch 3 I thought you wanted to make this configurable (through 
> > > arguments
> > > to the test maybe?), but this is just switching the format.
> > In patch 3, I attempted to make the test configurable via a group of
> > #defines.
> > 
> > > Why not add a command line parameter?
> > > 
> > I didn't want to add a command line parameter because there didn't seem
> > to be any benefit to doing so. By changing the format and width, we're
> > able to continue testing the issue in R300 as well as the teximage
> > upload and download paths of interest in i965. Thoughts?
> 
> Not really, I was just wondering whether that format change would mean that
> some driver wouldn't get tested anymore.

Sorry for not mentioning it in the cover letter, but we do lose testing
on i915 which doesn't support GL_ARB_texture_float. I didn't feel bad
about this because it's not actively developed and the test was written
to catch a regression in the R300 driver (which does support the
extension AFACIT). Is that okay with you?

-Nanley

> I guess it's a common enough format that everybody probably supports it.
> 
> Thanks for the explanation :
> 
> 
> Reviewed-by: Lionel Landwerlin 
> 
> > 
> > -Nanley
> > 
> > > Thanks,
> > > 
> > > -
> > > Lionel
> > > 
> > > > @@ -42,8 +46,8 @@ static bool test_getteximage(PIX_TYPE *data, size_t 
> > > > data_size, GLint w, GLint h)
> > > > const unsigned pixel_channel = i % 
> > > > CHANNELS_PER_PIXEL;
> > > > printf("GetTexImage() returns incorrect data in 
> > > > element %i\n", i);
> > > > printf("corresponding to (%i,%i) channel 
> > > > %i\n", pixel % w, pixel / w, pixel_channel);
> > > > -   printf("expected: %i\n", data[i]);
> > > > -   printf("got: %i\n", compare[i]);
> > > > +   printf("expected: %f\n", data[i]);
> > > > +   printf("got: %f\n", compare[i]);
> > > > match = false;
> > > > break;
> > > >  

Re: [Piglit] [PATCH v2 4/4] getteximage-simple: Stress an i965 blitter path

2018-06-19 Thread Nanley Chery
On Tue, Jun 19, 2018 at 11:03:17AM +0100, Lionel Landwerlin wrote:
> On 18/06/18 19:57, Nanley Chery wrote:
> > Change the dimension of the texture to test how i965 handles having a
> > row pitch too large for the BLT engine.
> > 
> > v2: Query the maximum supported texture width (Ilia Mirkin)
> > ---
> >   tests/texturing/getteximage-simple.c | 25 +
> >   1 file changed, 17 insertions(+), 8 deletions(-)
> > 
> > diff --git a/tests/texturing/getteximage-simple.c 
> > b/tests/texturing/getteximage-simple.c
> > index 525e6a392..5b87b7ccd 100644
> > --- a/tests/texturing/getteximage-simple.c
> > +++ b/tests/texturing/getteximage-simple.c
> > @@ -8,6 +8,10 @@
> >* texture images is executed before the readback.
> >*
> >* This used to crash for R300+bufmgr.
> > + *
> > + * This also used to stress test the blit methods in i965. The BLT engine 
> > only
> > + * supports pitch sizes up to but not including 32768 dwords. BLORP 
> > supports
> > + * even larger sizes.
> >*/
> >   #include "piglit-util-gl.h"
> > @@ -21,10 +25,10 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
> >   PIGLIT_GL_TEST_CONFIG_END
> > -#define MAX_TYPE_VAL UINT8_MAX
> > -#define PIX_TYPE GLubyte
> > -#define TEX_TYPE GL_UNSIGNED_BYTE
> > -#define TEX_INT_FMT GL_RGBA8
> > +#define MAX_TYPE_VAL 1.0
> > +#define PIX_TYPE GLfloat
> > +#define TEX_TYPE GL_FLOAT
> > +#define TEX_INT_FMT GL_RGBA32F
> >   #define TEX_FMT GL_RGBA
> >   #define CHANNELS_PER_PIXEL 4
> 
> This is changing the format of the texture we're testing with.

Yes, a higher resolution format is needed to hit the row pitch of
interest on the older gens which have a max width of 8K.

> In patch 3 I thought you wanted to make this configurable (through arguments
> to the test maybe?), but this is just switching the format.

In patch 3, I attempted to make the test configurable via a group of
#defines.

> Why not add a command line parameter?
> 

I didn't want to add a command line parameter because there didn't seem
to be any benefit to doing so. By changing the format and width, we're
able to continue testing the issue in R300 as well as the teximage
upload and download paths of interest in i965. Thoughts?

-Nanley

> Thanks,
> 
> -
> Lionel
> 
> > @@ -42,8 +46,8 @@ static bool test_getteximage(PIX_TYPE *data, size_t 
> > data_size, GLint w, GLint h)
> > const unsigned pixel_channel = i % CHANNELS_PER_PIXEL;
> > printf("GetTexImage() returns incorrect data in element 
> > %i\n", i);
> > printf("corresponding to (%i,%i) channel %i\n", 
> > pixel % w, pixel / w, pixel_channel);
> > -   printf("expected: %i\n", data[i]);
> > -   printf("got: %i\n", compare[i]);
> > +   printf("expected: %f\n", data[i]);
> > +   printf("got: %f\n", compare[i]);
> > match = false;
> > break;
> > }
> > @@ -53,11 +57,13 @@ static bool test_getteximage(PIX_TYPE *data, size_t 
> > data_size, GLint w, GLint h)
> > return match;
> >   }
> > +
> >   enum piglit_result
> >   piglit_display(void)
> >   {
> > -   GLsizei height = 16;
> > -   GLsizei width = 64;
> > +   GLsizei height = 2;
> > +   GLsizei width;
> > +   glGetIntegerv(GL_MAX_TEXTURE_SIZE, );
> > /* Upload random data to a texture with the given dimensions */
> > const unsigned data_channels = width * height * CHANNELS_PER_PIXEL;
> > @@ -94,6 +100,9 @@ piglit_display(void)
> >   void piglit_init(int argc, char **argv)
> >   {
> > +   if (TEX_TYPE == GL_FLOAT)
> > +   piglit_require_extension("GL_ARB_texture_float");
> > +
> > GLuint tex;
> > glGenTextures(1, );
> 
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 3/4] getteximage-simple: Allow configurable texture parameters

2018-06-18 Thread Nanley Chery
We'd like to increase the pitch of the texture in the next patch.
---
 tests/texturing/getteximage-simple.c | 54 ++--
 1 file changed, 35 insertions(+), 19 deletions(-)

diff --git a/tests/texturing/getteximage-simple.c 
b/tests/texturing/getteximage-simple.c
index de0f1edf6..525e6a392 100644
--- a/tests/texturing/getteximage-simple.c
+++ b/tests/texturing/getteximage-simple.c
@@ -21,38 +21,52 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
-static int test_getteximage(GLubyte *data)
+#define MAX_TYPE_VAL UINT8_MAX
+#define PIX_TYPE GLubyte
+#define TEX_TYPE GL_UNSIGNED_BYTE
+#define TEX_INT_FMT GL_RGBA8
+#define TEX_FMT GL_RGBA
+#define CHANNELS_PER_PIXEL 4
+
+static bool test_getteximage(PIX_TYPE *data, size_t data_size, GLint w, GLint 
h)
 {
-   GLubyte compare[4096];
-   int i;
+   PIX_TYPE *compare = (PIX_TYPE *)malloc(data_size);
 
-   glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, compare);
+   glGetTexImage(GL_TEXTURE_2D, 0, TEX_FMT, TEX_TYPE, compare);
 
-   for(i = 0; i < 4096; ++i) {
+   bool match = true;
+   const unsigned data_channels = w * h / CHANNELS_PER_PIXEL;
+   for (unsigned i = 0; i < data_channels; ++i) {
if (data[i] != compare[i]) {
-   const unsigned pixel = i / 4;
-   const unsigned channel = i % 4;
-   printf("GetTexImage() returns incorrect data in byte 
%i\n", i);
-   printf("corresponding to (%i,%i) channel %i\n", 
pixel % 64, pixel / 64, channel);
+   const unsigned pixel = i / CHANNELS_PER_PIXEL;
+   const unsigned pixel_channel = i % CHANNELS_PER_PIXEL;
+   printf("GetTexImage() returns incorrect data in element 
%i\n", i);
+   printf("corresponding to (%i,%i) channel %i\n", 
pixel % w, pixel / w, pixel_channel);
printf("expected: %i\n", data[i]);
printf("got: %i\n", compare[i]);
-   return 0;
+   match = false;
+   break;
}
}
 
-   return 1;
+   free(compare);
+   return match;
 }
 
 enum piglit_result
 piglit_display(void)
 {
-   int pass;
-
-   GLubyte data[4096]; /* 64*16*4 */
-   for(int i = 0; i < 4096; ++i)
-   data[i] = rand() & 0xff;
-
-   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 16, 0, GL_RGBA, 
GL_UNSIGNED_BYTE, data);
+   GLsizei height = 16;
+   GLsizei width = 64;
+
+   /* Upload random data to a texture with the given dimensions */
+   const unsigned data_channels = width * height * CHANNELS_PER_PIXEL;
+   const size_t data_size = data_channels * sizeof(PIX_TYPE);
+   PIX_TYPE *data = (PIX_TYPE *)malloc(data_size);
+   for (unsigned i = 0; i < data_channels; ++i)
+   data[i] = ((float)rand() / RAND_MAX) * MAX_TYPE_VAL;
+   glTexImage2D(GL_TEXTURE_2D, 0, TEX_INT_FMT, width, height, 0, TEX_FMT,
+TEX_TYPE, data);
 
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -71,7 +85,9 @@ piglit_display(void)
 
piglit_present_results();
 
-   pass = test_getteximage();
+   bool pass = test_getteximage(data, data_size, width, height);
+
+   free(data);
 
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
-- 
2.17.1

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


[Piglit] [PATCH v2 4/4] getteximage-simple: Stress an i965 blitter path

2018-06-18 Thread Nanley Chery
Change the dimension of the texture to test how i965 handles having a
row pitch too large for the BLT engine.

v2: Query the maximum supported texture width (Ilia Mirkin)
---
 tests/texturing/getteximage-simple.c | 25 +
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/tests/texturing/getteximage-simple.c 
b/tests/texturing/getteximage-simple.c
index 525e6a392..5b87b7ccd 100644
--- a/tests/texturing/getteximage-simple.c
+++ b/tests/texturing/getteximage-simple.c
@@ -8,6 +8,10 @@
  * texture images is executed before the readback.
  *
  * This used to crash for R300+bufmgr.
+ *
+ * This also used to stress test the blit methods in i965. The BLT engine only
+ * supports pitch sizes up to but not including 32768 dwords. BLORP supports
+ * even larger sizes.
  */
 
 #include "piglit-util-gl.h"
@@ -21,10 +25,10 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
-#define MAX_TYPE_VAL UINT8_MAX
-#define PIX_TYPE GLubyte
-#define TEX_TYPE GL_UNSIGNED_BYTE
-#define TEX_INT_FMT GL_RGBA8
+#define MAX_TYPE_VAL 1.0
+#define PIX_TYPE GLfloat
+#define TEX_TYPE GL_FLOAT
+#define TEX_INT_FMT GL_RGBA32F
 #define TEX_FMT GL_RGBA
 #define CHANNELS_PER_PIXEL 4
 
@@ -42,8 +46,8 @@ static bool test_getteximage(PIX_TYPE *data, size_t 
data_size, GLint w, GLint h)
const unsigned pixel_channel = i % CHANNELS_PER_PIXEL;
printf("GetTexImage() returns incorrect data in element 
%i\n", i);
printf("corresponding to (%i,%i) channel %i\n", 
pixel % w, pixel / w, pixel_channel);
-   printf("expected: %i\n", data[i]);
-   printf("got: %i\n", compare[i]);
+   printf("expected: %f\n", data[i]);
+   printf("got: %f\n", compare[i]);
match = false;
break;
}
@@ -53,11 +57,13 @@ static bool test_getteximage(PIX_TYPE *data, size_t 
data_size, GLint w, GLint h)
return match;
 }
 
+
 enum piglit_result
 piglit_display(void)
 {
-   GLsizei height = 16;
-   GLsizei width = 64;
+   GLsizei height = 2;
+   GLsizei width;
+   glGetIntegerv(GL_MAX_TEXTURE_SIZE, );
 
/* Upload random data to a texture with the given dimensions */
const unsigned data_channels = width * height * CHANNELS_PER_PIXEL;
@@ -94,6 +100,9 @@ piglit_display(void)
 
 void piglit_init(int argc, char **argv)
 {
+   if (TEX_TYPE == GL_FLOAT)
+   piglit_require_extension("GL_ARB_texture_float");
+
GLuint tex;
 
glGenTextures(1, );
-- 
2.17.1

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


[Piglit] [PATCH v2 1/4] getteximage-simple: Fix the coordinate printf

2018-06-18 Thread Nanley Chery
---
 tests/texturing/getteximage-simple.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/texturing/getteximage-simple.c 
b/tests/texturing/getteximage-simple.c
index 273f2b36c..e86e7b25e 100644
--- a/tests/texturing/getteximage-simple.c
+++ b/tests/texturing/getteximage-simple.c
@@ -32,8 +32,10 @@ static int test_getteximage(void)
 
for(i = 0; i < 4096; ++i) {
if (data[i] != compare[i]) {
+   const unsigned pixel = i / 4;
+   const unsigned channel = i % 4;
printf("GetTexImage() returns incorrect data in byte 
%i\n", i);
-   printf("corresponding to (%i,%i) channel %i\n", i / 
64, (i / 4) % 16, i % 4);
+   printf("corresponding to (%i,%i) channel %i\n", 
pixel % 64, pixel / 64, channel);
printf("expected: %i\n", data[i]);
printf("got: %i\n", compare[i]);
return 0;
-- 
2.17.1

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


[Piglit] [PATCH v2 0/4] Stress an i965 blitter path

2018-06-18 Thread Nanley Chery
This series modifies getteximage-simple to work on a texture of maximum
width. This enables us to test an existing fallback path for i965 which
changes the texture's tiling to linear. It also enables us to test an
alternative fallback path [1] which keeps the texture's tiling.

This works on all GEN hardware, but on gen4 we run into the floating
point texture values being a tad off. This isn't a new problem as that
platform also fails another floating point teximage test. This test
passes on gen4 if I change the texture to be an integer format. We lose
the interesting pattern if I do so, however. I don't mind changing the
format if people prefer.

1. https://patchwork.freedesktop.org/patch/226092/

Nanley Chery (4):
  getteximage-simple: Fix the coordinate printf
  getteximage-simple: Switch to parameter passing
  getteximage-simple: Allow configurable texture parameters
  getteximage-simple: Stress an i965 blitter path

 tests/texturing/getteximage-simple.c | 64 +++-
 1 file changed, 45 insertions(+), 19 deletions(-)

-- 
2.17.1

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


[Piglit] [PATCH v2 2/4] getteximage-simple: Switch to parameter passing

2018-06-18 Thread Nanley Chery
This will enable dynamically allocating the texture data with variable
texture dimensions.
---
 tests/texturing/getteximage-simple.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/tests/texturing/getteximage-simple.c 
b/tests/texturing/getteximage-simple.c
index e86e7b25e..de0f1edf6 100644
--- a/tests/texturing/getteximage-simple.c
+++ b/tests/texturing/getteximage-simple.c
@@ -21,9 +21,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
-static GLubyte data[4096]; /* 64*16*4 */
-
-static int test_getteximage(void)
+static int test_getteximage(GLubyte *data)
 {
GLubyte compare[4096];
int i;
@@ -50,6 +48,12 @@ piglit_display(void)
 {
int pass;
 
+   GLubyte data[4096]; /* 64*16*4 */
+   for(int i = 0; i < 4096; ++i)
+   data[i] = rand() & 0xff;
+
+   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 16, 0, GL_RGBA, 
GL_UNSIGNED_BYTE, data);
+
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
@@ -75,16 +79,11 @@ piglit_display(void)
 void piglit_init(int argc, char **argv)
 {
GLuint tex;
-   int i;
-
-   for(i = 0; i < 4096; ++i)
-   data[i] = rand() & 0xff;
 
glGenTextures(1, );
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 16, 0, GL_RGBA, 
GL_UNSIGNED_BYTE, data);
 
piglit_gen_ortho_projection(0.0, 1.0, 0.0, 1.0, -2.0, 6.0, GL_FALSE);
 }
-- 
2.17.1

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


Re: [Piglit] [PATCH] getteximage-simple: Stress an i965 blitter path

2018-05-30 Thread Nanley Chery
On Wed, May 30, 2018 at 05:44:26PM -0400, Ilia Mirkin wrote:
> Not all hardware supports 32K-wide textures. I believe GL's minimum
> requirement is in the 4K range -- not 100% sure. There's a query for
> it that you can use.
> 

Thanks for the heads up about the minimum requirement of the max texture
size. The minimum in GL 1.0 is 64 pixels, for GL 4.5 it's 16384 pixels.
This test allocates a texture that is 8192 pixels wide. Maybe using the
query is the best way to go about this. I'll take a closer look.

-Nanley

> On Wed, May 30, 2018 at 4:39 PM, Nanley Chery  wrote:
> > Change the dimension of the texture to test how i965 handles having a
> > row pitch too large for the BLT engine.
> > ---
> >  tests/texturing/getteximage-simple.c | 23 +--
> >  1 file changed, 17 insertions(+), 6 deletions(-)
> >
> > diff --git a/tests/texturing/getteximage-simple.c 
> > b/tests/texturing/getteximage-simple.c
> > index 273f2b36c..9a3678acf 100644
> > --- a/tests/texturing/getteximage-simple.c
> > +++ b/tests/texturing/getteximage-simple.c
> > @@ -8,6 +8,10 @@
> >   * texture images is executed before the readback.
> >   *
> >   * This used to crash for R300+bufmgr.
> > + *
> > + * This also used to stress test the blit methods in i965. The BLT engine 
> > only
> > + * supports pitch sizes up to but not including 32768 bytes. BLORP supports
> > + * even larger sizes.
> >   */
> >
> >  #include "piglit-util-gl.h"
> > @@ -21,19 +25,26 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
> >
> >  PIGLIT_GL_TEST_CONFIG_END
> >
> > -static GLubyte data[4096]; /* 64*16*4 */
> > +#define BYTES_PER_PIXEL 4
> > +#define WIDTH (32768 / BYTES_PER_PIXEL)
> > +#define HEIGHT 2 // Ensure that the pitch is used without using too much 
> > memory
> > +#define IMAGE_SIZE (WIDTH * BYTES_PER_PIXEL * HEIGHT)
> > +
> > +static GLubyte data[IMAGE_SIZE];
> >
> >  static int test_getteximage(void)
> >  {
> > -   GLubyte compare[4096];
> > +   GLubyte compare[IMAGE_SIZE];
> > int i;
> >
> > glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, compare);
> >
> > -   for(i = 0; i < 4096; ++i) {
> > +   for(i = 0; i < IMAGE_SIZE; ++i) {
> > if (data[i] != compare[i]) {
> > printf("GetTexImage() returns incorrect data in 
> > byte %i\n", i);
> > -   printf("corresponding to (%i,%i) channel %i\n", 
> > i / 64, (i / 4) % 16, i % 4);
> > +   printf("corresponding to (%i,%i) channel %i\n",
> > +  i / WIDTH, (i / BYTES_PER_PIXEL) % HEIGHT,
> > +  i % BYTES_PER_PIXEL);
> > printf("expected: %i\n", data[i]);
> > printf("got: %i\n", compare[i]);
> > return 0;
> > @@ -75,14 +86,14 @@ void piglit_init(int argc, char **argv)
> > GLuint tex;
> > int i;
> >
> > -   for(i = 0; i < 4096; ++i)
> > +   for(i = 0; i < IMAGE_SIZE; ++i)
> > data[i] = rand() & 0xff;
> >
> > glGenTextures(1, );
> > glBindTexture(GL_TEXTURE_2D, tex);
> > glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
> > glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
> > -   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 16, 0, GL_RGBA, 
> > GL_UNSIGNED_BYTE, data);
> > +   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, WIDTH, HEIGHT, 0, GL_RGBA, 
> > GL_UNSIGNED_BYTE, data);
> >
> > piglit_gen_ortho_projection(0.0, 1.0, 0.0, 1.0, -2.0, 6.0, 
> > GL_FALSE);
> >  }
> > --
> > 2.17.0
> >
> > ___
> > Piglit mailing list
> > Piglit@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] getteximage-simple: Stress an i965 blitter path

2018-05-30 Thread Nanley Chery
Change the dimension of the texture to test how i965 handles having a
row pitch too large for the BLT engine.
---
 tests/texturing/getteximage-simple.c | 23 +--
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/tests/texturing/getteximage-simple.c 
b/tests/texturing/getteximage-simple.c
index 273f2b36c..9a3678acf 100644
--- a/tests/texturing/getteximage-simple.c
+++ b/tests/texturing/getteximage-simple.c
@@ -8,6 +8,10 @@
  * texture images is executed before the readback.
  *
  * This used to crash for R300+bufmgr.
+ *
+ * This also used to stress test the blit methods in i965. The BLT engine only
+ * supports pitch sizes up to but not including 32768 bytes. BLORP supports
+ * even larger sizes.
  */
 
 #include "piglit-util-gl.h"
@@ -21,19 +25,26 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
-static GLubyte data[4096]; /* 64*16*4 */
+#define BYTES_PER_PIXEL 4
+#define WIDTH (32768 / BYTES_PER_PIXEL)
+#define HEIGHT 2 // Ensure that the pitch is used without using too much memory
+#define IMAGE_SIZE (WIDTH * BYTES_PER_PIXEL * HEIGHT)
+
+static GLubyte data[IMAGE_SIZE];
 
 static int test_getteximage(void)
 {
-   GLubyte compare[4096];
+   GLubyte compare[IMAGE_SIZE];
int i;
 
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, compare);
 
-   for(i = 0; i < 4096; ++i) {
+   for(i = 0; i < IMAGE_SIZE; ++i) {
if (data[i] != compare[i]) {
printf("GetTexImage() returns incorrect data in byte 
%i\n", i);
-   printf("corresponding to (%i,%i) channel %i\n", i / 
64, (i / 4) % 16, i % 4);
+   printf("corresponding to (%i,%i) channel %i\n",
+  i / WIDTH, (i / BYTES_PER_PIXEL) % HEIGHT,
+  i % BYTES_PER_PIXEL);
printf("expected: %i\n", data[i]);
printf("got: %i\n", compare[i]);
return 0;
@@ -75,14 +86,14 @@ void piglit_init(int argc, char **argv)
GLuint tex;
int i;
 
-   for(i = 0; i < 4096; ++i)
+   for(i = 0; i < IMAGE_SIZE; ++i)
data[i] = rand() & 0xff;
 
glGenTextures(1, );
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 16, 0, GL_RGBA, 
GL_UNSIGNED_BYTE, data);
+   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, WIDTH, HEIGHT, 0, GL_RGBA, 
GL_UNSIGNED_BYTE, data);
 
piglit_gen_ortho_projection(0.0, 1.0, 0.0, 1.0, -2.0, 6.0, GL_FALSE);
 }
-- 
2.17.0

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


[Piglit] [PATCH 1/3] tex-srgb: Also test a cleared texture

2018-03-30 Thread Nanley Chery
Test sRGB texturing on a cleared texture. This case is of interest
to Intel GPUs, which will fast-clear the texture.
---
 tests/texturing/tex-srgb.c | 45 +
 1 file changed, 29 insertions(+), 16 deletions(-)

diff --git a/tests/texturing/tex-srgb.c b/tests/texturing/tex-srgb.c
index fa15ef665..96e92a1ff 100644
--- a/tests/texturing/tex-srgb.c
+++ b/tests/texturing/tex-srgb.c
@@ -68,27 +68,35 @@ nonlinear_to_linear(GLubyte cs8)
return table[cs8];
 }
 
-static void fill_level(int level, const GLfloat *color)
+static void fill_level(GLuint tex, int level, const GLfloat *color,
+  bool with_clear)
 {
 GLfloat *data;
 int size = SIZE / (1 << level);
 int i;
 
-/* Update a square inside the texture to red */
-data = malloc(size * size * 4 * sizeof(GLfloat));
-for (i = 0; i < 4 * size * size; i += 4) {
-data[i + 0] = color[0];
-data[i + 1] = color[1];
-data[i + 2] = color[2];
-data[i + 3] = color[3];
-}
-glTexImage2D(GL_TEXTURE_2D, level, GL_SRGB8_ALPHA8, size, size, 0,
- GL_RGBA, GL_FLOAT, data);
-free(data);
+   glBindTexture(GL_TEXTURE_2D, tex);
+   if (with_clear) {
+   glTexImage2D(GL_TEXTURE_2D, level, GL_SRGB8_ALPHA8, size, size,
+0, GL_RGBA, GL_FLOAT, NULL);
+   glClearTexImage(tex, level, GL_RGBA, GL_FLOAT, color);
+   } else {
+   /* Update a square inside the texture to red */
+   data = malloc(size * size * 4 * sizeof(GLfloat));
+   for (i = 0; i < 4 * size * size; i += 4) {
+   data[i + 0] = color[0];
+   data[i + 1] = color[1];
+   data[i + 2] = color[2];
+   data[i + 3] = color[3];
+   }
+   glTexImage2D(GL_TEXTURE_2D, level, GL_SRGB8_ALPHA8, size, size,
+0, GL_RGBA, GL_FLOAT, data);
+   free(data);
+   }
 }
 
 static GLboolean
-srgb_tex_test(int srgb_format)
+srgb_tex_test(bool with_clear)
 {
GLboolean pass = GL_TRUE;
float green[] = {0, 0.3, 0.0, 0};
@@ -101,9 +109,9 @@ srgb_tex_test(int srgb_format)
 
glGenTextures(1, );
 
-   glBindTexture(GL_TEXTURE_2D, tex);
+   fill_level(tex, 0, green, with_clear);
 
-   fill_level(0, green);
+   glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
@@ -154,7 +162,12 @@ piglit_display(void)
 {
GLboolean pass = GL_TRUE;
 
-   pass = srgb_tex_test(0);
+   pass = srgb_tex_test(false);
+
+   if (piglit_is_extension_supported("GL_ARB_clear_texture")) {
+   /* This case is of particular interest to Intel GPUs */
+   pass &= srgb_tex_test(true);
+   }
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-- 
2.16.2

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


[Piglit] [PATCH 3/3] arb_framebuffer_srgb/blit: Add source fill modes

2018-03-30 Thread Nanley Chery
Test how blits behave when the source is cleared. This case is of
interest to Intel GPUs, which will fast-clear the source.
---
 tests/all.py   | 12 +++-
 tests/spec/arb_framebuffer_srgb/blit.c | 35 +++---
 2 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 7c8580ef0..39ad46926 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2026,11 +2026,13 @@ with profile.test_list.group_manager(
   'msaa', 'scaled'):
 for framebuffer_srgb_setting in ('enabled',
  'disabled'):
-g(['arb_framebuffer_srgb-blit', backing_type, srgb_types,
-blit_type, framebuffer_srgb_setting],
-  'blit {} {} {} {}'.format(
-  backing_type, srgb_types, blit_type,
-  framebuffer_srgb_setting))
+for src_fill_mode in ('clear', 'render'):
+g(['arb_framebuffer_srgb-blit', backing_type,
+srgb_types, blit_type, framebuffer_srgb_setting,
+src_fill_mode],
+  'blit {} {} {} {} {}'.format(
+  backing_type, srgb_types, blit_type,
+  framebuffer_srgb_setting, src_fill_mode))
 g(['framebuffer-srgb'], run_concurrent=False)
 g(['arb_framebuffer_srgb-clear'])
 g(['arb_framebuffer_srgb-pushpop'])
diff --git a/tests/spec/arb_framebuffer_srgb/blit.c 
b/tests/spec/arb_framebuffer_srgb/blit.c
index b5bd72b97..de218dbd0 100644
--- a/tests/spec/arb_framebuffer_srgb/blit.c
+++ b/tests/spec/arb_framebuffer_srgb/blit.c
@@ -177,6 +177,7 @@
 
 const int PATTERN_WIDTH = 256;
 const int PATTERN_HEIGHT = 64;
+const float src_clear_col = 128.0 / 255.0;
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
@@ -195,6 +196,7 @@ static GLsizei src_samples;
 static GLsizei dst_samples;
 static bool scaled_blit;
 static bool enable_srgb_framebuffer;
+static bool src_fill_mode_clear;
 
 /* GL objects */
 static GLuint src_fbo;
@@ -258,6 +260,7 @@ print_usage_and_exit(char *prog_name)
 {
printf("Usage: %s   \n"
   "  \n"
+  "  \n"
   "  where  is one of:\n"
   "texture (ignored for multisampled framebuffers)\n"
   "renderbuffer\n"
@@ -274,7 +277,10 @@ print_usage_and_exit(char *prog_name)
   "scaled\n"
   "  where framebuffer_srgb_setting is one of:\n"
   "enabled\n"
-  "disabled\n",
+  "disabled\n"
+  "  where src_fill_mode is one of:\n"
+  "clear\n"
+  "render\n",
   prog_name);
piglit_report_result(PIGLIT_FAIL);
 }
@@ -284,7 +290,7 @@ piglit_init(int argc, char **argv)
 {
GLint max_samples;
 
-   if (argc != 5) {
+   if (argc != 6) {
print_usage_and_exit(argv[0]);
}
 
@@ -344,6 +350,14 @@ piglit_init(int argc, char **argv)
print_usage_and_exit(argv[0]);
}
 
+   if (strcmp(argv[5], "clear") == 0) {
+   src_fill_mode_clear = true;
+   } else if (strcmp(argv[5], "render") == 0) {
+   src_fill_mode_clear = false;
+   } else {
+   print_usage_and_exit(argv[0]);
+   }
+
piglit_require_gl_version(21);
piglit_require_extension("GL_ARB_framebuffer_object");
piglit_require_extension("GL_ARB_framebuffer_sRGB");
@@ -401,7 +415,8 @@ analyze_image(GLuint fbo)
for (y = 0; y < PATTERN_HEIGHT; ++y) {
for (x = 0; x < PATTERN_WIDTH; ++x) {
for (component = 0; component < 4; ++component) {
-   float val = x / 255.0;
+   float val = src_fill_mode_clear ?
+   src_clear_col : x / 255.0;
if (component < 3 && enable_srgb_framebuffer) {
if (src_format == GL_SRGB8_ALPHA8)
val = srgb_to_linear(val);
@@ -437,12 +452,18 @@ piglit_display()
}
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dst_fbo);
glClear(GL_COLOR_BUFFER_BIT);
-   glBindFramebuffer(GL_DRAW_FRAMEBUFFER, src_fbo);
-   glClear(GL_COLOR_BUFFER_BIT);
 
/* Draw the source image */
-   glViewport(0, 0, PATTERN_WIDTH, PATTERN_HEIGHT);
-   piglit_draw_rect(-1, -1, 2, 2);
+   glBindFramebuffer(GL_DRAW_FRAMEBUFFER, src_fbo);
+   if (src_fill_mode_clear) {
+   /* This case is of particular interest to Intel GPUs. */
+   glClearColor(src_clear_col, src_clear_col,
+src_clear_col, src_clear_col);
+   glClear(GL_COLOR_BUFFER_BIT);
+   } else {
+ 

[Piglit] [PATCH 2/3] tex-srgb: Drop unused variables and a stale comment

2018-03-30 Thread Nanley Chery
---
 tests/texturing/tex-srgb.c | 21 -
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/tests/texturing/tex-srgb.c b/tests/texturing/tex-srgb.c
index 96e92a1ff..2fd8d6b96 100644
--- a/tests/texturing/tex-srgb.c
+++ b/tests/texturing/tex-srgb.c
@@ -68,28 +68,23 @@ nonlinear_to_linear(GLubyte cs8)
return table[cs8];
 }
 
-static void fill_level(GLuint tex, int level, const GLfloat *color,
-  bool with_clear)
+static void fill_level(GLuint tex, const GLfloat *color, bool with_clear)
 {
-GLfloat *data;
-int size = SIZE / (1 << level);
-int i;
-
glBindTexture(GL_TEXTURE_2D, tex);
if (with_clear) {
-   glTexImage2D(GL_TEXTURE_2D, level, GL_SRGB8_ALPHA8, size, size,
+   glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, SIZE, SIZE,
 0, GL_RGBA, GL_FLOAT, NULL);
-   glClearTexImage(tex, level, GL_RGBA, GL_FLOAT, color);
+   glClearTexImage(tex, 0, GL_RGBA, GL_FLOAT, color);
} else {
-   /* Update a square inside the texture to red */
-   data = malloc(size * size * 4 * sizeof(GLfloat));
-   for (i = 0; i < 4 * size * size; i += 4) {
+   GLfloat *data = malloc(SIZE * SIZE * 4 * sizeof(GLfloat));
+   int i;
+   for (i = 0; i < 4 * SIZE * SIZE; i += 4) {
data[i + 0] = color[0];
data[i + 1] = color[1];
data[i + 2] = color[2];
data[i + 3] = color[3];
}
-   glTexImage2D(GL_TEXTURE_2D, level, GL_SRGB8_ALPHA8, size, size,
+   glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, SIZE, SIZE,
 0, GL_RGBA, GL_FLOAT, data);
free(data);
}
@@ -109,7 +104,7 @@ srgb_tex_test(bool with_clear)
 
glGenTextures(1, );
 
-   fill_level(tex, 0, green, with_clear);
+   fill_level(tex, green, with_clear);
 
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
-- 
2.16.2

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


[Piglit] [PATCH 1/2] s3tc-targeted: Reduce requirements to the minimal set

2017-07-21 Thread Nanley Chery
Enable this test to run on more system configurations.

Suggested-by: Ian Romanick <i...@freedesktop.org>
Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 tests/texturing/s3tc-targeted.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/texturing/s3tc-targeted.c b/tests/texturing/s3tc-targeted.c
index 179ea27af..c8e3f4bde 100644
--- a/tests/texturing/s3tc-targeted.c
+++ b/tests/texturing/s3tc-targeted.c
@@ -35,8 +35,8 @@
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-   /* We need OpenGL 1.3 for the *TexImage* functions used in this file. */
-   config.supports_gl_compat_version = 13;
+   /* We need OpenGL 1.1 for GL_EXT_texture_compression_s3tc */
+   config.supports_gl_compat_version = 11;
config.requires_displayed_window = false;
 
 PIGLIT_GL_TEST_CONFIG_END
@@ -46,8 +46,8 @@ test_block(GLenum internal_fmt, const char * base_fmt_str,
   const uint8_t * dxt1_block, uint16_t expected_result)
 {
/* Upload the DXT1 block. */
-   glCompressedTexImage2D(GL_TEXTURE_2D, 0, internal_fmt, 1, 1, 0,
-  8 /* 64 bits */, dxt1_block);
+   glCompressedTexImage2DARB(GL_TEXTURE_2D, 0, internal_fmt, 1, 1, 0,
+ 8 /* 64 bits */, dxt1_block);
 
/* Decompress the only defined pixel in the DXT1 block. */
uint16_t actual_pixel = 0xBEEF;
-- 
2.13.3

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


[Piglit] [PATCH 2/2] s3tc-targeted: Execute every test case

2017-07-21 Thread Nanley Chery
Continuing to run the tests after one fails provides helpful information
when debugging.

Suggested-by: Ian Romanick <i...@freedesktop.org>
Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 tests/texturing/s3tc-targeted.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/texturing/s3tc-targeted.c b/tests/texturing/s3tc-targeted.c
index c8e3f4bde..b4553ceeb 100644
--- a/tests/texturing/s3tc-targeted.c
+++ b/tests/texturing/s3tc-targeted.c
@@ -82,10 +82,10 @@ piglit_display(void)
const uint8_t black_block[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x03, };
const uint8_t one_third_block[8] = { 0xFF, 0xFF,0,0, 0x03, };
 
-   const bool pass = TEST(RGB , black_block, 0x000F) &&
- TEST(RGBA, black_block, 0x) &&
- TEST(RGB , one_third_block, 0x555F) &&
- TEST(RGBA, one_third_block, 0x555F);
+   bool pass = TEST(RGB , black_block, 0x000F);
+   pass = TEST(RGBA, black_block, 0x) && pass;
+   pass = TEST(RGB , one_third_block, 0x555F) && pass;
+   pass = TEST(RGBA, one_third_block, 0x555F) && pass;
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-- 
2.13.3

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


Re: [Piglit] [PATCH] texturing: Add decompression test for S3TC DXT1

2017-07-21 Thread Nanley Chery
On Wed, May 31, 2017 at 12:53:31PM -0700, Ian Romanick wrote:
> On 05/15/2017 04:08 PM, Nanley Chery wrote:
> > Cc: Kenneth Graunke <kenn...@whitecape.org>
> > Cc: Mark Janes <mark.a.ja...@intel.com>
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100925
> > Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
> > ---
> >  tests/all.py  |  1 +
> >  tests/texturing/CMakeLists.gl.txt |  1 +
> >  tests/texturing/s3tc-targeted.c   | 99 
> > +++
> >  3 files changed, 101 insertions(+)
> >  create mode 100644 tests/texturing/s3tc-targeted.c
> > 
> > diff --git a/tests/all.py b/tests/all.py
> > index 49a8c9fbe..38aabc103 100644
> > --- a/tests/all.py
> > +++ b/tests/all.py
> > @@ -3303,6 +3303,7 @@ with profile.test_list.group_manager(
> >  g(['arb_texture_compression-invalid-formats', 's3tc'], 'invalid 
> > formats')
> >  g(['gen-compressed-teximage'], run_concurrent=False)
> >  g(['s3tc-errors'])
> > +g(['s3tc-targeted'])
> >  g(['s3tc-teximage'], run_concurrent=False)
> >  g(['s3tc-texsubimage'], run_concurrent=False)
> >  g(['getteximage-targets', '2D', 'S3TC'])
> > diff --git a/tests/texturing/CMakeLists.gl.txt 
> > b/tests/texturing/CMakeLists.gl.txt
> > index 9ab4d7ac8..e5d41e432 100644
> > --- a/tests/texturing/CMakeLists.gl.txt
> > +++ b/tests/texturing/CMakeLists.gl.txt
> > @@ -64,6 +64,7 @@ ENDIF (UNIX)
> >  piglit_add_executable (s3tc-teximage s3tc-teximage.c)
> >  piglit_add_executable (fxt1-teximage fxt1-teximage.c)
> >  piglit_add_executable (s3tc-texsubimage s3tc-texsubimage.c)
> > +piglit_add_executable (s3tc-targeted s3tc-targeted.c)
> >  piglit_add_executable (s3tc-errors s3tc-errors.c)
> >  piglit_add_executable (sampler-cube-shadow sampler-cube-shadow.c)
> >  piglit_add_executable (streaming-texture-leak streaming-texture-leak.c)
> > diff --git a/tests/texturing/s3tc-targeted.c 
> > b/tests/texturing/s3tc-targeted.c
> > new file mode 100644
> > index 0..b86a326dc
> > --- /dev/null
> > +++ b/tests/texturing/s3tc-targeted.c
> > @@ -0,0 +1,99 @@
> > +/*
> > + * Copyright © 2017 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 s3tc-targeted.c
> > + *
> > + * Tests the cases of S3TC DXT1 decompression in which the bitmap contains 
> > the
> > + * value b'11. The chosen tests help to determine that the color comparison
> > + * portion of decompression works correctly and that any internal driver
> > + * swizzling of the alpha channel is performed correctly.
> > + *
> > + * Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100925
> > + */
> > +
> > +#include "piglit-util-gl.h"
> > +
> > +PIGLIT_GL_TEST_CONFIG_BEGIN
> > +
> > +   /* We need OpenGL 1.3 for the *TexImage* functions used in this file. */
> 
> I'm assuming you mean glCompressed*TexImage* functions?  An alternative
> would be to require GL_ARB_texture_compression and use the functions
> with ARB suffixes.
> 

Yes, and that's a good point. I actually wouldn't even need to require
GL_ARB_texture_compression since GL_EXT_texture_compression_s3tc
requires it.

> > +   config.supports_gl_compat

Re: [Piglit] [PATCH 1/7] appveyro: Remove help invocation from cmake

2017-06-15 Thread Nanley Chery
The appveyor tag is misspelled.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] texturing: Add decompression test for S3TC DXT1

2017-05-16 Thread Nanley Chery
On Mon, May 15, 2017 at 04:08:54PM -0700, Nanley Chery wrote:
> Cc: Kenneth Graunke <kenn...@whitecape.org>
> Cc: Mark Janes <mark.a.ja...@intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100925
> Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
> ---
>  tests/all.py  |  1 +
>  tests/texturing/CMakeLists.gl.txt |  1 +
>  tests/texturing/s3tc-targeted.c   | 99 
> +++
>  3 files changed, 101 insertions(+)
>  create mode 100644 tests/texturing/s3tc-targeted.c
> 
> diff --git a/tests/all.py b/tests/all.py
> index 49a8c9fbe..38aabc103 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -3303,6 +3303,7 @@ with profile.test_list.group_manager(
>  g(['arb_texture_compression-invalid-formats', 's3tc'], 'invalid formats')
>  g(['gen-compressed-teximage'], run_concurrent=False)
>  g(['s3tc-errors'])
> +g(['s3tc-targeted'])
>  g(['s3tc-teximage'], run_concurrent=False)
>  g(['s3tc-texsubimage'], run_concurrent=False)
>  g(['getteximage-targets', '2D', 'S3TC'])
> diff --git a/tests/texturing/CMakeLists.gl.txt 
> b/tests/texturing/CMakeLists.gl.txt
> index 9ab4d7ac8..e5d41e432 100644
> --- a/tests/texturing/CMakeLists.gl.txt
> +++ b/tests/texturing/CMakeLists.gl.txt
> @@ -64,6 +64,7 @@ ENDIF (UNIX)
>  piglit_add_executable (s3tc-teximage s3tc-teximage.c)
>  piglit_add_executable (fxt1-teximage fxt1-teximage.c)
>  piglit_add_executable (s3tc-texsubimage s3tc-texsubimage.c)
> +piglit_add_executable (s3tc-targeted s3tc-targeted.c)
>  piglit_add_executable (s3tc-errors s3tc-errors.c)
>  piglit_add_executable (sampler-cube-shadow sampler-cube-shadow.c)
>  piglit_add_executable (streaming-texture-leak streaming-texture-leak.c)
> diff --git a/tests/texturing/s3tc-targeted.c b/tests/texturing/s3tc-targeted.c
> new file mode 100644
> index 0..b86a326dc
> --- /dev/null
> +++ b/tests/texturing/s3tc-targeted.c
> @@ -0,0 +1,99 @@
> +/*
> + * Copyright © 2017 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 s3tc-targeted.c
> + *
> + * Tests the cases of S3TC DXT1 decompression in which the bitmap contains 
> the
> + * value b'11. The chosen tests help to determine that the color comparison
> + * portion of decompression works correctly and that any internal driver
> + * swizzling of the alpha channel is performed correctly.
> + *
> + * Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100925
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + /* We need OpenGL 1.3 for the *TexImage* functions used in this file. */
> + config.supports_gl_compat_version = 13;
> + config.requires_displayed_window = false;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static bool
> +test_block(GLenum internal_fmt, const char * base_fmt_str,
> +const uint8_t * dxt1_block, uint16_t expected_result)
> +{
> + /* Upload the DXT1 block. */
> + glCompressedTexImage2D(GL_TEXTURE_2D, 0, internal_fmt, 1, 1, 0,
> +8 /* 64 bits */, dxt1_block);
> +
> + /* Decompress the only defined pixel in the DXT1 block. */
> + uint16_t actual_pixel = 0xBEEF;
> + glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4,
> +   _pixel);
> +
> + /* Test the result. */
> + if (actual_pixel != expected_result) {
> + fprintf(stderr, "Sampled %#.4x (R4G4B4A4_PACK32), but "
> + "expected %#.4

[Piglit] [PATCH] texturing: Add decompression test for S3TC DXT1

2017-05-15 Thread Nanley Chery
Cc: Kenneth Graunke <kenn...@whitecape.org>
Cc: Mark Janes <mark.a.ja...@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100925
Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 tests/all.py  |  1 +
 tests/texturing/CMakeLists.gl.txt |  1 +
 tests/texturing/s3tc-targeted.c   | 99 +++
 3 files changed, 101 insertions(+)
 create mode 100644 tests/texturing/s3tc-targeted.c

diff --git a/tests/all.py b/tests/all.py
index 49a8c9fbe..38aabc103 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3303,6 +3303,7 @@ with profile.test_list.group_manager(
 g(['arb_texture_compression-invalid-formats', 's3tc'], 'invalid formats')
 g(['gen-compressed-teximage'], run_concurrent=False)
 g(['s3tc-errors'])
+g(['s3tc-targeted'])
 g(['s3tc-teximage'], run_concurrent=False)
 g(['s3tc-texsubimage'], run_concurrent=False)
 g(['getteximage-targets', '2D', 'S3TC'])
diff --git a/tests/texturing/CMakeLists.gl.txt 
b/tests/texturing/CMakeLists.gl.txt
index 9ab4d7ac8..e5d41e432 100644
--- a/tests/texturing/CMakeLists.gl.txt
+++ b/tests/texturing/CMakeLists.gl.txt
@@ -64,6 +64,7 @@ ENDIF (UNIX)
 piglit_add_executable (s3tc-teximage s3tc-teximage.c)
 piglit_add_executable (fxt1-teximage fxt1-teximage.c)
 piglit_add_executable (s3tc-texsubimage s3tc-texsubimage.c)
+piglit_add_executable (s3tc-targeted s3tc-targeted.c)
 piglit_add_executable (s3tc-errors s3tc-errors.c)
 piglit_add_executable (sampler-cube-shadow sampler-cube-shadow.c)
 piglit_add_executable (streaming-texture-leak streaming-texture-leak.c)
diff --git a/tests/texturing/s3tc-targeted.c b/tests/texturing/s3tc-targeted.c
new file mode 100644
index 0..b86a326dc
--- /dev/null
+++ b/tests/texturing/s3tc-targeted.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright © 2017 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 s3tc-targeted.c
+ *
+ * Tests the cases of S3TC DXT1 decompression in which the bitmap contains the
+ * value b'11. The chosen tests help to determine that the color comparison
+ * portion of decompression works correctly and that any internal driver
+ * swizzling of the alpha channel is performed correctly.
+ *
+ * Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100925
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   /* We need OpenGL 1.3 for the *TexImage* functions used in this file. */
+   config.supports_gl_compat_version = 13;
+   config.requires_displayed_window = false;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static bool
+test_block(GLenum internal_fmt, const char * base_fmt_str,
+  const uint8_t * dxt1_block, uint16_t expected_result)
+{
+   /* Upload the DXT1 block. */
+   glCompressedTexImage2D(GL_TEXTURE_2D, 0, internal_fmt, 1, 1, 0,
+  8 /* 64 bits */, dxt1_block);
+
+   /* Decompress the only defined pixel in the DXT1 block. */
+   uint16_t actual_pixel = 0xBEEF;
+   glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4,
+ _pixel);
+
+   /* Test the result. */
+   if (actual_pixel != expected_result) {
+   fprintf(stderr, "Sampled %#.4x (R4G4B4A4_PACK32), but "
+   "expected %#.4x from %s DXT1 texture.\n",
+   actual_pixel, expected_result, base_fmt_str);
+   return false;
+   }
+
+   return true;
+}
+
+#define TEST(fmt, block, pixel) \
+   test_block(GL_COMPRESSED_ ## fmt ## _S3TC_DXT1_EXT, #fmt, block, pixel)
+
+/* Test 4 out of 16 DXT1 decompression paths:
+ *   (RGB0+2*RGB1)/3,   if color0  > color1 and code(x,y) == 3
+ *   BLACK, if color0 <= color1 and code(x,y) == 3
+ */
+enum piglit_result
+piglit_display(void)
+{
+   /* Store the 64 bit DXT1 blocks to b

[Piglit] [PATCH] same-attachment-glFramebufferTexture2D: Use a CUBE_MAP texture

2016-11-16 Thread Nanley Chery
Use a more complex texture to test more parameters of the framebuffer
attachment.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77662
Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 ...mebufferTexture2D-GL_DEPTH_STENCIL_ATTACHMENT.c | 44 ++
 1 file changed, 37 insertions(+), 7 deletions(-)

diff --git 
a/tests/spec/arb_framebuffer_object/same-attachment-glFramebufferTexture2D-GL_DEPTH_STENCIL_ATTACHMENT.c
 
b/tests/spec/arb_framebuffer_object/same-attachment-glFramebufferTexture2D-GL_DEPTH_STENCIL_ATTACHMENT.c
index 9d8e5f5..78f8cb6 100644
--- 
a/tests/spec/arb_framebuffer_object/same-attachment-glFramebufferTexture2D-GL_DEPTH_STENCIL_ATTACHMENT.c
+++ 
b/tests/spec/arb_framebuffer_object/same-attachment-glFramebufferTexture2D-GL_DEPTH_STENCIL_ATTACHMENT.c
@@ -43,6 +43,20 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 PIGLIT_GL_TEST_CONFIG_END
 
 const char*
+get_cube_map_face_string(GLenum face)
+{
+   switch (face) {
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: return 
"GL_TEXTURE_CUBE_MAP_POSITIVE_Y";
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_X: return 
"GL_TEXTURE_CUBE_MAP_POSITIVE_X";
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: return 
"GL_TEXTURE_CUBE_MAP_POSITIVE_Z";
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: return 
"GL_TEXTURE_CUBE_MAP_NEGATIVE_Y";
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: return 
"GL_TEXTURE_CUBE_MAP_NEGATIVE_X";
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: return 
"GL_TEXTURE_CUBE_MAP_NEGATIVE_Z";
+   default: return NULL;
+   }
+}
+
+const char*
 get_attachment_string(GLint attach)
 {
switch (attach) {
@@ -54,10 +68,11 @@ get_attachment_string(GLint attach)
 }
 
 bool
-check_attachment(GLenum attach, GLint expect_name)
+check_attachment(GLenum attach, GLint expect_name, GLenum expect_cube_map_face)
 {
GLint actual_type;
GLint actual_name;
+   GLint actual_cube_map_face;
 
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,
  attach,
@@ -95,6 +110,20 @@ check_attachment(GLenum attach, GLint expect_name)
return false;
}
 
+   glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,
+ attach,
+ 
GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE,
+ _cube_map_face);
+
+   if (actual_cube_map_face != expect_cube_map_face) {
+   fprintf(stderr,
+   "error: expected %s for %s attachment cube map face, 
but found %s\n",
+   get_cube_map_face_string(expect_cube_map_face),
+   get_attachment_string(attach),
+   get_cube_map_face_string(actual_cube_map_face));
+   return false;
+   }
+
return true;
 }
 
@@ -108,6 +137,7 @@ void piglit_init(int argc, char **argv)
 {
bool pass = true;
 
+   GLenum cube_map_face = GL_TEXTURE_CUBE_MAP_POSITIVE_Y;
GLuint fb;
GLuint tex;
 
@@ -115,10 +145,10 @@ void piglit_init(int argc, char **argv)
 
glGenTextures(1, );
glGenFramebuffers(1, );
-   glBindTexture(GL_TEXTURE_2D, tex);
+   glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
glBindFramebuffer(GL_FRAMEBUFFER, fb);
 
-   glTexImage2D(GL_TEXTURE_2D,
+   glTexImage2D(cube_map_face,
 0, /*level*/
 GL_DEPTH_STENCIL,
 200, 200, /*width, height*/
@@ -128,15 +158,15 @@ void piglit_init(int argc, char **argv)
 NULL);
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER,
   GL_DEPTH_STENCIL_ATTACHMENT,
-  GL_TEXTURE_2D,
+  cube_map_face,
   tex,
   0); /*level*/
 
pass = piglit_check_gl_error(0) && pass;
 
-   pass = check_attachment(GL_DEPTH_ATTACHMENT, tex) && pass;
-   pass = check_attachment(GL_STENCIL_ATTACHMENT, tex) && pass;
-   pass = check_attachment(GL_DEPTH_STENCIL_ATTACHMENT, tex) && pass;
+   pass = check_attachment(GL_DEPTH_ATTACHMENT, tex, cube_map_face) && 
pass;
+   pass = check_attachment(GL_STENCIL_ATTACHMENT, tex, cube_map_face) && 
pass;
+   pass = check_attachment(GL_DEPTH_STENCIL_ATTACHMENT, tex, 
cube_map_face) && pass;
 
pass = piglit_check_gl_error(0) && pass;
 
-- 
2.10.2

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


[Piglit] [Crucible] [PATCH] func.miptree: Set appropriate usage flags for given test case

2016-09-07 Thread Nanley Chery
Enables some test cases to run instead of skipping (e.g. all stencil tests).

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 src/tests/func/miptree/miptree.c | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/tests/func/miptree/miptree.c b/src/tests/func/miptree/miptree.c
index 37002cb..ccb9c66 100644
--- a/src/tests/func/miptree/miptree.c
+++ b/src/tests/func/miptree/miptree.c
@@ -412,7 +412,7 @@ miptree_destroy(miptree_t *mt)
 
 static void
 can_create_image(VkImageType type, VkImageTiling tiling,
- uint32_t usage, VkFormat format)
+ VkImageUsageFlags usage, VkFormat format)
 {
 VkImageFormatProperties fmt_properties;
 VkResult result =
@@ -437,10 +437,19 @@ miptree_create(void)
 const uint32_t depth = params->depth;
 const uint32_t array_length = params->array_length;
 const size_t buffer_size = miptree_calc_buffer_size();
-const uint32_t usage_bits = VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
-VK_IMAGE_USAGE_TRANSFER_DST_BIT |
-VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
-VK_IMAGE_USAGE_SAMPLED_BIT;
+
+// Determine the appropriate usage flags for the test
+VkImageUsageFlags usage_bits = 0;
+if (params->upload_method == MIPTREE_UPLOAD_METHOD_COPY_WITH_DRAW)
+usage_bits |= VK_IMAGE_USAGE_SAMPLED_BIT;
+else
+usage_bits |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
+
+if (params->download_method == MIPTREE_DOWNLOAD_METHOD_COPY_WITH_DRAW)
+usage_bits |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
+else
+usage_bits |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
+
 VkImageType image_type = 
image_type_from_image_view_type(params->view_type);
 
 // Determine if an image can be created with this combination
-- 
2.9.3

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


Re: [Piglit] [PATCH 4/7] astc_sliced_3d: Move slice 'for' loop further down

2016-08-01 Thread Nanley Chery
OThis patch is,n Mon, Aug 01, 2016 at 04:13:21PM -0700, Anuj Phogat wrote:
> On Mon, Aug 1, 2016 at 3:36 PM, Nanley Chery <nanleych...@gmail.com> wrote:
> 
> > On Mon, Aug 01, 2016 at 03:16:17PM -0700, Anuj Phogat wrote:
> > > Cc: Nanley Chery <nanley.g.ch...@intel.com>
> > > Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
> > > ---
> > >  .../khr_compressed_astc-sliced-3d-miptree.c| 39
> > +++---
> > >  1 file changed, 19 insertions(+), 20 deletions(-)
> > >
> > > diff --git
> > a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> > b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> > > index d833bac..cb884e9 100644
> > > ---
> > a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> > > +++
> > b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> > > @@ -216,10 +216,6 @@ bool draw_compare_levels(bool check_error,
> > >   y += h;
> > >   }
> > >
> > > - /* Delete bound textures */
> > > - glDeleteTextures(1, _tex);
> > > - glDeleteTextures(1, _tex);
> > > -
> > >   piglit_present_results();
> > >   return result;
> > >  }
> > > @@ -279,23 +275,21 @@ test_miptrees(void* input_type)
> > >   piglit_set_tolerance_for_bits(8, 8, 8, 8);
> > >
> > >   for ( ; block_dims < ARRAY_SIZE(block_dim_str); block_dims++) {
> > > + /* Texture objects. */
> > > + GLuint tex_compressed = 0;
> > > + GLuint tex_decompressed = 0;
> > > +
> > > + /* Load texture for current submode and block size */
> > > + load_texture("compressed/SLICED3D", tests[subtest],
> > > + block_dim_str[block_dims],
> > > + _compressed);
> > > + if (!check_error) {
> > > + load_texture("decompressed/SLICED3D",
> > > +  tests[subtest],
> > > +  block_dim_str[block_dims],
> > > +  _decompressed);
> > > + }
> > >   for (slice = 0 ; slice < LEVEL0_DEPTH; slice++) {
> > > -
> > > - /* Texture objects. */
> > > - GLuint tex_compressed = 0;
> > > - GLuint tex_decompressed = 0;
> > > -
> > > - /* Load texture for current submode and block size
> > */
> > > - load_texture("compressed/SLICED3D", tests[subtest],
> > > - block_dim_str[block_dims],
> > > - _compressed);
> > > - if (!check_error) {
> > > - load_texture("decompressed/SLICED3D",
> > > -  tests[subtest],
> > > -  block_dim_str[block_dims],
> > > -  _decompressed);
> > > - }
> > > -
> > >   /* Draw and compare each level of the two textures
> > */
> > >   glClear(GL_COLOR_BUFFER_BIT);
> > >   if (!draw_compare_levels(check_error,
> > > @@ -311,6 +305,11 @@ test_miptrees(void* input_type)
> > >   return PIGLIT_FAIL;
> > >   }
> > >   }
> > > + /* Delete bound textures */
> > > + glDeleteTextures(1, _compressed);
> > > + if (!check_error)
> > > +     glDeleteTextures(1, _decompressed);
> > > +
> >
> > This patch does more than the commit title says. I think you should
> > mention the purpose of this (and the related) hunk or leave it out.
> >
> > Earlier the test was calling the load_texture() for each slice and deleting
> the created textures inside the slice 'for' loop (in draw_compare_levels()).
> If we want to avoid reloading
> the
> textures for each slice,
> ​we've to take the
> glDeleteTextures
> ​() calls out of
> slice 'for' loop.​
> ​ I can update the commit
> message​ with above details.
> ​

Thanks for the explanation. I didn't expect this change to be required,
but it makes sense.

With or without the explanation, this patch is,
Reviewed-by: Nanley Chery <nanley.g.ch...@intel.com>

> 
> 
> > - Nanley
> >
> > >   block_dims++;
> > >   }
> > >   return PIGLIT_PASS;
> > > --
> > > 2.5.5
> > >
> > > ___
> > > Piglit mailing list
> > > Piglit@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/piglit
> >
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/7] astc_sliced_3d: Fix computing test result in draw_compare_levels

2016-08-01 Thread Nanley Chery
On Mon, Aug 01, 2016 at 03:16:15PM -0700, Anuj Phogat wrote:

Patches 2 and 5 are,
Reviewed-by: Nanley Chery <nanley.g.ch...@intel.com>

> Cc: Nanley Chery <nanley.g.ch...@intel.com>
> Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
> ---
>  .../khr_compressed_astc-sliced-3d-miptree.c| 37 
> ++
>  1 file changed, 17 insertions(+), 20 deletions(-)
> 
> diff --git 
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
>  
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> index 53f0529..29ecc8b 100644
> --- 
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> +++ 
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> @@ -170,14 +170,14 @@ bool draw_compare_levels(bool check_error,
>  
>   unsigned y = 0;
>   unsigned x = 0;
> - bool pass = true;
> + bool result = true;
>   int level = 0;
>  
>   for (; level < NUM_LEVELS; ++level) {
>   int w = LEVEL0_WIDTH >> level;
>   int h = LEVEL0_HEIGHT >> level;
>   int d = LEVEL0_DEPTH >> level;
> - pass = true;
> + bool pass = true;
>   glUniform2f(level_pixel_size_loc, (float) w, (float) h);
>   glUniform1f(slice_loc, slice);
>   glUniform1f(depth_loc, d);
> @@ -187,27 +187,24 @@ bool draw_compare_levels(bool check_error,
>   glUniform2f(pixel_offset_loc, x, y);
>   glDrawArrays(GL_TRIANGLE_FAN, 0, NUM_VERTICES);
>  
> - /* Draw miplevel of decompressed texture. */
> - if (!check_error) {
> + /* Check the textures (or error-colors) for equivalence. */
> + if (check_error) {
> + pass = piglit_probe_rect_rgba(x, y, w, h,
> +   error_color);
> + } else {
> + /* Draw miplevel of decompressed texture. */
>   glBindTexture(GL_TEXTURE_3D, decompressed_tex);
>   glUniform2f(pixel_offset_loc, LEVEL0_WIDTH + x, y);
>   glDrawArrays(GL_TRIANGLE_FAN, 0, NUM_VERTICES);
> - }
> -
> - /* Check the textures (or error-colors) for equivalence. */
> - if (pass) {
> - if (check_error) {
> - pass = piglit_probe_rect_rgba(x, y, w, h,
> -   error_color);
> - } else {
> - pass = piglit_probe_rects_equal(x, y,
> - LEVEL0_WIDTH + x, y,
> - w, h, GL_RGBA);
> - }
>  
> - if (!pass)
> - piglit_loge("Slice: %d, Miplevel: %d",
> - slice, level);
> + pass = piglit_probe_rects_equal(x, y,
> + LEVEL0_WIDTH + x, y,
> + w, h, GL_RGBA);
> + }
> + if (!pass) {
> + piglit_loge("Slice: %d, Miplevel: %d",
> + slice, level);
> + result = false;
>   }
>  
>   /* Update the next miplevel arrangement */
> @@ -222,7 +219,7 @@ bool draw_compare_levels(bool check_error,
>   glDeleteTextures(1, _tex);
>  
>   piglit_present_results();
> - return pass;
> + return result;
>  }
>  
>  enum piglit_result
> -- 
> 2.5.5
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/7] astc_sliced_3d: Add srgb full precision subtest in all.py

2016-08-01 Thread Nanley Chery
On Mon, Aug 01, 2016 at 03:16:14PM -0700, Anuj Phogat wrote:
> As srgb full precision bits have already landed in astc_sliced_3d
> test, it doesn't hurt to add it to all.py as well.
> 

This patch is,
Reviewed-by: Nanley Chery <nanley.g.ch...@intel.com>

> Cc: Nanley Chery <nanley.g.ch...@intel.com>
> Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
> ---
>  tests/all.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/all.py b/tests/all.py
> index fea1a3c..60e41c6 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -4360,7 +4360,7 @@ with profile.group_manager(
> 'miptree-gl {}'.format(subtest))
>  g(['khr_compressed_astc-miptree_gles2', '-subtest', subtest],
> 'miptree-gles {}'.format(subtest))
> -for subtest in ('hdr', 'ldr', 'srgb'):
> +for subtest in ('hdr', 'ldr', 'srgb', "srgb-fp"):
>  g(['khr_compressed_astc-sliced-3d-miptree_gl', '-subtest', subtest],
> 'sliced-3d-miptree-gl {}'.format(subtest))
>  g(['khr_compressed_astc-sliced-3d-miptree_gles3', '-subtest', 
> subtest],
> -- 
> 2.5.5
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 3/7] astc_sliced_3d: Add an assert for texture depth

2016-08-01 Thread Nanley Chery
On Mon, Aug 01, 2016 at 03:16:16PM -0700, Anuj Phogat wrote:
> Also update the comment reflecting the texture depth.
> 

Patches 3 and 6 are,
Reviewed-by: Nanley Chery <nanley.g.ch...@intel.com>

> Cc: Nanley Chery <nanley.g.ch...@intel.com>
> Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
> ---
>  .../khr_compressed_astc-sliced-3d-miptree.c| 10 
> ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git 
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
>  
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> index 29ecc8b..d833bac 100644
> --- 
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> +++ 
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> @@ -27,10 +27,11 @@
>   *
>   * The files under compressed/SLICED3D/{hdr, ldrl, ldrs} contain full 
> miptrees,
>   * in the GL_*_ASTC_* formats, of a sliced 3D texture of waffles and fruit 
> [1].
> - * The base level size was shrunken to 160x106 pixels. The files under the
> - * decompressed/SLICED3D/{hdr, ldrl, ldrs} directory contain the same 
> miptree in
> - * GL_RGBA format. Each miplevel was obtained by decompressing the 
> corresponding
> - * ASTC texture with astcenc [2].
> + * The base level size was shrunken to 160x106 pixels and used to create a 
> sliced
> + * 3D texture with depth=8.
> + * The files under the decompressed/SLICED3D/{hdr, ldrl, ldrs} directory 
> contain
> + * the same miptree in GL_RGBA format. Each miplevel was obtained by 
> decompressing
> + * the corresponding ASTC texture with astcenc [2].
>   *
>   * This test draws miplevels of the compressed textures in a space-efficient
>   * manner. It does the same when drawing the decompressed texture on the 
> right.
> @@ -150,6 +151,7 @@ load_texture(const char *dir1, const char *dir2,
>   assert(info->target == GL_TEXTURE_3D);
>   assert(info->pixel_width == LEVEL0_WIDTH);
>   assert(info->pixel_height == LEVEL0_HEIGHT);
> + assert(info->pixel_depth == LEVEL0_DEPTH);
>  
>   *tex_name = 0;
>   ok = piglit_ktx_load_texture(ktx, tex_name, NULL);
> -- 
> 2.5.5
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 7/7] astc_3d: Move slice 'for' loop further down

2016-08-01 Thread Nanley Chery
On Mon, Aug 01, 2016 at 03:16:20PM -0700, Anuj Phogat wrote:
> Cc: Nanley Chery <nanley.g.ch...@intel.com>
> Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
> ---
>  .../oes_compressed_astc-miptree-3d.c   | 35 
> +++---
>  1 file changed, 17 insertions(+), 18 deletions(-)
> 
> diff --git 
> a/tests/spec/oes_texture_compression_astc/oes_compressed_astc-miptree-3d.c 
> b/tests/spec/oes_texture_compression_astc/oes_compressed_astc-miptree-3d.c
> index d743f3c..0219e52 100644
> --- a/tests/spec/oes_texture_compression_astc/oes_compressed_astc-miptree-3d.c
> +++ b/tests/spec/oes_texture_compression_astc/oes_compressed_astc-miptree-3d.c
> @@ -212,10 +212,6 @@ bool draw_compare_levels(bool check_error,
>   y += h;
>   }
>  
> - /* Delete bound textures */
> - glDeleteTextures(1, _tex);
> - glDeleteTextures(1, _tex);
> -

Please see my comment on patch 4/7.

- Nanley

>   piglit_present_results();
>   return result;
>  }
> @@ -265,22 +261,21 @@ test_miptrees(void* input_type)
>   piglit_set_tolerance_for_bits(8, 8, 8, 8);
>  
>   for ( ; block_dims < ARRAY_SIZE(block_dim_str); ++block_dims) {
> - for (slice = 0; slice < LEVEL0_DEPTH; slice++) {
> -
> - /* Texture objects. */
> - GLuint tex_compressed = 0;
> - GLuint tex_decompressed = 0;
> -
> - /* Load texture for current submode and block size */
> - load_texture("compressed/3D", tests[subtest],
> + /* Texture objects. */
> + GLuint tex_compressed = 0;
> + GLuint tex_decompressed = 0;
> +
> + /* Load texture for current submode and block size */
> + load_texture("compressed/3D", tests[subtest],
> +  block_dim_str[block_dims],
> +  _compressed);
> + if (!check_error) {
> + load_texture("decompressed/3D", tests[subtest],
>block_dim_str[block_dims],
> -  _compressed);
> - if (!check_error) {
> - load_texture("decompressed/3D", tests[subtest],
> -  block_dim_str[block_dims],
> -  _decompressed);
> - }
> +  _decompressed);
> + }
>  
> + for (slice = 0; slice < LEVEL0_DEPTH; slice++) {
>   /* Draw and compare each level of the two textures */
>   glClear(GL_COLOR_BUFFER_BIT);
>   if (!draw_compare_levels(check_error,
> @@ -296,6 +291,10 @@ test_miptrees(void* input_type)
>   return PIGLIT_FAIL;
>   }
>   }
> + /* Delete bound textures */
> + glDeleteTextures(1, _compressed);
> + if (!check_error)
> + glDeleteTextures(1, _decompressed);
>   }
>   return PIGLIT_PASS;
>  }
> -- 
> 2.5.5
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 4/7] astc_sliced_3d: Move slice 'for' loop further down

2016-08-01 Thread Nanley Chery
On Mon, Aug 01, 2016 at 03:16:17PM -0700, Anuj Phogat wrote:
> Cc: Nanley Chery <nanley.g.ch...@intel.com>
> Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
> ---
>  .../khr_compressed_astc-sliced-3d-miptree.c| 39 
> +++---
>  1 file changed, 19 insertions(+), 20 deletions(-)
> 
> diff --git 
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
>  
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> index d833bac..cb884e9 100644
> --- 
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> +++ 
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> @@ -216,10 +216,6 @@ bool draw_compare_levels(bool check_error,
>   y += h;
>   }
>  
> - /* Delete bound textures */
> - glDeleteTextures(1, _tex);
> - glDeleteTextures(1, _tex);
> -
>   piglit_present_results();
>   return result;
>  }
> @@ -279,23 +275,21 @@ test_miptrees(void* input_type)
>   piglit_set_tolerance_for_bits(8, 8, 8, 8);
>  
>   for ( ; block_dims < ARRAY_SIZE(block_dim_str); block_dims++) {
> + /* Texture objects. */
> + GLuint tex_compressed = 0;
> + GLuint tex_decompressed = 0;
> +
> + /* Load texture for current submode and block size */
> + load_texture("compressed/SLICED3D", tests[subtest],
> + block_dim_str[block_dims],
> + _compressed);
> + if (!check_error) {
> + load_texture("decompressed/SLICED3D",
> +  tests[subtest],
> +  block_dim_str[block_dims],
> +  _decompressed);
> + }
>   for (slice = 0 ; slice < LEVEL0_DEPTH; slice++) {
> -
> - /* Texture objects. */
> - GLuint tex_compressed = 0;
> - GLuint tex_decompressed = 0;
> -
> - /* Load texture for current submode and block size */
> - load_texture("compressed/SLICED3D", tests[subtest],
> - block_dim_str[block_dims],
> - _compressed);
> - if (!check_error) {
> - load_texture("decompressed/SLICED3D",
> -  tests[subtest],
> -  block_dim_str[block_dims],
> -  _decompressed);
> - }
> -
>   /* Draw and compare each level of the two textures */
>   glClear(GL_COLOR_BUFFER_BIT);
>   if (!draw_compare_levels(check_error,
> @@ -311,6 +305,11 @@ test_miptrees(void* input_type)
>   return PIGLIT_FAIL;
>   }
>   }
> + /* Delete bound textures */
> + glDeleteTextures(1, _compressed);
> + if (!check_error)
> + glDeleteTextures(1, _decompressed);
> +

This patch does more than the commit title says. I think you should
mention the purpose of this (and the related) hunk or leave it out.

- Nanley

>   block_dims++;
>   }
>   return PIGLIT_PASS;
> -- 
> 2.5.5
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 7/7] khr_texture_compression_astc: Add test case for sliced 3d astc textures

2016-07-28 Thread Nanley Chery
On Thu, Jul 28, 2016 at 02:26:30PM -0700, Anuj Phogat wrote:
> On Wed, Jul 27, 2016 at 4:24 PM, Nanley Chery <nanleych...@gmail.com> wrote:
> 
> > On Fri, Jul 22, 2016 at 02:01:37PM -0700, Anuj Phogat wrote:
> > > V2:  Loosen up the tolerence for sRGB tests. This will allow testing sRGB
> > >  formats which have known precision issues in astcenc in void extent
> > >  blocks. See khronos bug#11294 for details.
> > >  Run each subtest separately in all.py
> > >
> > > Cc: Nanley Chery <nanley.g.ch...@intel.com>
> > > Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
> > > Acked-by: Ben Widawsky <b...@bwidawsk.net>
> > > ---
> > > Patch is trimmed to keep the size under limit.
> > > See full patch at: https://github.com/aphogat/piglit.git, branch: review
> > >
> > >  tests/all.py   |   5 +
> > >  .../khr_texture_compression_astc/CMakeLists.gl.txt |   1 +
> > >  .../CMakeLists.gles3.txt   |   1 +
> > >
> > > diff --git a/tests/all.py b/tests/all.py
> > > index e2998d0..063453d 100644
> > > --- a/tests/all.py
> > > +++ b/tests/all.py
> > > @@ -4360,6 +4360,11 @@ with profile.group_manager(
> > > 'miptree-gl {}'.format(subtest))
> > >  g(['khr_compressed_astc-miptree_gles2', '-subtest', subtest],
> > > 'miptree-gles {}'.format(subtest))
> > > +for subtest in ('hdr', 'ldr', 'srgb'):
> > > +g(['khr_compressed_astc-sliced-3d-miptree_gl', '-subtest',
> > subtest],
> > > +   'sliced-3d-miptree-gl {}'.format(subtest))
> > > +g(['khr_compressed_astc-sliced-3d-miptree_gles3', '-subtest',
> > subtest],
> > > +   'sliced-3d-miptree-gles {}'.format(subtest))
> > >
> > >  with profile.group_manager(
> > >   PiglitGLTest,
> > > diff --git a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
> > b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
> > > index a70a3ed..089da84 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-sliced-3d-miptree_${piglit_target_api}
> > khr_compressed_astc-sliced-3d-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)
> > >
> > > diff --git
> > a/tests/spec/khr_texture_compression_astc/CMakeLists.gles3.txt
> > b/tests/spec/khr_texture_compression_astc/CMakeLists.gles3.txt
> > > index 60147b2..dfc34e5 100644
> > > --- a/tests/spec/khr_texture_compression_astc/CMakeLists.gles3.txt
> > > +++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gles3.txt
> > > @@ -1,4 +1,5 @@
> > >  link_libraries(piglitutil_${piglit_target_api})
> > >  piglit_add_executable(khr_compressed_astc-array_${piglit_target_api}
> > khr_compressed_astc-miptree-array.c)
> > >
> > +piglit_add_executable(khr_compressed_astc-sliced-3d-miptree_${piglit_target_api}
> > khr_compressed_astc-sliced-3d-miptree.c)
> > >
> > > diff --git
> > a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> > b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> > > new file mode 100644
> > > index 000..53f0529
> > > --- /dev/null
> > > +++
> > b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> > > @@ -0,0 +1,409 @@
> > > +/*
> > > + * Copyright 2016 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 

Re: [Piglit] [PATCH 7/7] khr_texture_compression_astc: Add test case for sliced 3d astc textures

2016-07-27 Thread Nanley Chery
On Fri, Jul 22, 2016 at 02:01:37PM -0700, Anuj Phogat wrote:
> V2:  Loosen up the tolerence for sRGB tests. This will allow testing sRGB
>  formats which have known precision issues in astcenc in void extent
>  blocks. See khronos bug#11294 for details.
>  Run each subtest separately in all.py
> 
> Cc: Nanley Chery <nanley.g.ch...@intel.com>
> Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
> Acked-by: Ben Widawsky <b...@bwidawsk.net>
> ---
> Patch is trimmed to keep the size under limit.
> See full patch at: https://github.com/aphogat/piglit.git, branch: review
> 
>  tests/all.py   |   5 +
>  .../khr_texture_compression_astc/CMakeLists.gl.txt |   1 +
>  .../CMakeLists.gles3.txt   |   1 +
>  
> diff --git a/tests/all.py b/tests/all.py
> index e2998d0..063453d 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -4360,6 +4360,11 @@ with profile.group_manager(
> 'miptree-gl {}'.format(subtest))
>  g(['khr_compressed_astc-miptree_gles2', '-subtest', subtest],
> 'miptree-gles {}'.format(subtest))
> +for subtest in ('hdr', 'ldr', 'srgb'):
> +g(['khr_compressed_astc-sliced-3d-miptree_gl', '-subtest', subtest],
> +   'sliced-3d-miptree-gl {}'.format(subtest))
> +g(['khr_compressed_astc-sliced-3d-miptree_gles3', '-subtest', 
> subtest],
> +   'sliced-3d-miptree-gles {}'.format(subtest))
>  
>  with profile.group_manager(
>   PiglitGLTest,
> diff --git a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt 
> b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
> index a70a3ed..089da84 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-sliced-3d-miptree_${piglit_target_api}
>  khr_compressed_astc-sliced-3d-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)
>  
> diff --git a/tests/spec/khr_texture_compression_astc/CMakeLists.gles3.txt 
> b/tests/spec/khr_texture_compression_astc/CMakeLists.gles3.txt
> index 60147b2..dfc34e5 100644
> --- a/tests/spec/khr_texture_compression_astc/CMakeLists.gles3.txt
> +++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gles3.txt
> @@ -1,4 +1,5 @@
>  link_libraries(piglitutil_${piglit_target_api})
>  piglit_add_executable(khr_compressed_astc-array_${piglit_target_api} 
> khr_compressed_astc-miptree-array.c)
> +piglit_add_executable(khr_compressed_astc-sliced-3d-miptree_${piglit_target_api}
>  khr_compressed_astc-sliced-3d-miptree.c)
>  
> diff --git 
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
>  
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> new file mode 100644
> index 000..53f0529
> --- /dev/null
> +++ 
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
> @@ -0,0 +1,409 @@
> +/*
> + * Copyright 2016 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
> + * \brief Test texturing from an ASTC miptree of a real image.
> + *
> + * The files under compressed/SLICED3D/{hdr,

Re: [Piglit] [PATCH 5/7] khr_texture_compression_astc: Add sRGB skip decode test

2016-07-26 Thread Nanley Chery
On Fri, Jul 22, 2016 at 02:01:35PM -0700, Anuj Phogat wrote:
> This adds the testing of EXT_texture_sRGB_decode with ASTC
> compressed textures.
> 
> Cc: Nanley Chery <nanley.g.ch...@intel.com>
> Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>

Patches 4 and 5 are,
Reviewed-by: Nanley Chery <nanley.g.ch...@intel.com>

> ---
>  tests/all.py   |  2 +-
>  .../khr_compressed_astc-miptree.c  | 26 
> +++---
>  2 files changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/all.py b/tests/all.py
> index 6db24ad..e2998d0 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -4355,7 +4355,7 @@ with profile.group_manager(
>  g(['khr_compressed_astc-basic_gl'], 'basic-gl')
>  g(['khr_compressed_astc-basic_gles2'], 'basic-gles')
>  
> -for subtest in ('hdr', 'ldr', 'srgb', "srgb-fp"):
> +for subtest in ('hdr', 'ldr', 'srgb', "srgb-fp", "srgb-sd"):
>  g(['khr_compressed_astc-miptree_gl', '-subtest', subtest],
> 'miptree-gl {}'.format(subtest))
>  g(['khr_compressed_astc-miptree_gles2', '-subtest', subtest],
> diff --git 
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c 
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> index 61edc5f..da43cb8 100644
> --- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> +++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> @@ -60,6 +60,7 @@ enum test_type
>   TEST_TYPE_LDR,
>   TEST_TYPE_SRGB,
>   TEST_TYPE_SRGB_FP,
> + TEST_TYPE_SRGB_SD,
>  };
>  
>  enum piglit_result
> @@ -69,6 +70,7 @@ static enum test_type ldr_test  = TEST_TYPE_LDR;
>  static enum test_type hdr_test  = TEST_TYPE_HDR;
>  static enum test_type srgb_test = TEST_TYPE_SRGB;
>  static enum test_type srgb_fp_test = TEST_TYPE_SRGB_FP;
> +static enum test_type srgb_skip_test = TEST_TYPE_SRGB_SD;
>  static const struct piglit_subtest subtests[] = {
>   {
>   "LDR Profile",
> @@ -94,6 +96,12 @@ static const struct piglit_subtest subtests[] = {
>   test_miptrees,
>   _fp_test,
>   },
> + {
> + "sRGB skip decode",
> + "srgb-sd",
> + test_miptrees,
> + _skip_test,
> + },
>   {NULL},
>  };
>  
> @@ -159,7 +167,7 @@ load_texture(const char *dir1, const char *dir2,
>  }
>  
>  /** Compares the compressed texture against the decompressed texture */
> -bool draw_compare_levels(bool check_error,
> +bool draw_compare_levels(bool check_error, bool srgb_skip_decode,
>   GLint level_pixel_size_loc, GLint pixel_offset_loc,
>   GLuint compressed_tex, GLuint decompressed_tex)
>  {
> @@ -179,12 +187,20 @@ bool draw_compare_levels(bool check_error,
>  
>   /* Draw miplevel of compressed texture. */
>   glBindTexture(GL_TEXTURE_2D, compressed_tex);
> + if (srgb_skip_decode)
> + glTexParameteri(GL_TEXTURE_2D,
> + GL_TEXTURE_SRGB_DECODE_EXT,
> + GL_SKIP_DECODE_EXT);
>   glUniform2f(pixel_offset_loc, x, y);
>   glDrawArrays(GL_TRIANGLE_FAN, 0, NUM_VERTICES);
>  
>   /* Draw miplevel of decompressed texture. */
>   if (!check_error) {
>   glBindTexture(GL_TEXTURE_2D, decompressed_tex);
> + if (srgb_skip_decode)
> + glTexParameteri(GL_TEXTURE_2D,
> + GL_TEXTURE_SRGB_DECODE_EXT,
> + GL_SKIP_DECODE_EXT);
>   glUniform2f(pixel_offset_loc, LEVEL0_WIDTH + x, y);
>   glDrawArrays(GL_TRIANGLE_FAN, 0, NUM_VERTICES);
>   }
> @@ -224,9 +240,10 @@ test_miptrees(void* input_type)
>  {
>   const enum test_type subtest = *(enum test_type*) input_type;
>   const bool is_srgb_test = subtest == TEST_TYPE_SRGB;
> + const bool is_srgb_skip_decode_test = subtest == TEST_TYPE_SRGB_SD;
>   const bool is_hdr_test  = subtest == TEST_TYPE_HDR;
>  
> - static const char * tests[4] = {"hdr", "ldrl", "ldrs", "ldrs"};
> + static const char * tests[5] = {"hdr", "ldrl", "ldrs", "ldrs", "ldrs"};
>   static const char * block_dim_str[14] = {
>   "4x4",
>   "5x4",
> @@ -248,6 +265,9 @@

Re: [Piglit] [PATCH 2/7] khr_texture_compression_astc: Run each subtest separately in all.py

2016-07-26 Thread Nanley Chery
On Fri, Jul 22, 2016 at 02:01:32PM -0700, Anuj Phogat wrote:
> Cc: Nanley Chery <nanley.g.ch...@intel.com>
> Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>

This patch is,
Reviewed-by: Nanley Chery <nanley.g.ch...@intel.com>

> ---
>  tests/all.py | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/all.py b/tests/all.py
> index 96a3e46..dfad955 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -4354,8 +4354,12 @@ with profile.group_manager(
>  g(['khr_compressed_astc-array_gles3'], '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')
> -g(['khr_compressed_astc-miptree_gles2'], 'miptree-gles')
> +
> +for subtest in ('hdr', 'ldr', 'srgb'):
> +g(['khr_compressed_astc-miptree_gl', '-subtest', subtest],
> +   'miptree-gl {}'.format(subtest))
> +g(['khr_compressed_astc-miptree_gles2', '-subtest', subtest],
> +   'miptree-gles {}'.format(subtest))
>  
>  with profile.group_manager(
>   PiglitGLTest,
> -- 
> 2.5.5
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/7] khr_texture_compression_astc: Don't use Skip decoding for non-sRGB textures

2016-07-25 Thread Nanley Chery
On Fri, Jul 22, 2016 at 02:01:31PM -0700, Anuj Phogat wrote:
> Skipping the decoding in non-sRGB cases isn't serving any purpose.
> 
> Cc: Nanley Chery <nanley.g.ch...@intel.com>
> Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>

This patch is,
Reviewed-by: Nanley Chery <nanley.g.ch...@intel.com>

> ---
>  .../khr_compressed_astc-miptree.c | 15 
> ++-
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git 
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c 
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> index 6429c2e..0f82695 100644
> --- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> +++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> @@ -151,7 +151,7 @@ load_texture(const char *dir1, const char *dir2,
>  }
>  
>  /** Compares the compressed texture against the decompressed texture */
> -bool draw_compare_levels(bool check_error, bool check_srgb,
> +bool draw_compare_levels(bool check_error,
>   GLint level_pixel_size_loc, GLint pixel_offset_loc,
>   GLuint compressed_tex, GLuint decompressed_tex)
>  {
> @@ -171,20 +171,12 @@ bool draw_compare_levels(bool check_error, bool 
> check_srgb,
>  
>   /* Draw miplevel of compressed texture. */
>   glBindTexture(GL_TEXTURE_2D, compressed_tex);
> - if (!check_srgb)
> - glTexParameteri(GL_TEXTURE_2D,
> - GL_TEXTURE_SRGB_DECODE_EXT,
> - GL_SKIP_DECODE_EXT);
>   glUniform2f(pixel_offset_loc, x, y);
>   glDrawArrays(GL_TRIANGLE_FAN, 0, NUM_VERTICES);
>  
>   /* Draw miplevel of decompressed texture. */
>   if (!check_error) {
>   glBindTexture(GL_TEXTURE_2D, decompressed_tex);
> - if (!check_srgb)
> - glTexParameteri(GL_TEXTURE_2D,
> - GL_TEXTURE_SRGB_DECODE_EXT,
> - GL_SKIP_DECODE_EXT);
>   glUniform2f(pixel_offset_loc, LEVEL0_WIDTH + x, y);
>   glDrawArrays(GL_TRIANGLE_FAN, 0, NUM_VERTICES);
>   }
> @@ -244,9 +236,6 @@ test_miptrees(void* input_type)
>   "12x12"
>   };
>  
> - if (!is_srgb_test)
> - piglit_require_extension("GL_EXT_texture_sRGB_decode");
> -
>   GLint pixel_offset_loc = glGetUniformLocation(prog, "pixel_offset");
>   GLint level_pixel_size_loc = glGetUniformLocation(prog,
>   "level_pixel_size");
> @@ -276,7 +265,7 @@ test_miptrees(void* input_type)
>  
>   /* Draw and compare each level of the two textures */
>   glClear(GL_COLOR_BUFFER_BIT);
> - if (!draw_compare_levels(check_error, is_srgb_test,
> + if (!draw_compare_levels(check_error,
>   level_pixel_size_loc,
>   pixel_offset_loc,
>   tex_compressed,
> -- 
> 2.5.5
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/5] khr_texture_compression_astc: Skip the decoding for sRGB textures

2016-07-19 Thread Nanley Chery
On Thu, Jul 07, 2016 at 04:28:10PM -0700, Anuj Phogat wrote:
> Both compressed and decompressed sRGB textures in the test are decoded
> to linear color by sampler. The loss of precision during this conversion
> caused the subtest failure. It can be fixed by avoiding the sRGB decoding
> for sRGB textures.
> 
> Skipping the decoding in non-sRGB cases isn't serving any purpose.
> 

I've thought about this some more and I'm not sure we want this change.

This patch modifies the test behavior so that sRGB decoding is not
performed for the sRGB textures. This would mean that half of the ASTC
texture formats would not be tested.

On the positive side, the fact that this test passes with
GL_SKIP_DECODE_EXT indicates that we support the 
GL_EXT_texture_sRGB_decode extension with ASTC. (I'm not exactly sure
how this works). We may want to make two calls to draw_compare_levels()
in the sRGB case to test our support for GL_EXT_texture_sRGB_decode.

- Nanley

> Signed-off-by: Anuj Phogat 
> ---
>  .../spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c | 6 
> +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git 
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c 
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> index 6429c2e..5126820 100644
> --- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> +++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> @@ -171,7 +171,7 @@ bool draw_compare_levels(bool check_error, bool 
> check_srgb,
>  
>   /* Draw miplevel of compressed texture. */
>   glBindTexture(GL_TEXTURE_2D, compressed_tex);
> - if (!check_srgb)
> + if (check_srgb)
>   glTexParameteri(GL_TEXTURE_2D,
>   GL_TEXTURE_SRGB_DECODE_EXT,
>   GL_SKIP_DECODE_EXT);
> @@ -181,7 +181,7 @@ bool draw_compare_levels(bool check_error, bool 
> check_srgb,
>   /* Draw miplevel of decompressed texture. */
>   if (!check_error) {
>   glBindTexture(GL_TEXTURE_2D, decompressed_tex);
> - if (!check_srgb)
> + if (check_srgb)
>   glTexParameteri(GL_TEXTURE_2D,
>   GL_TEXTURE_SRGB_DECODE_EXT,
>   GL_SKIP_DECODE_EXT);
> @@ -244,7 +244,7 @@ test_miptrees(void* input_type)
>   "12x12"
>   };
>  
> - if (!is_srgb_test)
> + if (is_srgb_test)
>   piglit_require_extension("GL_EXT_texture_sRGB_decode");
>  
>   GLint pixel_offset_loc = glGetUniformLocation(prog, "pixel_offset");
> -- 
> 2.5.5
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/5] khr_compressed_astc-miptree-array requires GL_ARB_ES3_compatibility

2016-07-18 Thread Nanley Chery
On Mon, Jul 18, 2016 at 03:57:02PM -0700, Anuj Phogat wrote:
> On Mon, Jul 18, 2016 at 3:07 PM, Nanley Chery <nanleych...@gmail.com> wrote:
> > On Thu, Jul 07, 2016 at 04:28:09PM -0700, Anuj Phogat wrote:
> >
> > Why does it require this extension?
> Shaders use "#version 300 es".

Makes sense. With your reply as (or something similar) as the git
commit message, this patch is:

Reviewed-by: Nanley Chery <nanley.g.ch...@intel.com>

> 
> >
> > - Nanley
> >
> >> Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
> >> ---
> >>  .../khr_texture_compression_astc/khr_compressed_astc-miptree-array.c   | 
> >> 3 +++
> >>  1 file changed, 3 insertions(+)
> >>
> >> diff --git 
> >> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c
> >>  
> >> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c
> >> index e332bad..199924c 100644
> >> --- 
> >> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c
> >> +++ 
> >> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c
> >> @@ -263,6 +263,9 @@ piglit_init(int argc, char **argv)
> >>
> >>   piglit_require_extension("GL_KHR_texture_compression_astc_ldr");
> >>
> >> + if (!piglit_is_gles())
> >> + piglit_require_extension("GL_ARB_ES3_compatibility");
> >> +
> >>   glClearColor(0.9098, 0.8314, 0.7843, 1.0);
> >>   glViewport(0, 0, piglit_width, piglit_height);
> >>
> >> --
> >> 2.5.5
> >>
> >> ___
> >> Piglit mailing list
> >> Piglit@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/5] khr_texture_compression_astc: Skip the decoding for sRGB textures

2016-07-18 Thread Nanley Chery
On Mon, Jul 18, 2016 at 03:59:19PM -0700, Nanley Chery wrote:
> On Mon, Jul 18, 2016 at 03:39:22PM -0700, Nanley Chery wrote:
> > On Thu, Jul 07, 2016 at 04:28:10PM -0700, Anuj Phogat wrote:
> > > Both compressed and decompressed sRGB textures in the test are decoded
> > > to linear color by sampler. The loss of precision during this conversion
> > > caused the subtest failure. It can be fixed by avoiding the sRGB decoding
> > > for sRGB textures.
> > > 
> > > Skipping the decoding in non-sRGB cases isn't serving any purpose.
> > > 
> > > Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
> > 
> > Thanks for catching this mistake! This patch is,
> > Reviewed-by: Nanley Chery <nanley.g.ch...@intel.com>
> > 
> 
> I unfortunately may have spoken too soon. The code for skipping ASTC sRGB
> decode via glTexParameteri seems incorrect. I'm not so sure we can
> substitute the sRGB format with the non-sRGB format as they are stored
> differently on-disk.
> 
> > > ---
> > >  .../spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c | 6 
> > > +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > 
> > > diff --git 
> > > a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c 
> > > b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> > > index 6429c2e..5126820 100644
> > > --- 
> > > a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> > > +++ 
> > > b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> > > @@ -171,7 +171,7 @@ bool draw_compare_levels(bool check_error, bool 
> > > check_srgb,
> > >  
> > >   /* Draw miplevel of compressed texture. */
> > >   glBindTexture(GL_TEXTURE_2D, compressed_tex);
> > > - if (!check_srgb)
> > > + if (check_srgb)
> 
> Given what I said above, I'm not sure we can call glTexParameteri for
> the compressed texture. The rest of the patch makes sense however. Does
> the subtest still pass if you remove the glTexParameteri call at this
> point?
> 

(For the list,)
We reached the shared understanding that the test would not make sense
if we skipped sRGB decode on the compressed texture, but not the
decompressed texture.

- Nanley

> - Nanley
> 
> > >   glTexParameteri(GL_TEXTURE_2D,
> > >   GL_TEXTURE_SRGB_DECODE_EXT,
> > >   GL_SKIP_DECODE_EXT);
> > > @@ -181,7 +181,7 @@ bool draw_compare_levels(bool check_error, bool 
> > > check_srgb,
> > >   /* Draw miplevel of decompressed texture. */
> > >   if (!check_error) {
> > >   glBindTexture(GL_TEXTURE_2D, decompressed_tex);
> > > - if (!check_srgb)
> > > + if (check_srgb)
> > >   glTexParameteri(GL_TEXTURE_2D,
> > >   GL_TEXTURE_SRGB_DECODE_EXT,
> > >   GL_SKIP_DECODE_EXT);
> > > @@ -244,7 +244,7 @@ test_miptrees(void* input_type)
> > >   "12x12"
> > >   };
> > >  
> > > - if (!is_srgb_test)
> > > + if (is_srgb_test)
> > >   piglit_require_extension("GL_EXT_texture_sRGB_decode");
> > >  
> > >   GLint pixel_offset_loc = glGetUniformLocation(prog, "pixel_offset");
> > > -- 
> > > 2.5.5
> > > 
> > > ___
> > > Piglit mailing list
> > > Piglit@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/5] khr_texture_compression_astc: Skip the decoding for sRGB textures

2016-07-18 Thread Nanley Chery
On Mon, Jul 18, 2016 at 03:39:22PM -0700, Nanley Chery wrote:
> On Thu, Jul 07, 2016 at 04:28:10PM -0700, Anuj Phogat wrote:
> > Both compressed and decompressed sRGB textures in the test are decoded
> > to linear color by sampler. The loss of precision during this conversion
> > caused the subtest failure. It can be fixed by avoiding the sRGB decoding
> > for sRGB textures.
> > 
> > Skipping the decoding in non-sRGB cases isn't serving any purpose.
> > 
> > Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
> 
> Thanks for catching this mistake! This patch is,
> Reviewed-by: Nanley Chery <nanley.g.ch...@intel.com>
> 

I unfortunately may have spoken too soon. The code for skipping ASTC sRGB
decode via glTexParameteri seems incorrect. I'm not so sure we can
substitute the sRGB format with the non-sRGB format as they are stored
differently on-disk.

> > ---
> >  .../spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c | 6 
> > +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git 
> > a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c 
> > b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> > index 6429c2e..5126820 100644
> > --- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> > +++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> > @@ -171,7 +171,7 @@ bool draw_compare_levels(bool check_error, bool 
> > check_srgb,
> >  
> > /* Draw miplevel of compressed texture. */
> > glBindTexture(GL_TEXTURE_2D, compressed_tex);
> > -   if (!check_srgb)
> > +   if (check_srgb)

Given what I said above, I'm not sure we can call glTexParameteri for
the compressed texture. The rest of the patch makes sense however. Does
the subtest still pass if you remove the glTexParameteri call at this
point?

- Nanley

> > glTexParameteri(GL_TEXTURE_2D,
> > GL_TEXTURE_SRGB_DECODE_EXT,
> > GL_SKIP_DECODE_EXT);
> > @@ -181,7 +181,7 @@ bool draw_compare_levels(bool check_error, bool 
> > check_srgb,
> > /* Draw miplevel of decompressed texture. */
> > if (!check_error) {
> > glBindTexture(GL_TEXTURE_2D, decompressed_tex);
> > -   if (!check_srgb)
> > +   if (check_srgb)
> > glTexParameteri(GL_TEXTURE_2D,
> > GL_TEXTURE_SRGB_DECODE_EXT,
> > GL_SKIP_DECODE_EXT);
> > @@ -244,7 +244,7 @@ test_miptrees(void* input_type)
> > "12x12"
> > };
> >  
> > -   if (!is_srgb_test)
> > +   if (is_srgb_test)
> > piglit_require_extension("GL_EXT_texture_sRGB_decode");
> >  
> > GLint pixel_offset_loc = glGetUniformLocation(prog, "pixel_offset");
> > -- 
> > 2.5.5
> > 
> > ___
> > Piglit mailing list
> > Piglit@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/5] khr_texture_compression_astc: Skip the decoding for sRGB textures

2016-07-18 Thread Nanley Chery
On Thu, Jul 07, 2016 at 04:28:10PM -0700, Anuj Phogat wrote:
> Both compressed and decompressed sRGB textures in the test are decoded
> to linear color by sampler. The loss of precision during this conversion
> caused the subtest failure. It can be fixed by avoiding the sRGB decoding
> for sRGB textures.
> 
> Skipping the decoding in non-sRGB cases isn't serving any purpose.
> 
> Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>

Thanks for catching this mistake! This patch is,
Reviewed-by: Nanley Chery <nanley.g.ch...@intel.com>

> ---
>  .../spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c | 6 
> +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git 
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c 
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> index 6429c2e..5126820 100644
> --- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> +++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> @@ -171,7 +171,7 @@ bool draw_compare_levels(bool check_error, bool 
> check_srgb,
>  
>   /* Draw miplevel of compressed texture. */
>   glBindTexture(GL_TEXTURE_2D, compressed_tex);
> - if (!check_srgb)
> + if (check_srgb)
>   glTexParameteri(GL_TEXTURE_2D,
>   GL_TEXTURE_SRGB_DECODE_EXT,
>   GL_SKIP_DECODE_EXT);
> @@ -181,7 +181,7 @@ bool draw_compare_levels(bool check_error, bool 
> check_srgb,
>   /* Draw miplevel of decompressed texture. */
>   if (!check_error) {
>   glBindTexture(GL_TEXTURE_2D, decompressed_tex);
> - if (!check_srgb)
> + if (check_srgb)
>   glTexParameteri(GL_TEXTURE_2D,
>   GL_TEXTURE_SRGB_DECODE_EXT,
>   GL_SKIP_DECODE_EXT);
> @@ -244,7 +244,7 @@ test_miptrees(void* input_type)
>   "12x12"
>   };
>  
> - if (!is_srgb_test)
> + if (is_srgb_test)
>   piglit_require_extension("GL_EXT_texture_sRGB_decode");
>  
>   GLint pixel_offset_loc = glGetUniformLocation(prog, "pixel_offset");
> -- 
> 2.5.5
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/5] khr_compressed_astc-miptree-array requires GL_ARB_ES3_compatibility

2016-07-18 Thread Nanley Chery
On Thu, Jul 07, 2016 at 04:28:09PM -0700, Anuj Phogat wrote:

Why does it require this extension?

- Nanley

> Signed-off-by: Anuj Phogat 
> ---
>  .../khr_texture_compression_astc/khr_compressed_astc-miptree-array.c   | 3 
> +++
>  1 file changed, 3 insertions(+)
> 
> diff --git 
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c 
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c
> index e332bad..199924c 100644
> --- 
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c
> +++ 
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c
> @@ -263,6 +263,9 @@ piglit_init(int argc, char **argv)
>  
>   piglit_require_extension("GL_KHR_texture_compression_astc_ldr");
>  
> + if (!piglit_is_gles())
> + piglit_require_extension("GL_ARB_ES3_compatibility");
> +
>   glClearColor(0.9098, 0.8314, 0.7843, 1.0);
>   glViewport(0, 0, piglit_width, piglit_height);
>  
> -- 
> 2.5.5
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] khr_texture_compression_astc: Allow TEXTURE_3D target if sliced_3d is supported

2016-07-15 Thread Nanley Chery
On Thu, Jul 14, 2016 at 02:28:31PM -0700, Anuj Phogat wrote:
> Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
> ---

This patch is,

Reviewed-by: Nanley Chery <nanley.g.ch...@intel.com>

>  .../khr_texture_compression_astc/khr_compressed_astc-basic.c  | 11 
> ---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> 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
> index 0269e3a..dda8229 100644
> --- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c
> +++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c
> @@ -154,7 +154,8 @@ have_gen_mipmap_support()
>   *   the TEXTURE_CUBE_MAP_ARRAY target.
>   *
>   */
> -void test_compressed_teximg_3d(int fi, bool have_cube_map_ext, bool have_hdr)
> +void test_compressed_teximg_3d(int fi, bool have_cube_map_ext,
> +bool have_hdr_or_sliced_3d)
>  {
>   int j;
>   GLuint tex3D;
> @@ -175,7 +176,7 @@ void test_compressed_teximg_3d(int fi, bool 
> have_cube_map_ext, bool have_hdr)
>  
>   /* Test expected GL errors */
>   if (good_compressed_tex_3d_targets[j] == GL_TEXTURE_3D
> - && !have_hdr) {
> + && !have_hdr_or_sliced_3d) {
>   REQUIRE_ERROR(GL_INVALID_OPERATION);
>   } else {
>   REQUIRE_ERROR(GL_NO_ERROR);
> @@ -371,13 +372,17 @@ piglit_display(void)
>   bool have_gen_mipmap   = have_gen_mipmap_support();
>   bool have_hdr = piglit_is_extension_supported(
>   "GL_KHR_texture_compression_astc_hdr");
> + bool have_hdr_or_sliced_3d = have_hdr ||
> + piglit_is_extension_supported(
> + "GL_KHR_texture_compression_astc_sliced_3d");
>  
>   for (i = 0; i < ARRAY_SIZE(formats); i++) {
>   if (have_cube_map_ext)
>   test_non_square_img(i, have_hdr);
>   if (have_tex_stor_ext)
>   test_sub_img(i);
> - test_compressed_teximg_3d(i, have_cube_map_ext, have_hdr);
> + test_compressed_teximg_3d(i, have_cube_map_ext,
> +   have_hdr_or_sliced_3d);
>   test_tex_img(i, have_gen_mipmap);
>   }
>  
> -- 
> 2.5.5
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [CRUCIBLE] [PATCH] Add test for maximum buffer ranges

2016-07-13 Thread Nanley Chery
This test demonstrates a bug in mesa 29f53d793781b67a92bb95fe66d7d38adc5488bb ,
in which Anvil fails an ISL assertion that the maximum buffer range is less
than a certain size.

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 Makefile.am |   1 +
 src/tests/stress/buffer_limit.c | 102 
 2 files changed, 103 insertions(+)
 create mode 100644 src/tests/stress/buffer_limit.c

diff --git a/Makefile.am b/Makefile.am
index e2b3f42..a057d39 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -96,6 +96,7 @@ bin_crucible_SOURCES = \
src/tests/func/ssbo/interleave.c \
src/tests/func/renderpass/clear.c \
src/tests/stress/lots-of-surface-state.c \
+   src/tests/stress/buffer_limit.c \
src/tests/self/concurrent-output.c \
src/util/cru_cleanup.c \
src/util/cru_format.c \
diff --git a/src/tests/stress/buffer_limit.c b/src/tests/stress/buffer_limit.c
new file mode 100644
index 000..7bc94ca
--- /dev/null
+++ b/src/tests/stress/buffer_limit.c
@@ -0,0 +1,102 @@
+// Copyright 2016 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 buffer_limit.c
+// \brief Update a buffer descriptor to have the maximum range possible.
+
+#include "tapi/t.h"
+
+struct params {
+VkDescriptorType descriptor_type;
+};
+
+
+static void
+test_max_buffer()
+{
+const struct params *params = t_user_data;
+
+const uint32_t buffer_size = (params->descriptor_type ==
+  VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) ?
+   t_physical_dev_props->limits.maxUniformBufferRange :
+   t_physical_dev_props->limits.maxStorageBufferRange;
+
+/* Create a uniform buffer with-out memory-backing */
+VkBuffer buffer = qoCreateBuffer(t_device,
+ .usage = 
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT |
+  
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
+ .size = buffer_size);
+
+/* Allocate a descriptor set consisting of one binding */
+VkDescriptorSetLayout set_layout = qoCreateDescriptorSetLayout(t_device,
+.bindingCount = 1,
+.pBindings = (VkDescriptorSetLayoutBinding[]) {
+{
+.binding = 0,
+.descriptorType = params->descriptor_type,
+.descriptorCount = 1,
+.stageFlags = VK_SHADER_STAGE_VERTEX_BIT,
+.pImmutableSamplers = NULL,
+},
+});
+
+VkDescriptorSet set = qoAllocateDescriptorSet(t_device,
+.descriptorPool = t_descriptor_pool,
+.pSetLayouts = _layout);
+
+vkUpdateDescriptorSets(t_device,
+/*writeCount*/ 1,
+(VkWriteDescriptorSet[]) {
+{
+.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
+.dstSet = set,
+.dstBinding = 0,
+.dstArrayElement = 0,
+.descriptorCount = 1,
+.descriptorType = params->descriptor_type,
+.pBufferInfo = &(VkDescriptorBufferInfo) {
+.buffer = buffer,
+.offset = 0,
+.range = buffer_size,
+},
+},
+}, 0, NULL);
+
+qoEndCommandBuffer(t_cmd_buffer);
+}
+
+test_define {
+.name = "stress.limits.buffer-update.range.uniform",
+.start = test_max_buffer,
+.no_image = true,
+.user_data = &(struct params) {
+.descriptor_type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
+},
+};
+
+test_define {
+.name = "stress.limits.buffer-update.range.storage",
+.start = test_max_buffer,
+.

[Piglit] [PATCH 8/8] cru/func.desc.dynamic: Use a correct reference image

2016-07-13 Thread Nanley Chery
Commit 17685f385bad0f7e79772e2e5990e2e2572b6897 changed the uniform buffer
test's reference image although the test logic would have generated the
same image if it didn't have the bugs that commit introduced. Restore the
original image.

Since storage test's output is equivalent to that of the uniform test,
remove its custom image and reference the uniform buffer test's image.

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 data/func.desc.dynamic.storage-buffer.ref.png | Bin 268 -> 0 bytes
 data/func.desc.dynamic.uniform-buffer.ref.png | Bin 211 -> 201 bytes
 src/tests/func/desc/dynamic.c |   1 +
 3 files changed, 1 insertion(+)
 delete mode 100644 data/func.desc.dynamic.storage-buffer.ref.png

diff --git a/data/func.desc.dynamic.storage-buffer.ref.png 
b/data/func.desc.dynamic.storage-buffer.ref.png
deleted file mode 100644
index 
900bd30f2fe8f76ccd2c6f18088973893affb7d6..
GIT binary patch
literal 0
HcmV?d1

literal 268
zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=mpxq^Ln`LHy}fazlc9t|qB4JW
z?wUD=TxCwqymRuNU<t#{4*@=olv6T6zq>>`@{rU5>q-{|S!3??!G#kV&{L$6D
zBR}2L_MU}o-s(5Te_2EvxHGsGu$r)5V4B60!FcwO=ZF1oj+Op#dJ?>E@A(;ZOh}Tx
zj9VI(F(3>>)_XMi;nsW4O)vX9pegG4$L-^XCWfq0+<pef`|nOoDnRcsc)I$ztaD0e
F0sz!iVnP4_

diff --git a/data/func.desc.dynamic.uniform-buffer.ref.png 
b/data/func.desc.dynamic.uniform-buffer.ref.png
index 
82ad6c4ef22d4e20c06cbfb3d9a8c0c4d2b409ef..be99fc71010c8a6795fdb4f318dab16a1281543f
 100644
GIT binary patch
literal 201
zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJ37#~BEkm0|WGd*&
zi|{2lKC`KO?>{los7c!Mn(+fggI5iV<qX`4tZR;!3FY26y;epd>Crv=53eLY2uPG3
zXs~WbP&<O%dOyzGm_G}OCP*p<ZldQ@3CS~6;D`wexvC6D=f@%OpEy>3fKj7
yx;9>YexobA=wL(pffdYbcNlvX&%NAO#=y|-FT>{uKbLh*2~7ZTP)6?n

literal 211
zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=vpiiKLn`LHz2GQ#K!M?afdiv{
z%Y*y3Crmsp#k%+0=J)1xIWHO3GFmxgH}GAMTEM)8?FF5iy)OXk;
Jvd$@?2>?H2M_T{@

diff --git a/src/tests/func/desc/dynamic.c b/src/tests/func/desc/dynamic.c
index d44fc70..53af344 100644
--- a/src/tests/func/desc/dynamic.c
+++ b/src/tests/func/desc/dynamic.c
@@ -266,6 +266,7 @@ test(void)
 test_define {
 .name = "func.desc.dynamic.storage-buffer",
 .start = test,
+.image_filename = "func.desc.dynamic.uniform-buffer.ref.png",
 .user_data = &(struct params) {
 .descriptor_type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
 }
-- 
2.9.0

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


[Piglit] [PATCH 4/8] cru/func.desc.dynamic: Create the buffer with correct usage flags

2016-07-13 Thread Nanley Chery
The buffer has two usages in each test variant. Create it with usage flags equal
to the union of both usage sets. This field is required to be non-zero.

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 src/tests/func/desc/dynamic.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/tests/func/desc/dynamic.c b/src/tests/func/desc/dynamic.c
index 9cf69ed..bb17fab 100644
--- a/src/tests/func/desc/dynamic.c
+++ b/src/tests/func/desc/dynamic.c
@@ -177,7 +177,11 @@ test(void)
 .descriptorPool = t_descriptor_pool,
 .pSetLayouts = _layout);
 
-VkBuffer buffer = qoCreateBuffer(t_device, .size = 4096);
+VkBuffer buffer = qoCreateBuffer(t_device,
+ .usage = 
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT |
+  
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT |
+  
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
+ .size = 4096);
 
 VkDeviceMemory mem = qoAllocBufferMemory(t_device, buffer,
 .memoryTypeIndex = t_mem_type_index_for_mmap);
-- 
2.9.0

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


[Piglit] [PATCH 3/8] cru: Add tests for binding descriptor sets

2016-07-13 Thread Nanley Chery
This test isolates a bug in mesa 0f7a6ea5e7b95cfe10dd5c176858ca078b36a197 ,
where the driver segfaults when binding partly defined dynamic descriptor
sets. This bug was discovered through func.desc.dynamic.storage-buffer.

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 Makefile.am   |   1 +
 src/tests/func/desc/binding.c | 189 ++
 2 files changed, 190 insertions(+)
 create mode 100644 src/tests/func/desc/binding.c

diff --git a/Makefile.am b/Makefile.am
index 40e1d22..e2b3f42 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -80,6 +80,7 @@ bin_crucible_SOURCES = \
src/tests/func/depthstencil/basic.c \
src/tests/func/depthstencil/stencil_triangles.c \
src/tests/func/desc/dynamic.c \
+   src/tests/func/desc/binding.c \
src/tests/func/draw-indexed.c \
src/tests/func/event.c \
src/tests/func/gs/basic.c \
diff --git a/src/tests/func/desc/binding.c b/src/tests/func/desc/binding.c
new file mode 100644
index 000..8bd3360
--- /dev/null
+++ b/src/tests/func/desc/binding.c
@@ -0,0 +1,189 @@
+// Copyright 2016 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 binding.c
+// \brief Test that binding a DescriptorSet with undefined descriptors works 
without
+//crashing the driver.
+//
+// Vulkan Specification 13.2.3. Allocation of Descriptor Sets:
+// When a descriptor set is allocated, the initial state is largely
+// uninitialized and all descriptors are undefined. However, the descriptor
+// set can be bound in a command buffer without causing errors or
+// exceptions. All entries that are statically used by a pipeline in a
+// drawing or dispatching command must have been populated before the
+// descriptor set is bound for use by that command. Entries that are not
+// statically used by a pipeline can have uninitialized descriptors or
+// descriptors of resources that have been destroyed, and executing a draw
+// or dispatch with such a descriptor set bound does not cause undefined
+// behavior. This means applications need not populate unused entries with
+// dummy descriptors.
+
+#include "tapi/t.h"
+
+enum bindings_defined {
+  BD_NONE,
+  BD_SOME,
+  BD_ALL,
+};
+
+struct params {
+enum bindings_defined num_def;
+};
+
+static void
+test(void)
+{
+const struct params *params = t_user_data;
+
+/* Create a uniform buffer with memory-backing */
+const uint32_t buffer_size = 4096;
+VkBuffer buffer = qoCreateBuffer(t_device,
+ .usage = 
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
+ .size = buffer_size);
+
+VkDeviceMemory mem = qoAllocBufferMemory(t_device, buffer,
+.memoryTypeIndex = t_mem_type_index_for_mmap);
+
+qoBindBufferMemory(t_device, buffer, mem, 0);
+
+/* Allocate a descriptor set consisting of two bindings */
+VkDescriptorSetLayout set_layout = qoCreateDescriptorSetLayout(t_device,
+.bindingCount = 2,
+.pBindings = (VkDescriptorSetLayoutBinding[]) {
+{
+.binding = 0,
+.descriptorType = 
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC,
+.descriptorCount = 1,
+.stageFlags = VK_SHADER_STAGE_VERTEX_BIT,
+.pImmutableSamplers = NULL,
+},
+{
+.binding = 1,
+.descriptorType = 
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC,
+.descriptorCount = 1,
+.stageFlags = VK_SHADER_STAGE_VERTEX_BIT,
+.pImmutableSamplers = NULL,
+},
+});
+
+VkDescriptorSet set = qoAllocateDescriptorSet(t_device,
+   

[Piglit] [PATCH 0/8] cru: Test fixes and additions for dynamic descriptors

2016-07-13 Thread Nanley Chery
This series fixes bugs surrounding the following test groups that crash on the
Vulkan driver:
* func.desc.dynamic
* stress.lots-of-surface-state
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96850

It also adds a new test group, func.desc.binding, which demonstrates a bug in
the Vulkan driver (see commit for details).

Nanley Chery (8):
  cru: Conform infrastructure to Vulkan Specification 1.0.20
  cru/stress.lots-of-surface-state: Specify the right DescriptorType
  cru: Add tests for binding descriptor sets
  cru/func.desc.dynamic: Create the buffer with correct usage flags
  cru/func.desc.dynamic: Set required VkRenderPassBeginInfo::sType field
  cru/func.desc.dynamic: Bind the correct number of vertex buffers
  cru/func.desc.dynamic: Fix the subtests
  cru/func.desc.dynamic: Use a correct reference image

 Makefile.am   |   1 +
 data/func.desc.dynamic.storage-buffer.ref.png | Bin 268 -> 0 bytes
 data/func.desc.dynamic.uniform-buffer.ref.png | Bin 211 -> 201 bytes
 src/framework/test/t_phase_setup.c|  63 -
 src/qonos/qonos.c |   1 +
 src/qonos/qonos_pipeline.c|  14 +-
 src/tests/func/desc/binding.c | 189 ++
 src/tests/func/desc/dynamic.c |  34 ++---
 src/tests/stress/lots-of-surface-state.c  |   2 +-
 src/util/cru_vk_image.c   |   1 +
 10 files changed, 277 insertions(+), 28 deletions(-)
 delete mode 100644 data/func.desc.dynamic.storage-buffer.ref.png
 create mode 100644 src/tests/func/desc/binding.c

-- 
2.9.0

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


[Piglit] [PATCH 7/8] cru/func.desc.dynamic: Fix the subtests

2016-07-13 Thread Nanley Chery
The uniform buffer test is fixed by updating the right DescriptorSet binding.

The storage test failed, at least, because of the following bugs:
 * It assigned uint array indices float color values
 * It provided 1 dynamic offset instead of 3
 * It did not specify the dynamic variant of
   VkDescriptorSetLayoutBinding::descriptorType

This patch removes these bugs by simply making the storage buffer test
parallel to that of the uniform buffer test.

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 src/tests/func/desc/dynamic.c | 24 +++-
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/src/tests/func/desc/dynamic.c b/src/tests/func/desc/dynamic.c
index 238eb8f..d44fc70 100644
--- a/src/tests/func/desc/dynamic.c
+++ b/src/tests/func/desc/dynamic.c
@@ -50,18 +50,15 @@ create_pipeline(VkDevice device,
 } else {
 vs = qoCreateShaderModuleGLSL(t_device, VERTEX,
 layout(location = 0) in vec4 a_position;
-layout(std140, set = 0, binding = 0) uniform block2 {
-uint i;
-} u1;
-layout(std140, set = 0, binding = 1) buffer block1 {
+layout(std140, set = 0, binding = 0) buffer block1 {
 vec4 color;
 vec4 offset;
-} s1[2];
+} s1;
 layout(location = 0) flat out vec4 v_color;
 void main()
 {
-gl_Position = a_position + s1[u1.i].offset;
-v_color = s1[u1.i].color;
+gl_Position = a_position + s1.offset;
+v_color = s1.color;
 });
 }
 
@@ -148,19 +145,12 @@ test(void)
 const struct params *params = t_user_data;
 
 VkDescriptorSetLayout set_layout = qoCreateDescriptorSetLayout(t_device,
-.bindingCount = 2,
+.bindingCount = 1,
 .pBindings = (VkDescriptorSetLayoutBinding[]) {
 {
 .binding = 0,
-.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
-.descriptorCount = 1,
-.stageFlags = VK_SHADER_STAGE_VERTEX_BIT,
-.pImmutableSamplers = NULL,
-},
-{
-.binding = 1,
 .descriptorType = params->descriptor_type,
-.descriptorCount = 2,
+.descriptorCount = 1,
 .stageFlags = VK_SHADER_STAGE_VERTEX_BIT,
 .pImmutableSamplers = NULL,
 },
@@ -218,7 +208,7 @@ test(void)
 {
 .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
 .dstSet = set,
-.dstBinding = 1,
+.dstBinding = 0,
 .dstArrayElement = 0,
 .descriptorCount = 1,
 .descriptorType = params->descriptor_type,
-- 
2.9.0

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


[Piglit] [PATCH 1/8] cru: Conform to Vulkan Specification 1.0.20

2016-07-13 Thread Nanley Chery
I used the Vulkan Validation layers to determine the areas of
non-conformance.

Changes:
 * Provide required fields:
   - VkFramebufferCreateInfo::renderPass
   - VkSubmitInfo::sType
   - VkDeviceQueueCreateInfo::sType
   - VkDeviceQueueCreateInfo::pQueuePriorities
 * Assign the right bit to VkDescriptorPoolCreateInfo::flags for the
   freeing which occurs during cleanup.
 * Use the correct VkDescriptorPoolCreateInfo::poolSizeCount value.
   This fixes a bug in DescriptorPool creation in which DescriptorTypes
   after STORAGE_TEXEL_BUFFER were not being added to the pool.
 * Set VkGraphicsPipelineCreateInfo::pDynamicState to NULL if
   VkPipelineDynamicStateCreateInfo::dynamicStateCount is zero

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 src/framework/test/t_phase_setup.c | 63 --
 src/qonos/qonos.c  |  1 +
 src/qonos/qonos_pipeline.c | 14 +
 src/util/cru_vk_image.c|  1 +
 4 files changed, 71 insertions(+), 8 deletions(-)

diff --git a/src/framework/test/t_phase_setup.c 
b/src/framework/test/t_phase_setup.c
index a46b169..b3cd046 100644
--- a/src/framework/test/t_phase_setup.c
+++ b/src/framework/test/t_phase_setup.c
@@ -207,6 +207,30 @@ t_setup_framebuffer(void)
 
 attachments[n_attachments++] = t->vk.color_image_view;
 
+VkRenderPass color_pass = qoCreateRenderPass(t_device,
+.attachmentCount = 1,
+.pAttachments = (VkAttachmentDescription[]) {
+{
+QO_ATTACHMENT_DESCRIPTION_DEFAULTS,
+.format = VK_FORMAT_R8G8B8A8_UNORM,
+},
+},
+.subpassCount = 1,
+.pSubpasses = (VkSubpassDescription[]) {
+{
+QO_SUBPASS_DESCRIPTION_DEFAULTS,
+.colorAttachmentCount = 1,
+.pColorAttachments = (VkAttachmentReference[]) {
+{
+.attachment = 0,
+.layout = VK_IMAGE_LAYOUT_GENERAL,
+},
+},
+}
+});
+
+VkRenderPass pass = color_pass;
+
 if (t->def->depthstencil_format != VK_FORMAT_UNDEFINED) {
 t->vk.ds_image = qoCreateImage(t->vk.device,
 .format = t->def->depthstencil_format,
@@ -258,9 +282,42 @@ t_setup_framebuffer(void)
 });
 
 attachments[n_attachments++] = t->vk.depthstencil_image_view;
+
+VkRenderPass color_depth_pass = qoCreateRenderPass(t_device,
+.attachmentCount = 2,
+.pAttachments = (VkAttachmentDescription[]) {
+{
+QO_ATTACHMENT_DESCRIPTION_DEFAULTS,
+.format = VK_FORMAT_R8G8B8A8_UNORM,
+},
+{
+QO_ATTACHMENT_DESCRIPTION_DEFAULTS,
+.format = t->def->depthstencil_format,
+},
+},
+.subpassCount = 1,
+.pSubpasses = (VkSubpassDescription[]) {
+{
+QO_SUBPASS_DESCRIPTION_DEFAULTS,
+.colorAttachmentCount = 1,
+.pColorAttachments = (VkAttachmentReference[]) {
+{
+.attachment = 0,
+.layout = VK_IMAGE_LAYOUT_GENERAL,
+},
+},
+.pDepthStencilAttachment = &(VkAttachmentReference) {
+.attachment = 1,
+.layout = VK_IMAGE_LAYOUT_GENERAL,
+},
+},
+});
+
+pass = color_depth_pass;
 }
 
 t->vk.framebuffer = qoCreateFramebuffer(t->vk.device,
+.renderPass = pass,
 .width = t->ref.width,
 .height = t->ref.height,
 .layers = 1,
@@ -283,9 +340,9 @@ t_setup_descriptor_pool(void)
 const VkDescriptorPoolCreateInfo create_info = {
 .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
 .pNext = NULL,
-.flags = 0,
+.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,
 .maxSets = 1,
-.poolSizeCount = 5,
+.poolSizeCount = VK_DESCRIPTOR_TYPE_RANGE_SIZE,
 .pPoolSizes = pool_sizes
 };
 
@@ -320,8 +377,10 @@ t_setup_vulkan(void)
 .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
 .queueCreateInfoCount = 1,
 .pQueueCreateInfos = &(VkDeviceQueueCreateInfo) {
+.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
 .queueFamilyIndex = 0,
 .queueCount = 1,
+.pQueuePriorities = (float[]) {1.0f},
 },
 }, NULL, >vk.device);
 
diff --git a/src/qonos/qonos.c b/src/qonos/qonos.c
index 6d28f75..82a64e8 100644
--- a/src/qonos/qonos.c
+++ b/src/qonos/qonos.c
@@ -101,6 +101,7 @@ qoQueueSubmit(VkQueue queue, uint

[Piglit] [PATCH 6/8] cru/func.desc.dynamic: Bind the correct number of vertex buffers

2016-07-13 Thread Nanley Chery
The vertex shader has only one vertex input attribute.

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 src/tests/func/desc/dynamic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tests/func/desc/dynamic.c b/src/tests/func/desc/dynamic.c
index c57cd5c..238eb8f 100644
--- a/src/tests/func/desc/dynamic.c
+++ b/src/tests/func/desc/dynamic.c
@@ -242,7 +242,7 @@ test(void)
 }
 }, VK_SUBPASS_CONTENTS_INLINE);
 
-vkCmdBindVertexBuffers(t_cmd_buffer, 0, 2,
+vkCmdBindVertexBuffers(t_cmd_buffer, 0, 1,
(VkBuffer[]) { buffer },
(VkDeviceSize[]) { vertex_offset });
 vkCmdBindPipeline(t_cmd_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
-- 
2.9.0

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


[Piglit] [PATCH 2/8] cru/stress.lots-of-surface-state: Specify the right DescriptorType

2016-07-13 Thread Nanley Chery
Because the variable use_dynamic_offsets is true in this block,
the resource descriptor to be updated is actually a dynamic
uniform buffer.

Fixes:
 * stress.lots-of-surface-state.vs.dynamic
 * stress.lots-of-surface-state.fs.dynamic

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 src/tests/stress/lots-of-surface-state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tests/stress/lots-of-surface-state.c 
b/src/tests/stress/lots-of-surface-state.c
index c37e9b6..9a55bdf 100644
--- a/src/tests/stress/lots-of-surface-state.c
+++ b/src/tests/stress/lots-of-surface-state.c
@@ -230,7 +230,7 @@ test_lots_of_surface_state(VkShaderModule vs, 
VkShaderModule fs,
 .dstBinding = 0,
 .dstArrayElement = 0,
 .descriptorCount = 12,
-.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
+.descriptorType = 
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC,
 .pBufferInfo = buffer_info,
 },
 }, 0, NULL);
-- 
2.9.0

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


Re: [Piglit] [PATCH v2] readpixels-oob: Add a glReadPixels out-of-bounds test

2016-02-17 Thread Nanley Chery
On Wed, Feb 17, 2016 at 01:44:44PM -0700, Brian Paul wrote:
> On 02/17/2016 12:37 PM, Nanley Chery wrote:
> >From: Nanley Chery <nanley.g.ch...@intel.com>
> >
> >Test that glReadPixels for an area which reaches out of bounds
> >behaves like a glReadPixels into a sub-rectangle for the valid area.
> >This behavior reduces the number of corner cases associated with
> >this function.
> >
> >Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92193
> >
> >Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
> >
> >v2 (Brian Paul)
> >- Rename test and change path
> >- Use larger window dimensions and compute big buffer dims at runtime
> >- Use bool instead of GLboolean
> >- Remove extra function arguments
> >- Free allocated data
> >- Exercise more clipping code
> >---
> >  tests/all.py|   1 +
> >  tests/spec/gl-1.0/CMakeLists.gl.txt |   1 +
> >  tests/spec/gl-1.0/readpixels-oob.c  | 132 
> > 
> >  3 files changed, 134 insertions(+)
> >  create mode 100644 tests/spec/gl-1.0/readpixels-oob.c
> >
> >diff --git a/tests/all.py b/tests/all.py
> >index 89288a2..bb7c1dc 100644
> >--- a/tests/all.py
> >+++ b/tests/all.py
> >@@ -997,6 +997,7 @@ with profile.group_manager(
> >  g(['gl-1.0-edgeflag-const'])
> >  g(['gl-1.0-edgeflag-quads'])
> >  g(['gl-1.0-long-dlist'])
> >+g(['gl-1.0-readpixels-oob'])
> >  g(['gl-1.0-rendermode-feedback'])
> >  g(['gl-1.0-front-invalidate-back'], run_concurrent=False)
> >  g(['gl-1.0-swapbuffers-behavior'], run_concurrent=False)
> >diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
> >b/tests/spec/gl-1.0/CMakeLists.gl.txt
> >index 6ef9059..e1c534c 100644
> >--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
> >+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
> >@@ -26,6 +26,7 @@ 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-rastercolor rastercolor.c)
> >  piglit_add_executable (gl-1.0-readpixsanity readpix.c)
> >+piglit_add_executable (gl-1.0-readpixels-oob readpixels-oob.c)
> >  piglit_add_executable (gl-1.0-rendermode-feedback rendermode-feedback.c)
> >  piglit_add_executable (gl-1.0-swapbuffers-behavior swapbuffers-behavior.c)
> >
> >diff --git a/tests/spec/gl-1.0/readpixels-oob.c 
> >b/tests/spec/gl-1.0/readpixels-oob.c
> >new file mode 100644
> >index 000..44c0340
> >--- /dev/null
> >+++ b/tests/spec/gl-1.0/readpixels-oob.c
> >@@ -0,0 +1,132 @@
> >+/*
> >+ * Copyright © 2016 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 readpixels-oob.c
> >+ *
> >+ * Test that requesting an area larger than the readbuffer (with
> >+ * glReadPixels) will only modify the valid area in the user's buffer.
> >+ * This is equivalent to a user requesting to read into a sub-rectangle
> >+ * of the larger rectangle contained in the provided buffer (via
> >+ * PACK_ROW_LENGTH, PACK_SKIP_ROWS, PACK_SKIP_PIXELS).
> >+ *
> >+ * This behaviour ensures that Mesa does as little work as possible in
> >+ * this imprecise usage of glReadpixels. It also reduces the bugs that
> >+ * may occur with this special case by 

[Piglit] [PATCH v2] readpixels-oob: Add a glReadPixels out-of-bounds test

2016-02-17 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

Test that glReadPixels for an area which reaches out of bounds
behaves like a glReadPixels into a sub-rectangle for the valid area.
This behavior reduces the number of corner cases associated with
this function.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92193

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>

v2 (Brian Paul)
- Rename test and change path
- Use larger window dimensions and compute big buffer dims at runtime
- Use bool instead of GLboolean
- Remove extra function arguments
- Free allocated data
- Exercise more clipping code
---
 tests/all.py|   1 +
 tests/spec/gl-1.0/CMakeLists.gl.txt |   1 +
 tests/spec/gl-1.0/readpixels-oob.c  | 132 
 3 files changed, 134 insertions(+)
 create mode 100644 tests/spec/gl-1.0/readpixels-oob.c

diff --git a/tests/all.py b/tests/all.py
index 89288a2..bb7c1dc 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -997,6 +997,7 @@ with profile.group_manager(
 g(['gl-1.0-edgeflag-const'])
 g(['gl-1.0-edgeflag-quads'])
 g(['gl-1.0-long-dlist'])
+g(['gl-1.0-readpixels-oob'])
 g(['gl-1.0-rendermode-feedback'])
 g(['gl-1.0-front-invalidate-back'], run_concurrent=False)
 g(['gl-1.0-swapbuffers-behavior'], run_concurrent=False)
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index 6ef9059..e1c534c 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -26,6 +26,7 @@ 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-rastercolor rastercolor.c)
 piglit_add_executable (gl-1.0-readpixsanity readpix.c)
+piglit_add_executable (gl-1.0-readpixels-oob readpixels-oob.c)
 piglit_add_executable (gl-1.0-rendermode-feedback rendermode-feedback.c)
 piglit_add_executable (gl-1.0-swapbuffers-behavior swapbuffers-behavior.c)
 
diff --git a/tests/spec/gl-1.0/readpixels-oob.c 
b/tests/spec/gl-1.0/readpixels-oob.c
new file mode 100644
index 000..44c0340
--- /dev/null
+++ b/tests/spec/gl-1.0/readpixels-oob.c
@@ -0,0 +1,132 @@
+/*
+ * Copyright © 2016 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 readpixels-oob.c
+ *
+ * Test that requesting an area larger than the readbuffer (with
+ * glReadPixels) will only modify the valid area in the user's buffer.
+ * This is equivalent to a user requesting to read into a sub-rectangle
+ * of the larger rectangle contained in the provided buffer (via
+ * PACK_ROW_LENGTH, PACK_SKIP_ROWS, PACK_SKIP_PIXELS).
+ *
+ * This behaviour ensures that Mesa does as little work as possible in
+ * this imprecise usage of glReadpixels. It also reduces the bugs that
+ * may occur with this special case by converting it to an analogous
+ * common case.
+ *
+ */
+
+#include "piglit-util-gl.h"
+
+#define BIG_MULT 3
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static bool
+test_with_offsets(GLint x_offset, GLint y_offset)
+{
+   bool pass = true;
+   int x, y, i;
+
+   /* Allocate into an oversized buffer. We'll check that the contents
+* are still 0 after the glReadPixels.
+*/
+   const size_t num_chan = 4;
+   const size_t big_buf_h = piglit_height * BIG_MULT;
+   const size_t big_buf_w = piglit_width * BIG_MULT;
+   const size_t tot_elements = big_buf_h * big_buf_w * num_chan;
+   const size_t fb_w = piglit_width - MAX2(0, x_offset);
+   const size_t fb_h = piglit_height - MAX2(0, y_offset);
+   const unsigned dst_x = abs(MIN2(0, x_offset));
+   const unsigned dst_y = abs(MIN2(

Re: [Piglit] [PATCH] fbo-readpixels-oob: Add a glReadPixels out-of-bounds test

2016-02-16 Thread Nanley Chery
On Sat, Feb 13, 2016 at 10:26:49AM -0700, Brian Paul wrote:
> On 02/12/2016 03:24 PM, Nanley Chery wrote:
> >From: Nanley Chery <nanley.g.ch...@intel.com>
> >
> >Test that glReadPixels for an area which reaches out of bounds
> >behaves like a glReadPixels into a subrectangle for the valid area.
> >This behaviour reduces the number of corner cases associated with
> >this function.
> >
> >Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92193
> >
> >Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
> >---
> >  tests/all.py   |   1 +
> >  tests/fbo/CMakeLists.gl.txt|   1 +
> >  tests/fbo/fbo-readpixels-oob.c | 122 
> > +
> 
> This test isn't really specific to FBOs.  How about putting it under
> tests/spec/gl-1.0/readpixels-oob.c ?
> 

Sounds good. I had originally based this test off the fbo-readpixels test,
but it has changed to the point where FBOs aren't the focus.

> 
> >  3 files changed, 124 insertions(+)
> >  create mode 100644 tests/fbo/fbo-readpixels-oob.c
> >
> >diff --git a/tests/all.py b/tests/all.py
> >index 89288a2..71addfc 100644
> >--- a/tests/all.py
> >+++ b/tests/all.py
> >@@ -2987,6 +2987,7 @@ with profile.group_manager(
> >  g(['fbo-nodepth-test'])
> >  g(['fbo-nostencil-test'])
> >  g(['fbo-readpixels'])
> >+g(['fbo-readpixels-oob'])
> >  g(['fbo-readpixels-depth-formats'])
> >  g(['fbo-scissor-bitmap'])
> >  g(['fbo-storage-completeness'])
> >diff --git a/tests/fbo/CMakeLists.gl.txt b/tests/fbo/CMakeLists.gl.txt
> >index 0476b10..6a33af8 100644
> >--- a/tests/fbo/CMakeLists.gl.txt
> >+++ b/tests/fbo/CMakeLists.gl.txt
> >@@ -77,6 +77,7 @@ piglit_add_executable (fbo-mrt-new-bind fbo-mrt-new-bind.c)
> >  piglit_add_executable (fbo-nodepth-test fbo-nodepth-test.c)
> >  piglit_add_executable (fbo-nostencil-test fbo-nostencil-test.c)
> >  piglit_add_executable (fbo-readpixels fbo-readpixels.c)
> >+piglit_add_executable (fbo-readpixels-oob fbo-readpixels-oob.c)
> >  piglit_add_executable (fbo-readpixels-depth-formats 
> > fbo-readpixels-depth-formats.c)
> >  piglit_add_executable (fbo-rg fbo-rg.c)
> >  piglit_add_executable (fbo-scissor-blit fbo-scissor-blit.c)
> >diff --git a/tests/fbo/fbo-readpixels-oob.c b/tests/fbo/fbo-readpixels-oob.c
> >new file mode 100644
> >index 000..19d4dd4
> >--- /dev/null
> >+++ b/tests/fbo/fbo-readpixels-oob.c
> >@@ -0,0 +1,122 @@
> >+/*
> >+ * Copyright © 2016 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 fbo-readpixels-oob.c
> >+ *
> >+ * Test that requesting an area larger than the readbuffer (with
> >+ * glReadPixels) will only modify the valid area in the user's buffer.
> >+ * This is equivalent to a user requesting to read into a sub-rectangle
> >+ * of the larger rectangle contained in the provided buffer (via
> >+ * PACK_ROW_LENGTH, PACK_SKIP_ROWS, PACK_SKIP_PIXELS).
> 
> Actually, is that really true?  The spec says "If any of these pixels lies
> outside of the window allocated to the current GL context, or outside of the
> image attached to the currently bound read framebuffer object, then the
> values obtained for those pixels are undefined."
> 
> It doesn't say those pixels will be u

[Piglit] [PATCH] fbo-readpixels-oob: Add a glReadPixels out-of-bounds test

2016-02-12 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

Test that glReadPixels for an area which reaches out of bounds
behaves like a glReadPixels into a subrectangle for the valid area.
This behaviour reduces the number of corner cases associated with
this function.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92193

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 tests/all.py   |   1 +
 tests/fbo/CMakeLists.gl.txt|   1 +
 tests/fbo/fbo-readpixels-oob.c | 122 +
 3 files changed, 124 insertions(+)
 create mode 100644 tests/fbo/fbo-readpixels-oob.c

diff --git a/tests/all.py b/tests/all.py
index 89288a2..71addfc 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2987,6 +2987,7 @@ with profile.group_manager(
 g(['fbo-nodepth-test'])
 g(['fbo-nostencil-test'])
 g(['fbo-readpixels'])
+g(['fbo-readpixels-oob'])
 g(['fbo-readpixels-depth-formats'])
 g(['fbo-scissor-bitmap'])
 g(['fbo-storage-completeness'])
diff --git a/tests/fbo/CMakeLists.gl.txt b/tests/fbo/CMakeLists.gl.txt
index 0476b10..6a33af8 100644
--- a/tests/fbo/CMakeLists.gl.txt
+++ b/tests/fbo/CMakeLists.gl.txt
@@ -77,6 +77,7 @@ piglit_add_executable (fbo-mrt-new-bind fbo-mrt-new-bind.c)
 piglit_add_executable (fbo-nodepth-test fbo-nodepth-test.c)
 piglit_add_executable (fbo-nostencil-test fbo-nostencil-test.c)
 piglit_add_executable (fbo-readpixels fbo-readpixels.c)
+piglit_add_executable (fbo-readpixels-oob fbo-readpixels-oob.c)
 piglit_add_executable (fbo-readpixels-depth-formats 
fbo-readpixels-depth-formats.c)
 piglit_add_executable (fbo-rg fbo-rg.c)
 piglit_add_executable (fbo-scissor-blit fbo-scissor-blit.c)
diff --git a/tests/fbo/fbo-readpixels-oob.c b/tests/fbo/fbo-readpixels-oob.c
new file mode 100644
index 000..19d4dd4
--- /dev/null
+++ b/tests/fbo/fbo-readpixels-oob.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright © 2016 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 fbo-readpixels-oob.c
+ *
+ * Test that requesting an area larger than the readbuffer (with
+ * glReadPixels) will only modify the valid area in the user's buffer.
+ * This is equivalent to a user requesting to read into a sub-rectangle
+ * of the larger rectangle contained in the provided buffer (via
+ * PACK_ROW_LENGTH, PACK_SKIP_ROWS, PACK_SKIP_PIXELS).
+ *
+ * This behaviour ensures that Mesa does as little work as possible in
+ * this imprecise usage of glReadpixels. It also reduces the bugs that
+ * may occur with this special case by converting it to an analogous
+ * common case.
+ *
+ */
+
+#include "piglit-util-gl.h"
+
+#define BUF_WIDTH 64
+#define BUF_HEIGHT 64
+#define BIG_MULT 4
+#define BIG_BUF_WIDTH (BIG_MULT * BUF_WIDTH)
+#define BIG_BUF_HEIGHT (BIG_MULT * BUF_HEIGHT)
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.window_width = BUF_WIDTH;
+   config.window_height = BUF_HEIGHT;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLboolean
+test_with_format(GLenum internal_format, GLenum format,
+float results_x, float results_y)
+{
+   GLboolean pass = GL_TRUE;
+   int x, y;
+   int i;
+
+   /* Allocate into an oversized buffer. We'll check that the contents
+* are still 0 after the glReadPixels.
+*/
+   const size_t num_chan = 4;
+   const size_t tot_elements = BIG_BUF_HEIGHT * BIG_BUF_WIDTH * num_chan;
+   GLubyte * black_img = (GLubyte*)calloc(tot_elements, sizeof(GLubyte));
+   GLfloat * black_imgf = (GLfloat*)malloc(tot_elements *sizeof(GLfloat));
+
+   /* Clear background to purple */
+   glClearColor(1.0, 0.0, 1.0, 0.0);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   /* Perform over-sized glReadPixels. Read the readbuffer as
+

Re: [Piglit] [PATCH 2/2] framework/backends/junit.py: Handle tests with subtests as testsuite elements

2015-12-04 Thread Nanley Chery
On Fri, Dec 04, 2015 at 04:21:00PM -0800, baker.dyla...@gmail.com wrote:
> From: Dylan Baker 
> 
> Currently the JUnit backend has no way to represent subtests in such a
> way that they can be understood by jenkins and by the summary tools.
> 
> Mark, Nanley and myself consulted and came up with several approaches,
> each with serious drawbacks:
> 1. Print the subtest statuses into stdout or stderr nodes in the JUnit.
>This has the advantage of being simple, but has a problem with being
>shadowed by an expected-. If subtest A fails, an expected
>fail can be entered. If subtest B also starts failing, no one will
>notice. This wont work
> 2. Treat each subtest as a full test, and the test as a group. I have
>two reservations about this approach. It's different than the JSON
>for one, and there isn't a good way to turn the JUnit back into the
>piglit internal representation using this approach, which would make
>running JUnit results through the piglit status tools difficult. This
>would also massively inflate the size of the JSON results, and that's
>already becoming a problem for us.
> 3. Create a main test entry, and then subtest entries as well, which
>pointed back to the original test as the parent in their stdout. This
>also has shadowing problems, and would still make the XML very large.
> 
> The final approach taken was suggested by Nanely, to turn tests with

s/Nanely/Nanley/

Thanks for working on this!

> subtests into a testsuite element, which could represent the shared
> values (stdout, stderr), and could hold individual testcases elements
> for each subtest. This solves the shadowing issue, and introduces less
> file size increase than the other ideas floated.
> 
> Also adds test for the new feature.
> 
> cc: mark.a.ja...@intel.com
> cc: jfons...@vmware.com
> Signed-off-by: Dylan Baker 
> ---
>  framework/backends/junit.py | 174 +--
>  framework/tests/junit_backends_tests.py | 206 
> +++-
>  2 files changed, 343 insertions(+), 37 deletions(-)
> 
> diff --git a/framework/backends/junit.py b/framework/backends/junit.py
> index 34df300..329fc4b 100644
> --- a/framework/backends/junit.py
> +++ b/framework/backends/junit.py
> @@ -117,8 +117,6 @@ class JUnitBackend(FileBackend):
>  
>  shutil.rmtree(os.path.join(self._dest, 'tests'))
>  
> -
> -
>  def _write(self, f, name, data):
>  # Split the name of the test and the group (what junit refers to as
>  # classname), and replace piglits '/' separated groups with '.', 
> after
> @@ -135,11 +133,41 @@ class JUnitBackend(FileBackend):
>  # set different root names.
>  classname = 'piglit.' + classname
>  
> -element = self.__make_case(testname, classname, data)
> +if data.subtests:
> +# If there are subtests treat the test as a suite instead of a
> +# test, set system-out, system-err, and time on the suite rather
> +# than on the testcase
> +name='{}.{}'.format(classname, testname)
> +element = etree.Element(
> +'testsuite',
> +name=name,
> +time=str(data.time.total))
> +
> +out = etree.SubElement(element, 'system-out')
> +out.text = data.command + '\n' + data.out
> +err = etree.SubElement(element, 'system-err')
> +err.text = data.err
> +err.text += '\n\nstart time: {}\nend time: {}\n'.format(
> +data.time.start, data.time.end)
> +
> +for name, result in data.subtests.iteritems():
> +sub = self.__make_subcase(name, result, err)
> +out = etree.SubElement(sub, 'system-out')
> +out.text = 'I am a subtest of {}'.format(name)
> +element.append(sub)
> +
> +for attrib, xpath in [('failures', './/testcase/failure'),
> +  ('errors', './/testcase/error'),
> +  ('skipped', './/testcase/skipped'),
> +  ('tests', './/testcase')]:
> +element.attrib[attrib] = str(len(element.findall(xpath)))
> +
> +else:
> +element = self.__make_case(testname, classname, data)
> +
>  f.write(etree.tostring(element))
>  
> -def __make_case(self, testname, classname, data):
> -"""Create a test case element and return it."""
> +def __make_name(self, testname):
>  # Jenkins will display special pages when the test has certain names,
>  # so add '_' so the tests don't match those names
>  # https://jenkins-ci.org/issue/18062
> @@ -148,17 +176,68 @@ class JUnitBackend(FileBackend):
>  if full_test_name in _JUNIT_SPECIAL_NAMES:
>  testname += '_'
>  full_test_name = testname + self._test_suffix
> 

[Piglit] [PATCH v4] khr_texture_compression_astc: Rewrite miptree test

2015-12-03 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

Modify the miptree test to only run one subset of ASTC formats
at a time.

v2. Modify miptree test to only check the given subtest.
Use the -subtest option to run a specific subtest.
v3. Indent function arguments and misc cleanups (Ilia).
Initialize texture objects to 0 (Ilia).
v4. Don't enumerate subtests in all.py (Ilia).

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 .../khr_compressed_astc-miptree.c  | 84 +-
 1 file changed, 34 insertions(+), 50 deletions(-)

diff --git 
a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c 
b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
index 20f2415..6429c2e 100644
--- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
+++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
@@ -222,10 +222,9 @@ bool draw_compare_levels(bool check_error, bool check_srgb,
 enum piglit_result
 test_miptrees(void* input_type)
 {
-   int subtest =  0;
-   enum test_type * type = (enum test_type*) input_type;
-   bool is_srgb_test = *type == TEST_TYPE_SRGB;
-   bool is_hdr_test  = *type == TEST_TYPE_HDR;
+   const enum test_type subtest = *(enum test_type*) input_type;
+   const bool is_srgb_test = subtest == TEST_TYPE_SRGB;
+   const bool is_hdr_test  = subtest == TEST_TYPE_HDR;
 
static const char * tests[3] = {"hdr", "ldrl", "ldrs"};
static const char * block_dim_str[14] = {
@@ -245,62 +244,47 @@ test_miptrees(void* input_type)
"12x12"
};
 
-   bool has_hdr = piglit_is_extension_supported(
-   "GL_KHR_texture_compression_astc_hdr");
-
-   /* If testing sRGB mode, fast-forward to the srgb test. */
-   if (is_srgb_test) {
-   subtest =  TEST_TYPE_SRGB;
-   } else {
-   /* Skip if on an HDR system not running the HDR test
-* or if on an LDR system running the HDR test.
-*/
-   if (has_hdr != is_hdr_test)
-   return PIGLIT_SKIP;
+   if (!is_srgb_test)
piglit_require_extension("GL_EXT_texture_sRGB_decode");
 
-   }
-
GLint pixel_offset_loc = glGetUniformLocation(prog, "pixel_offset");
GLint level_pixel_size_loc = glGetUniformLocation(prog,
"level_pixel_size");
 
-   /* Test each submode */
-   for (; subtest < ARRAY_SIZE(tests); ++subtest) {
-
-   /*  Check for error color if an LDR-only sys reading an HDR
-*  texture. No need to draw a reference mipmap in this case.
-*/
-   int check_error = !has_hdr && subtest == TEST_TYPE_HDR;
-   int block_dims = 0;
-   for (; block_dims < ARRAY_SIZE(block_dim_str); ++block_dims) {
-
-   /* Texture objects. */
-   GLuint tex_compressed;
-   GLuint tex_decompressed;
-
-   /* Load texture for current submode and block size */
-   load_texture("compressed", tests[subtest],
+   /*  Check for error color if an LDR-only sys reading an HDR
+*  texture. No need to draw a reference mipmap in this case.
+*/
+   const bool has_hdr = piglit_is_extension_supported(
+   "GL_KHR_texture_compression_astc_hdr");
+   const bool check_error = is_hdr_test && !has_hdr;
+   int block_dims;
+   for (block_dims = 0; block_dims < ARRAY_SIZE(block_dim_str); 
++block_dims) {
+
+   /* Texture objects. */
+   GLuint tex_compressed = 0;
+   GLuint tex_decompressed = 0;
+
+   /* Load texture for current submode and block size */
+   load_texture("compressed", tests[subtest],
+   block_dim_str[block_dims],
+   _compressed);
+   if (!check_error) {
+   load_texture("decompressed", tests[subtest],
block_dim_str[block_dims],
-   _compressed);
-   if (!check_error) {
-   load_texture("decompressed", tests[subtest],
-   block_dim_str[block_dims],
-   _decompressed);
-   }
+   _decompressed);
+   }
 
-   /* Draw and compare each level of the two textures */
-   glClear(GL_COLOR_BUFFER_BIT);
-   if (!draw_compare_l

Re: [Piglit] [PATCH v3] khr_texture_compression_astc: Enable subtest reports

2015-12-03 Thread Nanley Chery
On Tue, Dec 01, 2015 at 03:02:08PM -0800, Dylan Baker wrote:
> On Tue, Dec 01, 2015 at 02:14:04PM -0500, Ilia Mirkin wrote:
> > On Tue, Dec 1, 2015 at 1:58 PM, Nanley Chery <nanleych...@gmail.com> wrote:
> > > On Tue, Dec 01, 2015 at 10:21:23AM -0500, Ilia Mirkin wrote:
> > >> On Tue, Dec 1, 2015 at 1:31 AM, Nanley Chery <nanleych...@gmail.com> 
> > >> wrote:
> > >> > From: Nanley Chery <nanley.g.ch...@intel.com>
> > >> >
> > >> > Enable Jenkins to report the result of each individual subtest
> > >> > for the array and miptree ASTC tests. Modify the miptree test
> > >> > to only run one subset of ASTC formats at a time.
> > >> >
> > >> > v2. Modify miptree test to only check the given subtest.
> > >> > Use the -subtest option to run a specific subtest.
> > >> > v3. Indent function arguments and misc cleanups (Ilia).
> > >> > Initialize texture objects to 0 (Ilia).
> > >> >
> > >> > Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
> > >> > ---
> > >> >  tests/all.py   | 12 ++--
> > >> >  .../khr_compressed_astc-miptree.c  | 84 
> > >> > +-
> > >> >  2 files changed, 42 insertions(+), 54 deletions(-)
> > >> >
> > >> > diff --git a/tests/all.py b/tests/all.py
> > >> > index cfafa71..29ee6a9 100644
> > >> > --- a/tests/all.py
> > >> > +++ b/tests/all.py
> > >> > @@ -4223,12 +4223,16 @@ 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_gles3'], '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')
> > >> > -g(['khr_compressed_astc-miptree_gles2'], 'miptree-gles')
> > >> > +
> > >> > +for subtest in ('odd', 'even'):
> > >> > +g(['khr_compressed_astc-array_gl', '-subtest', subtest])
> > >> > +g(['khr_compressed_astc-array_gles3', '-subtest', subtest])
> > >> > +
> > >> > +for subtest in ('ldr', 'srgb', 'hdr'):
> > >> > +g(['khr_compressed_astc-miptree_gl', '-subtest', subtest])
> > >> > +g(['khr_compressed_astc-miptree_gles2', '-subtest', subtest])
> > >>
> > >> I still don't understand why you need this... what's wrong with the
> > >> current way? All the subtests should get run, and be properly
> > >> reported, without needing to be included one-by-one here. Does that
> > >> not happen?
> > >
> > > This enables the Jenkins CI system to report which specific subtest is
> > > failing - without having to inspect the error message to determine the
> > 
> > Wow, that seems like a pretty big failing for the jenkins integration
> > -- So basically if you use jenkins, subtests are useless? Should we be
> > discouraging them? I don't suppose fixing jenkins is an option?
> 
> I just need to fix the junit backend. I've been meaning to and keep
> forgetting. I'm working on it now.
> 

Sounds good.

Thanks,
Nanley

> > 
> > > cause after every run. One known failure is the sRGB miptree subtest.
> > > It's unresolved whether or not the issue lies within HW or the codec-
> > > provided texture. I would like to be notified when the other modes are
> > > failing as that would indicate something has broken in mesa.
> > 
> > Hm, well my experience with Qualcomm Adreno A420 is that (a) I get
> > black instead of the error color when loading HDR textures, and (b) I
> > need much wider color tolerances -- IIRC I said color had 6 bits of
> > resolution. Once I did that, the ldr and srgb tests both passed. Both
> > are attributable to incorrect programming of the hardware though.
> > There's no easy way (currently) to run piglit tests against android
> > userspace, and even if there were, their drivers tend to be pretty
> > weak in terms of ... working.
> > 
> > I couldn't get the array tests to work since I think they implicitly
> > depended on some higher GL *and* GLES version than what the freedreno
> > driver provides [GL 3.1, GLES 3.0].
> > 
> >   -ilia
> > ___
> > Piglit mailing list
> > Piglit@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit


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


Re: [Piglit] [PATCH v3] khr_texture_compression_astc: Enable subtest reports

2015-12-01 Thread Nanley Chery
On Tue, Dec 01, 2015 at 10:21:23AM -0500, Ilia Mirkin wrote:
> On Tue, Dec 1, 2015 at 1:31 AM, Nanley Chery <nanleych...@gmail.com> wrote:
> > From: Nanley Chery <nanley.g.ch...@intel.com>
> >
> > Enable Jenkins to report the result of each individual subtest
> > for the array and miptree ASTC tests. Modify the miptree test
> > to only run one subset of ASTC formats at a time.
> >
> > v2. Modify miptree test to only check the given subtest.
> > Use the -subtest option to run a specific subtest.
> > v3. Indent function arguments and misc cleanups (Ilia).
> > Initialize texture objects to 0 (Ilia).
> >
> > Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
> > ---
> >  tests/all.py   | 12 ++--
> >  .../khr_compressed_astc-miptree.c  | 84 
> > +-
> >  2 files changed, 42 insertions(+), 54 deletions(-)
> >
> > diff --git a/tests/all.py b/tests/all.py
> > index cfafa71..29ee6a9 100644
> > --- a/tests/all.py
> > +++ b/tests/all.py
> > @@ -4223,12 +4223,16 @@ 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_gles3'], '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')
> > -g(['khr_compressed_astc-miptree_gles2'], 'miptree-gles')
> > +
> > +for subtest in ('odd', 'even'):
> > +g(['khr_compressed_astc-array_gl', '-subtest', subtest])
> > +g(['khr_compressed_astc-array_gles3', '-subtest', subtest])
> > +
> > +for subtest in ('ldr', 'srgb', 'hdr'):
> > +g(['khr_compressed_astc-miptree_gl', '-subtest', subtest])
> > +g(['khr_compressed_astc-miptree_gles2', '-subtest', subtest])
> 
> I still don't understand why you need this... what's wrong with the
> current way? All the subtests should get run, and be properly
> reported, without needing to be included one-by-one here. Does that
> not happen?

This enables the Jenkins CI system to report which specific subtest is
failing - without having to inspect the error message to determine the
cause after every run. One known failure is the sRGB miptree subtest.
It's unresolved whether or not the issue lies within HW or the codec-
provided texture. I would like to be notified when the other modes are
failing as that would indicate something has broken in mesa.

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


Re: [Piglit] [PATCH v3] khr_texture_compression_astc: Enable subtest reports

2015-12-01 Thread Nanley Chery
On Tue, Dec 01, 2015 at 10:58:29AM -0800, Nanley Chery wrote:
> On Tue, Dec 01, 2015 at 10:21:23AM -0500, Ilia Mirkin wrote:
> > On Tue, Dec 1, 2015 at 1:31 AM, Nanley Chery <nanleych...@gmail.com> wrote:
> > > From: Nanley Chery <nanley.g.ch...@intel.com>
> > >
> > > Enable Jenkins to report the result of each individual subtest
> > > for the array and miptree ASTC tests. Modify the miptree test
> > > to only run one subset of ASTC formats at a time.
> > >
> > > v2. Modify miptree test to only check the given subtest.
> > > Use the -subtest option to run a specific subtest.
> > > v3. Indent function arguments and misc cleanups (Ilia).
> > > Initialize texture objects to 0 (Ilia).
> > >
> > > Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
> > > ---
> > >  tests/all.py   | 12 ++--
> > >  .../khr_compressed_astc-miptree.c  | 84 
> > > +-
> > >  2 files changed, 42 insertions(+), 54 deletions(-)
> > >
> > > diff --git a/tests/all.py b/tests/all.py
> > > index cfafa71..29ee6a9 100644
> > > --- a/tests/all.py
> > > +++ b/tests/all.py
> > > @@ -4223,12 +4223,16 @@ 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_gles3'], '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')
> > > -g(['khr_compressed_astc-miptree_gles2'], 'miptree-gles')
> > > +
> > > +for subtest in ('odd', 'even'):
> > > +g(['khr_compressed_astc-array_gl', '-subtest', subtest])
> > > +g(['khr_compressed_astc-array_gles3', '-subtest', subtest])
> > > +
> > > +for subtest in ('ldr', 'srgb', 'hdr'):
> > > +g(['khr_compressed_astc-miptree_gl', '-subtest', subtest])
> > > +g(['khr_compressed_astc-miptree_gles2', '-subtest', subtest])
> > 
> > I still don't understand why you need this... what's wrong with the
> > current way? All the subtests should get run, and be properly
> > reported, without needing to be included one-by-one here. Does that
> > not happen?
> 
> This enables the Jenkins CI system to report which specific subtest is
> failing - without having to inspect the error message to determine the
> cause after every run. One known failure is the sRGB miptree subtest.
> It's unresolved whether or not the issue lies within HW or the codec-
> provided texture. I would like to be notified when the other modes are
> failing as that would indicate something has broken in mesa.
> 

To answer the last part of your question, yes, each subtest does get
run in Piglit. The purpose of this hunk is to improve reporting in the
Jenkins CI system.

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


Re: [Piglit] [PATCH] astc: avoid deleting a random texture

2015-11-30 Thread Nanley Chery
On Mon, Nov 23, 2015 at 1:28 PM, Ilia Mirkin  wrote:

> On Mon, Nov 23, 2015 at 4:16 PM, Ian Romanick  wrote:
> > On 11/23/2015 12:43 PM, Ilia Mirkin wrote:
> >> On Mon, Nov 23, 2015 at 3:34 PM, Ian Romanick 
> wrote:
> >>> On 11/21/2015 04:08 PM, Ilia Mirkin wrote:
>  In the check_error case, decompressed_tex is completely uninitialized
>  and might point to any texture. This can wreak various havoc.
> >>>
>

Thanks for noticing this issue.


> >>> I might suggest a different approach.  In the check_error case, ensure
> >>> that decompress_texture is zero.  Remove the check_error parameter, and
> >>> s/!check_error/decompress_texture ==
> >>> 0/g;s/check_error/decompress_texture != 0/g.
> >>
> >> Is it legal to delete texture 0? Or can texture 0 be a real thing?
> >> Otherwise I can just initialize it to that below.
> >
> > It's similar to free(NULL) in that respect.  From the glDeleteTextures
> > man page:
> >
> >glDeleteTextures silently ignores 0's and names that do not
> correspond
> >to existing textures.
>
> Ah that's perfect. I should have checked the man page when I was
> futzing with the test.
>
> >
> >> Separately, how would you feel about making the error color decoding
> >> check failing return a warn instead of a fail? I can't get Adreno A420
> >> to spit it out... haven't tried on blob, perhaps I'm missing some bit
> >> of programming. I just get black with the HDR data instead of the
> >> error color.
> >
> > Hmm... I don't know how this particular test is structured.  When we've
> > had cases like this in the past, we've split the test into subcases.
> > One (or several) subcase checks the things that the driver in question
> > can pass, and one, single subcase checks the thing that the driver
> > fails.
> >
> > If this test is conducive that kind of a split (perhaps by running it
> > twice with different data), that would be my preference.
>
> Right now there are 3 subtests (ldr, hdr, srgb), each of which tests
> loading 3 sets of data (ldr, hdr, and ldr srgb). If there's no
> astc_hdr support, the hdr subtest isn't run, and when loading hdr
> data, it checks for the error color. Instead of 3 subtests, I could
> split this up into 9 subtests for the full cross -- does that sound
> reasonable, and then we'd pass the ldr-data ones and fail the hdr data
> ones.
>
> TBH I'm unsure what the diff between the ldr and hdr subtests is...
> they seem identical except that HDR one skips if you don't hdr. But
> otherwise it's identical to the LDR one from what I can tell. Also
> from the looks of it the srgb test doesn't need the full cross either,
> it only runs against the ldrs data. Urgh, I guess this test needs a
> bit of a redo :( Perhaps we can sucker Nanley into fixing it up?
>

I actually have a patch sitting on the list which redoes some of the logic:
http://lists.freedesktop.org/archives/piglit/2015-October/017743.html

The test previously wasn't splitting up into subtests correctly.

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


Re: [Piglit] [PATCH] khr_texture_compression_astc: Enable subtest reports

2015-11-30 Thread Nanley Chery
On Mon, Nov 30, 2015 at 03:50:04PM -0500, Ilia Mirkin wrote:
> On Wed, Oct 28, 2015 at 7:55 PM, Nanley Chery <nanleych...@gmail.com> wrote:
> > From: Nanley Chery <nanley.g.ch...@intel.com>
> >
> > Enable Piglit to report the result of each individual subtest
> > for the array and miptree ASTC tests. Modify the miptree test
> > to only run one subset of ASTC formats at a time.
> >
> > v2. Modify miptree test to only check the given subtest.
> > Use the -subtest option to run a specific subtest.
> >
> > Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
> > ---
> >  tests/all.py   | 12 ++-
> >  .../khr_compressed_astc-miptree.c  | 90 
> > +-
> >  2 files changed, 45 insertions(+), 57 deletions(-)
> >
> > diff --git a/tests/all.py b/tests/all.py
> > index 82e6311..c63cf15 100644
> > --- a/tests/all.py
> > +++ b/tests/all.py
> > @@ -4182,12 +4182,16 @@ 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_gles3'], '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')
> > -g(['khr_compressed_astc-miptree_gles2'], 'miptree-gles')
> > +
> > +for subtest in ('odd', 'even'):
> > +g(['khr_compressed_astc-array_gl', '-subtest', subtest])
> > +g(['khr_compressed_astc-array_gles3', '-subtest', subtest])
> > +
> > +for subtest in ('ldr', 'srgb', 'hdr'):
> > +g(['khr_compressed_astc-miptree_gl', '-subtest', subtest])
> > +g(['khr_compressed_astc-miptree_gles2', '-subtest', subtest])
> 
> Won't it auto-run all the subtests on its own? It did that for me, I'm
> pretty sure.
> 

It does auto-run all of them by default, however it is useful to know
which specific case is causing the test to fail.

> >
> >  with profile.group_manager(
> >   PiglitGLTest,
> > diff --git 
> > a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c 
> > b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> > index 20f2415..20d1c79 100644
> > --- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> > +++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> > @@ -222,10 +222,9 @@ bool draw_compare_levels(bool check_error, bool 
> > check_srgb,
> >  enum piglit_result
> >  test_miptrees(void* input_type)
> >  {
> > -   int subtest =  0;
> > -   enum test_type * type = (enum test_type*) input_type;
> > -   bool is_srgb_test = *type == TEST_TYPE_SRGB;
> > -   bool is_hdr_test  = *type == TEST_TYPE_HDR;
> > +   const enum test_type subtest = *(enum test_type*) input_type;
> > +   const bool is_srgb_test = subtest == TEST_TYPE_SRGB;
> > +   const bool is_hdr_test  = subtest == TEST_TYPE_HDR;
> >
> > static const char * tests[3] = {"hdr", "ldrl", "ldrs"};
> > static const char * block_dim_str[14] = {
> > @@ -245,62 +244,47 @@ test_miptrees(void* input_type)
> > "12x12"
> > };
> >
> > -   bool has_hdr = piglit_is_extension_supported(
> > -   "GL_KHR_texture_compression_astc_hdr");
> > -
> > -   /* If testing sRGB mode, fast-forward to the srgb test. */
> > -   if (is_srgb_test) {
> > -   subtest =  TEST_TYPE_SRGB;
> > -   } else {
> > -   /* Skip if on an HDR system not running the HDR test
> > -* or if on an LDR system running the HDR test.
> > -*/
> > -   if (has_hdr != is_hdr_test)
> > -   return PIGLIT_SKIP;
> > +   if (!is_srgb_test)
> > piglit_require_extension("GL_EXT_texture_sRGB_decode");
> 
> Which we sadly don't expose in GLES. (Although isn't the functionality
> part of GLES3?)
> 

Yes, we do no expose this in GLES. I'm not sure if it's part of GLES3.
I think someone should implement this in mesa. I started to do so, but
received some higher priority tasks.

> >
> > -   }
> > -
> > GLint pixel_off

Re: [Piglit] [PATCH] khr_texture_compression_astc: Enable subtest reports

2015-11-30 Thread Nanley Chery
On Mon, Nov 30, 2015 at 05:04:54PM -0800, Dylan Baker wrote:
> On Mon, Nov 30, 2015 at 04:34:40PM -0800, Nanley Chery wrote:
> > On Mon, Nov 30, 2015 at 03:50:04PM -0500, Ilia Mirkin wrote:
> > > On Wed, Oct 28, 2015 at 7:55 PM, Nanley Chery <nanleych...@gmail.com> 
> > > wrote:
> > > > From: Nanley Chery <nanley.g.ch...@intel.com>
> > > >
> > > > Enable Piglit to report the result of each individual subtest
> > > > for the array and miptree ASTC tests. Modify the miptree test
> > > > to only run one subset of ASTC formats at a time.
> > > >
> > > > v2. Modify miptree test to only check the given subtest.
> > > > Use the -subtest option to run a specific subtest.
> > > >
> > > > Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
> > > > ---
> > > >  tests/all.py   | 12 ++-
> > > >  .../khr_compressed_astc-miptree.c  | 90 
> > > > +-
> > > >  2 files changed, 45 insertions(+), 57 deletions(-)
> > > >
> > > > diff --git a/tests/all.py b/tests/all.py
> > > > index 82e6311..c63cf15 100644
> > > > --- a/tests/all.py
> > > > +++ b/tests/all.py
> > > > @@ -4182,12 +4182,16 @@ 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_gles3'], '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')
> > > > -g(['khr_compressed_astc-miptree_gles2'], 'miptree-gles')
> > > > +
> > > > +for subtest in ('odd', 'even'):
> > > > +g(['khr_compressed_astc-array_gl', '-subtest', subtest])
> > > > +g(['khr_compressed_astc-array_gles3', '-subtest', subtest])
> > > > +
> > > > +for subtest in ('ldr', 'srgb', 'hdr'):
> > > > +g(['khr_compressed_astc-miptree_gl', '-subtest', subtest])
> > > > +g(['khr_compressed_astc-miptree_gles2', '-subtest', subtest])
> > > 
> > > Won't it auto-run all the subtests on its own? It did that for me, I'm
> > > pretty sure.
> > > 
> > 
> > It does auto-run all of them by default, however it is useful to know
> > which specific case is causing the test to fail.
> 
> Alternatively you could use piglit_report_subtest_result when the test
> runs all subtests.
> 

The only place where piglit_report_result() is called is during the KTX
file loading function. Otherwise, piglit_report_subtest_result() is
called via piglit_run_selected_subtest(). By making the change in
all.py, it's easier to know which subtest is failing in Jenkins without
having to inspect the failure output. I suppose I should reword my
commit message.

-Nanley

> > 
> > > >
> > > >  with profile.group_manager(
> > > >   PiglitGLTest,
> > > > diff --git 
> > > > a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c 
> > > > b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> > > > index 20f2415..20d1c79 100644
> > > > --- 
> > > > a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> > > > +++ 
> > > > b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> > > > @@ -222,10 +222,9 @@ bool draw_compare_levels(bool check_error, bool 
> > > > check_srgb,
> > > >  enum piglit_result
> > > >  test_miptrees(void* input_type)
> > > >  {
> > > > -   int subtest =  0;
> > > > -   enum test_type * type = (enum test_type*) input_type;
> > > > -   bool is_srgb_test = *type == TEST_TYPE_SRGB;
> > > > -   bool is_hdr_test  = *type == TEST_TYPE_HDR;
> > > > +   const enum test_type subtest = *(enum test_type*) input_type;
> > > > +   const bool is_srgb_test = subtest == TEST_TYPE_SRGB;
> > > > +   const bool is_hdr_test  = subtest == TEST_TYPE_HDR;
> > > >
> > > > static const char * tests[3] = {"hdr&quo

[Piglit] [PATCH v3] khr_texture_compression_astc: Enable subtest reports

2015-11-30 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

Enable Jenkins to report the result of each individual subtest
for the array and miptree ASTC tests. Modify the miptree test
to only run one subset of ASTC formats at a time.

v2. Modify miptree test to only check the given subtest.
Use the -subtest option to run a specific subtest.
v3. Indent function arguments and misc cleanups (Ilia).
Initialize texture objects to 0 (Ilia).

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 tests/all.py   | 12 ++--
 .../khr_compressed_astc-miptree.c  | 84 +-
 2 files changed, 42 insertions(+), 54 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index cfafa71..29ee6a9 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4223,12 +4223,16 @@ 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_gles3'], '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')
-g(['khr_compressed_astc-miptree_gles2'], 'miptree-gles')
+
+for subtest in ('odd', 'even'):
+g(['khr_compressed_astc-array_gl', '-subtest', subtest])
+g(['khr_compressed_astc-array_gles3', '-subtest', subtest])
+
+for subtest in ('ldr', 'srgb', 'hdr'):
+g(['khr_compressed_astc-miptree_gl', '-subtest', subtest])
+g(['khr_compressed_astc-miptree_gles2', '-subtest', subtest])
 
 with profile.group_manager(
  PiglitGLTest,
diff --git 
a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c 
b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
index 20f2415..6429c2e 100644
--- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
+++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
@@ -222,10 +222,9 @@ bool draw_compare_levels(bool check_error, bool check_srgb,
 enum piglit_result
 test_miptrees(void* input_type)
 {
-   int subtest =  0;
-   enum test_type * type = (enum test_type*) input_type;
-   bool is_srgb_test = *type == TEST_TYPE_SRGB;
-   bool is_hdr_test  = *type == TEST_TYPE_HDR;
+   const enum test_type subtest = *(enum test_type*) input_type;
+   const bool is_srgb_test = subtest == TEST_TYPE_SRGB;
+   const bool is_hdr_test  = subtest == TEST_TYPE_HDR;
 
static const char * tests[3] = {"hdr", "ldrl", "ldrs"};
static const char * block_dim_str[14] = {
@@ -245,62 +244,47 @@ test_miptrees(void* input_type)
"12x12"
};
 
-   bool has_hdr = piglit_is_extension_supported(
-   "GL_KHR_texture_compression_astc_hdr");
-
-   /* If testing sRGB mode, fast-forward to the srgb test. */
-   if (is_srgb_test) {
-   subtest =  TEST_TYPE_SRGB;
-   } else {
-   /* Skip if on an HDR system not running the HDR test
-* or if on an LDR system running the HDR test.
-*/
-   if (has_hdr != is_hdr_test)
-   return PIGLIT_SKIP;
+   if (!is_srgb_test)
piglit_require_extension("GL_EXT_texture_sRGB_decode");
 
-   }
-
GLint pixel_offset_loc = glGetUniformLocation(prog, "pixel_offset");
GLint level_pixel_size_loc = glGetUniformLocation(prog,
"level_pixel_size");
 
-   /* Test each submode */
-   for (; subtest < ARRAY_SIZE(tests); ++subtest) {
-
-   /*  Check for error color if an LDR-only sys reading an HDR
-*  texture. No need to draw a reference mipmap in this case.
-*/
-   int check_error = !has_hdr && subtest == TEST_TYPE_HDR;
-   int block_dims = 0;
-   for (; block_dims < ARRAY_SIZE(block_dim_str); ++block_dims) {
-
-   /* Texture objects. */
-   GLuint tex_compressed;
-   GLuint tex_decompressed;
-
-   /* Load texture for current submode and block size */
-   load_texture("compressed", tests[subtest],
+   /*  Check for error color if an LDR-only sys reading an HDR
+*  texture. No need to draw a reference mipmap in this case.
+*/
+   const bool has_hdr = piglit_is_extension_supported(
+   "GL_KHR_texture_compression_astc_hdr");
+   const bool check_error = is_hdr_test && !has_hdr;
+   int block_dims;
+   for (block_dims = 0; block_dims < ARRAY_SIZE(bl

Re: [Piglit] [PATCH] khr_texture_compression_astc: Enable subtest reports

2015-11-30 Thread Nanley Chery
On Mon, Nov 30, 2015 at 07:46:37PM -0500, Ilia Mirkin wrote:
> On Mon, Nov 30, 2015 at 7:34 PM, Nanley Chery <nanleych...@gmail.com> wrote:
> > On Mon, Nov 30, 2015 at 03:50:04PM -0500, Ilia Mirkin wrote:
> >> On Wed, Oct 28, 2015 at 7:55 PM, Nanley Chery <nanleych...@gmail.com> 
> >> wrote:
> >> > +
> >> > +   /* Load texture for current submode and block size */
> >> > +   load_texture("compressed", tests[subtest],
> >> > +   block_dim_str[block_dims],
> >> > +   _compressed);
> >> > +   if (!check_error) {
> >> > +   load_texture("decompressed", tests[subtest],
> >> > +   block_dim_str[block_dims],
> >>
> >> Here and elsewhere, this needs to be indented to the (, or past it...
> >> otherwise it's unreadable.
> >>
> >
> > Isn't this the coding style of Piglit? See this snippet in HACKING:
> > "* Indent with 8-column tabs"
> 
> By that logic, having 0 indentation on every line would be fine. If
> you have a function call, and you have arguments on the next line,
> those arguments need to be indented deeper than that function call.
> 

Oh, I thought you were referring to the '(' in the if statement.
I'll perform the indentation you suggested for the function calls.

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


[Piglit] [PATCH] khr_texture_compression_astc: Enable subtest reports

2015-10-28 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

Enable Piglit to report the result of each individual subtest
for the array and miptree ASTC tests. Modify the miptree test
to only run one subset of ASTC formats at a time.

v2. Modify miptree test to only check the given subtest.
Use the -subtest option to run a specific subtest.

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 tests/all.py   | 12 ++-
 .../khr_compressed_astc-miptree.c  | 90 +-
 2 files changed, 45 insertions(+), 57 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 82e6311..c63cf15 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4182,12 +4182,16 @@ 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_gles3'], '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')
-g(['khr_compressed_astc-miptree_gles2'], 'miptree-gles')
+
+for subtest in ('odd', 'even'):
+g(['khr_compressed_astc-array_gl', '-subtest', subtest])
+g(['khr_compressed_astc-array_gles3', '-subtest', subtest])
+
+for subtest in ('ldr', 'srgb', 'hdr'):
+g(['khr_compressed_astc-miptree_gl', '-subtest', subtest])
+g(['khr_compressed_astc-miptree_gles2', '-subtest', subtest])
 
 with profile.group_manager(
  PiglitGLTest,
diff --git 
a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c 
b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
index 20f2415..20d1c79 100644
--- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
+++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
@@ -222,10 +222,9 @@ bool draw_compare_levels(bool check_error, bool check_srgb,
 enum piglit_result
 test_miptrees(void* input_type)
 {
-   int subtest =  0;
-   enum test_type * type = (enum test_type*) input_type;
-   bool is_srgb_test = *type == TEST_TYPE_SRGB;
-   bool is_hdr_test  = *type == TEST_TYPE_HDR;
+   const enum test_type subtest = *(enum test_type*) input_type;
+   const bool is_srgb_test = subtest == TEST_TYPE_SRGB;
+   const bool is_hdr_test  = subtest == TEST_TYPE_HDR;
 
static const char * tests[3] = {"hdr", "ldrl", "ldrs"};
static const char * block_dim_str[14] = {
@@ -245,62 +244,47 @@ test_miptrees(void* input_type)
"12x12"
};
 
-   bool has_hdr = piglit_is_extension_supported(
-   "GL_KHR_texture_compression_astc_hdr");
-
-   /* If testing sRGB mode, fast-forward to the srgb test. */
-   if (is_srgb_test) {
-   subtest =  TEST_TYPE_SRGB;
-   } else {
-   /* Skip if on an HDR system not running the HDR test
-* or if on an LDR system running the HDR test.
-*/
-   if (has_hdr != is_hdr_test)
-   return PIGLIT_SKIP;
+   if (!is_srgb_test)
piglit_require_extension("GL_EXT_texture_sRGB_decode");
 
-   }
-
GLint pixel_offset_loc = glGetUniformLocation(prog, "pixel_offset");
GLint level_pixel_size_loc = glGetUniformLocation(prog,
"level_pixel_size");
 
-   /* Test each submode */
-   for (; subtest < ARRAY_SIZE(tests); ++subtest) {
-
-   /*  Check for error color if an LDR-only sys reading an HDR
-*  texture. No need to draw a reference mipmap in this case.
-*/
-   int check_error = !has_hdr && subtest == TEST_TYPE_HDR;
-   int block_dims = 0;
-   for (; block_dims < ARRAY_SIZE(block_dim_str); ++block_dims) {
-
-   /* Texture objects. */
-   GLuint tex_compressed;
-   GLuint tex_decompressed;
-
-   /* Load texture for current submode and block size */
-   load_texture("compressed", tests[subtest],
-   block_dim_str[block_dims],
-   _compressed);
-   if (!check_error) {
-   load_texture("decompressed", tests[subtest],
-   block_dim_str[block_dims],
-   _decompressed);
-   }
+   /*  Check for error color if an LDR-only sys reading an HDR
+*  te

[Piglit] [PATCH] khr_texture_compression_astc: Enable subtest reports

2015-10-27 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

Enable Piglit to report the result of each individual subtest
for the array and miptree ASTC tests.

Cc: Mark Janes <mark.a.ja...@intel.com>
Cc: Dylan Baker <baker.dyla...@gmail.com>
Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 tests/all.py | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 82e6311..b06ee2e 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4182,12 +4182,16 @@ 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_gles3'], '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')
-g(['khr_compressed_astc-miptree_gles2'], 'miptree-gles')
+
+for subtest in ('odd', 'even'):
+g(['khr_compressed_astc-array_gl', subtest])
+g(['khr_compressed_astc-array_gles3', subtest])
+
+for subtest in ('ldr', 'srgb', 'hdr'):
+g(['khr_compressed_astc-miptree_gl', subtest])
+g(['khr_compressed_astc-miptree_gles2', subtest])
 
 with profile.group_manager(
  PiglitGLTest,
-- 
2.6.1

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


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

2015-10-05 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

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.
v3. upgrade required GLES version to 3.1 (for 2d array support).
v4. Move CONFIG block to the top of the file (Chad).

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 tests/all.py   |   2 +
 .../khr_texture_compression_astc/CMakeLists.gl.txt |   1 +
 .../CMakeLists.gles3.txt   |   4 +
 .../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-miptree-array.c| 297 +
 10 files changed, 304 insertions(+)
 create mode 100644 tests/spec/khr_texture_compression_astc/CMakeLists.gles3.txt
 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 f45da5c..5bc36d0 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4171,6 +4171,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_gles3'], '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.gles3.txt 
b/tests/spec/khr_texture_compression_astc/CMakeLists.gles3.txt
new file mode 100644
index 000..60147b2
--- /dev/null
+++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gles3.txt
@@ -0,0 +1,4 @@
+link_libraries(piglitutil_${piglit_target_api})
+piglit_add_executable(khr_compressed_astc-array_${piglit_target_api} 
khr_compressed_astc-miptree-array.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 000..88303a5
Binary files /dev/null and 
b/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-12x12.ktx
 differ
diff --git 
a/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-5x5.ktx 
b/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-5x5.ktx
new file mode 100644
index 000..c7b1cba
Binary files /dev/null and 
b/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-5x5.ktx 
differ
diff --git 
a/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-12x12.ktx
 
b/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-12x12.ktx
new file mode 100644
index 000..b9ef01f
Binary files /dev/null and 
b/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-12x12.ktx
 differ
diff --git 
a/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-5x5.ktx 
b/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-5x5.ktx
new file mode 100644
index 000..2cb8df8
Binary files /dev/null and 
b/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-5x5.ktx 
d

[Piglit] [PATCH] oes_compressed_paletted_texture: fix BindTexture() parameter

2015-10-05 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

The second parameter to glBindTexture should accept a texture
handle, not the address of one.

Cc: Ian Romanick <ian.d.roman...@intel.com>
Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 .../oes_compressed_paletted_texture-api.c   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c
 
b/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c
index 1560198..48780ed 100644
--- 
a/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c
+++ 
b/tests/spec/oes_compressed_paletted_texture/oes_compressed_paletted_texture-api.c
@@ -71,7 +71,7 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_OES_compressed_paletted_texture");
 
glGenTextures(1, );
-   glBindTexture(GL_TEXTURE_2D, );
+   glBindTexture(GL_TEXTURE_2D, tex);
 
/* The OES_compressed_paletted_texture spec says:
 *
-- 

This (visibly) small error managed to slip by.

2.6.0

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


[Piglit] [PATCH v4 1/5] util: Add a piglit_probe_rects_equal_rgba() function

2015-10-02 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

This function compares two rectangles for equality. This is useful
to compare the rendering of individual miplevels in a miptree while
avoiding too much resource consumption.

v2: insert spaces in addition operation (Chad).

Reviewed-by: Chad Versace <chad.vers...@intel.com>
Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 tests/util/piglit-util-gl.c | 81 +
 tests/util/piglit-util-gl.h | 31 +
 2 files changed, 112 insertions(+)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 1a24067..ca5d939 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1240,6 +1240,41 @@ piglit_probe_rect_rgb(int x, int y, int w, int h, const 
float *expected)
 }
 
 int
+piglit_probe_rects_equal(int x1, int y1, int x2, int y2,
+   int w, int h, GLenum format)
+{
+   int retval;
+   GLfloat *pixels;
+   int ncomponents, rect_size;
+
+   /* Allocate buffer large enough for two rectangles */
+   ncomponents = piglit_num_components(format);
+   rect_size = w * h * ncomponents;
+   pixels = malloc(2 * rect_size * sizeof(GLfloat));
+
+   /* Load the pixels into the buffer and compare */
+   /* We only need to do one glReadPixels if the images are adjacent */
+   if ((x1 + w) == x2 && y1 == y2) {
+   piglit_read_pixels_float(x1, y1, 2*w, h, format, pixels);
+   retval = piglit_compare_image_halves_color(2*w, h,
+  ncomponents,
+  piglit_tolerance,
+  pixels);
+   } else {
+   piglit_read_pixels_float(x1, y1, w, h, format, pixels);
+   piglit_read_pixels_float(x2, y2, w, h, format,
+   pixels + rect_size);
+   retval = piglit_compare_images_color(0, 0, w, h,
+  ncomponents,
+  piglit_tolerance,
+  pixels, pixels + rect_size);
+   }
+
+   free(pixels);
+   return retval;
+}
+
+int
 piglit_probe_rect_rgba(int x, int y, int w, int h, const float *expected)
 {
int i, j, p;
@@ -1376,6 +1411,52 @@ piglit_compute_probe_tolerance(GLenum format, float 
*tolerance)
}
 }
 
+int
+piglit_compare_pixels(int x, int y, const float *expected, const float *probe,
+const float *tolerance, int num_components)
+{
+   int p;
+
+   for (p = 0; p < num_components; ++p) {
+   if (fabs(probe[p] - expected[p]) >= tolerance[p]) {
+   printf("Probe at (%i,%i)\n", x, y);
+   printf("  Expected:");
+   print_pixel_float(expected, num_components);
+   printf("\n  Observed:");
+   print_pixel_float(probe, num_components);
+   printf("\n");
+
+   return 0;
+   }
+   }
+
+   return 1;
+}
+
+int
+piglit_compare_image_halves_color(int w, int h, int num_components,
+   const float *tolerance,
+   const float *image)
+{
+   int i, j, half_width;
+
+   half_width = w/2;
+   for (j = 0; j < h; j++) {
+   for (i = 0; i < half_width; i++) {
+   const float *probe =
+   [(j*w+i)*num_components];
+   const float *expected =
+   [(j*w+half_width+i)*num_components];
+   if (!piglit_compare_pixels(i, j, expected, probe,
+   tolerance,
+   num_components))
+   return 0;
+   }
+   }
+
+   return 1;
+}
+
 /**
  * Compare two in-memory floating-point images.
  */
diff --git a/tests/util/piglit-util-gl.h b/tests/util/piglit-util-gl.h
index ddba1bb..f06438a 100644
--- a/tests/util/piglit-util-gl.h
+++ b/tests/util/piglit-util-gl.h
@@ -142,6 +142,27 @@ int piglit_probe_rect_rgba(int x, int y, int w, int h, 
const float* expected);
 int piglit_probe_rect_rgba_int(int x, int y, int w, int h, const int* 
expected);
 int piglit_probe_rect_rgba_uint(int x, int y, int w, int h, const unsigned 
int* expected);
 void piglit_compute_probe_tolerance(GLenum format, float *tolerance);
+
+/**
+ * Compare two pixels.
+ * \param x the x coordinate of the pixel being probed
+ * \param y the y coordinate of the pixel being probed
+ */
+int piglit_compare_pixels(int x, int y, const float *expected, const float 
*probe,
+const float *tolerance, int nu

[Piglit] [PATCH v4 2/5] arb_texture_compression/invalid-formats: Add ASTC to list of formats

2015-10-02 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

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 <nanley.g.ch...@intel.com>
---
 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 679991c..5de1c8c 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4168,6 +4168,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(_formats,
+  compressed_formats,
+  num_compressed_formats,
+  check_errors,
+  
piglit_is_extension_supported("GL_KHR_texture_compression_astc_ldr"),

[Piglit] [PATCH v4 3/5] khr_texture_compression_astc: Add miptree tests

2015-10-02 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

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).
v3. upgrade required GLES version to 2.

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 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   

[Piglit] [PATCH v4 4/5] khr_texture_compression_astc: Add API tests

2015-10-02 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

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).
v3. cube map array support is in OpenGL ES 3.2 (not 3.0).

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 tests/all.py   |   2 +
 .../khr_texture_compression_astc/CMakeLists.gl.txt |   1 +
 .../CMakeLists.gles2.txt   |   1 +
 .../khr_compressed_astc-basic.c| 385 +
 4 files changed, 389 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 cd244df..f45da5c 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4171,6 +4171,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..0269e3a
--- /dev/null
+++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c
@@ -0,0 +1,385 @@
+/*
+ * 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"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 11;
+   config.supports_gl_es_version = 20;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+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_compressed_tex_3d_targets[] = {
+   GL_TEXTURE_2D_ARRAY,
+   GL_TEXTURE_CUBE_MAP_ARRAY_EXT,
+   GL_TEXTURE_3D,
+};
+
+static const struct astc_fmt {
+   /** The GLenum for the ASTC format. */
+   GLenum fmt;
+
+   /** The block width. */
+   int bw;
+
+   /** The block height. */
+   int bh;
+
+   /** The number of bytes per block. */
+   int bb;
+} formats[] = {
+   {GL_COMP

[Piglit] [PATCH v4 5/5] khr_texture_compression_astc: Add array tests

2015-10-02 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

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.
v3. upgrade required GLES version to 3.1 (for 2d array support).

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 tests/all.py   |   2 +
 .../khr_texture_compression_astc/CMakeLists.gl.txt |   1 +
 .../CMakeLists.gles3.txt   |   4 +
 .../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-miptree-array.c| 295 +
 10 files changed, 302 insertions(+)
 create mode 100644 tests/spec/khr_texture_compression_astc/CMakeLists.gles3.txt
 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 f45da5c..5bc36d0 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4171,6 +4171,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_gles3'], '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.gles3.txt 
b/tests/spec/khr_texture_compression_astc/CMakeLists.gles3.txt
new file mode 100644
index 000..60147b2
--- /dev/null
+++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gles3.txt
@@ -0,0 +1,4 @@
+link_libraries(piglitutil_${piglit_target_api})
+piglit_add_executable(khr_compressed_astc-array_${piglit_target_api} 
khr_compressed_astc-miptree-array.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 000..88303a5
Binary files /dev/null and 
b/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-12x12.ktx
 differ
diff --git 
a/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-5x5.ktx 
b/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-5x5.ktx
new file mode 100644
index 000..c7b1cba
Binary files /dev/null and 
b/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-5x5.ktx 
differ
diff --git 
a/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-12x12.ktx
 
b/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-12x12.ktx
new file mode 100644
index 000..b9ef01f
Binary files /dev/null and 
b/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-12x12.ktx
 differ
diff --git 
a/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-5x5.ktx 
b/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-5x5.ktx
new file mode 100644
index 000..2cb8df8
Binary files /dev/null and 
b/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-5x5.ktx 
differ
diff --git 
a/tests/spec/khr_texture_compression_astc/compressed/ld

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

2015-09-16 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

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 <nanley.g.ch...@intel.com>
---
 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, 1

[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 <nanley.g.ch...@intel.com>

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 <nanley.g.ch...@intel.com>
---
 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(_formats,
+  compressed_formats,
+  num_compressed_formats,
+  check_errors,
+  
piglit_is_extension_supported("GL_KHR_texture_compression_astc_ldr"),

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

2015-09-16 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

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 <nanley.g.ch...@intel.com>
---
 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
 .../decompre

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

2015-09-16 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

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 <nanley.g.ch...@intel.com>
---
 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=o6y4LjYj20H{FMar6yDR_LI|F@
z#r$A;`O4iZD}W)K!{G>G_HY0&1gdua?M<(y@Z_cHix*x>c^u(;4-z
zopfV}84dz^iwaUg%Rk8Qv%JYeYCbR;8<TV)w6SZ
z{-$Erh?B9a^dtfx}7Z3S!YccNW>qa1og5hiNtn-P}GJJ3aq=yBf}a#h8U=LA|RQZ
zl8|mbztOLUb9bv<`HkDBd^mf7O?^oBCwI$JGstt-^K7R8e-PBUUo+=)ezk>;<zIlkmz2kj)!MxKIm10SoWUebuZLmJ()qX+jFpOmU#1RI5+(6D=>0s^bOv?=E2G>7F
z(Ip@{q~wN>ZmZizby;a!H=grt>b^|42%jmf*?g%<nc^`}@eS?uGf&`7m11HEuG7
zzh832kMP{Ym5!z{t`X1ErDHurl+U**5r+!n3cT{>$&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##~s
zFz22I$d0QC3Ykl=lTz@aA&^9mSZItTg3sl<-VQd?)S3M}of{b$8HIk4F|rWe
zpK|>_tPLfF$=;DBak5{}DZH

Re: [Piglit] [PATCH v2 4/4] Add API tests for KHR_texture_compression_astc_ldr

2015-09-14 Thread Nanley Chery
On Tue, Sep 8, 2015 at 11:45 AM, Chad Versace <chad.vers...@intel.com>
wrote:

> On Fri 28 Aug 2015, Nanley Chery wrote:
> > From: Nanley Chery <nanley.g.ch...@intel.com>
> >
> > These tests check that the GL error returned by valid and invalid API
> calls
> > are as defined by the spec.
> >
> > Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
> > ---
> >  .../khr_texture_compression_astc/CMakeLists.gl.txt |   1 +
> >  .../CMakeLists.gles2.txt   |   1 +
> >  .../khr_compressed_astc-basic.c| 366
> +
> >  3 files changed, 368 insertions(+)
> >  create mode 100644
> tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c
> >
> > diff --git a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
> b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
> > index a47c7d3..79500f7 100644
> > --- a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
> > +++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
> > @@ -10,5 +10,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 047b8ac..3fb6fa5 100644
> > --- a/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt
> > +++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt
> > @@ -4,5 +4,6 @@ include_directories(
> >  )
> >  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..d83ad5e
> > --- /dev/null
> > +++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c
> > @@ -0,0 +1,366 @@
>
> > +#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[] = {
>
> There are additional good targets: 3D and and CUBE_MAP. Please rename
> this variable to indicate that these are "good targets" for
> glCompressedTex*3D().
>
> I'm not sure what you mean by additional good targets. I've renamed the
variable to good_compressed_tex_3d_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;
>
> Since the underscored struct tag is nowhere used, you should remove it.
>
> Please add a one-line comment for each of the astc_fmt fields.
>
> Fixed these two.

> > +
> > +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_KHR , 10,  6, 16},
> > +{GL_COMPRESSED_RGBA_ASTC_10x8_KHR , 10,  8, 16},
> > +{GL_COMPRESSED_RGBA_ASTC_10x10_KHR, 10, 10, 16},
> > +{GL_COMPRESSED_RGBA_ASTC_12x10_KHR, 12, 10, 16},
> > +{GL_COMPRESSED_RGBA_ASTC_12x12_KHR, 12, 12, 16},
> > +{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR  ,  4

Re: [Piglit] [PATCH v2 3/4] Add miptree tests for khr_texture_compression_astc

2015-09-14 Thread Nanley Chery
On Wed, Sep 9, 2015 at 5:04 PM, Chad Versace <chad.vers...@intel.com> wrote:

> On Fri 28 Aug 2015, Nanley Chery wrote:
> > From: Nanley Chery <nanley.g.ch...@intel.com>
> >
> > 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.
> >
> > Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
>
>
> > diff --git a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
> b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
> > new file mode 100644
> > index 000..a47c7d3
> > --- /dev/null
> > +++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
> > @@ -0,0 +1,14 @@
> > +include_directories(
> > + ${GLEXT_INCLUDE_DIR}
> > + ${OPENGL_INCLUDE_PATH}
> > +)
>
> I think you can drop the call to include_directories. And If you can,
> you should. Please try rebuilding without it.
>
> Done.

> > +
> > +link_libraries (
> > + piglitutil_${piglit_target_api}
> > + ${OPENGL_gl_LIBRARY}
> > + ${OPENGL_glu_LIBRARY}
> > +)
>
> As above, I think you can drop the explicit linking to
> OPENGL_gl_LIBRARY. And you can definitiely drop the explicit linking to
> OPENGL_glu_LIBRARY.
>
> Done.
>
> > +
> > +piglit_add_executable(khr_compressed_astc-miptree_${piglit_target_api}
> khr_compressed_astc-miptree.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
> > new file mode 100644
> > index 000..047b8ac
> > --- /dev/null
> > +++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt
> > @@ -0,0 +1,8 @@
> > +include_directories(
> > + ${GLEXT_INCLUDE_DIR}
> > + ${OPENGL_INCLUDE_PATH}
> > +)
>
> As for CMakeLists.gl.txt, I think you should drop this call
> include_directories if Piglit can build without it.
>
> Done.

> > +link_libraries(piglitutil_${piglit_target_api})
> > +piglit_add_executable(khr_compressed_astc-miptree_${piglit_target_api}
> khr_compressed_astc-miptree.c)
> > +
> > +# vim: ft=cmake:
>
>
> > diff --git
> a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
> > new file mode 100644
> > index 000..a804b9b
> > --- /dev/null
> > +++
> b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
>
> > +/**
> > + * \file
> > + * \brief Test texturing from an ASTC miptree of a real image.
> > + *
> > + * This test is an adaptation of the oes_compressed_etc1_rgb8_textures
> test.
> > + *
> > + * This test uses eighty-four data files. The files under compressed/
> contain
>  ^^^
> Remove "eighty-four" from the comment. It puts the comment at high risk
> of becoming stale.
>
> Fixed.

> > + * full miptrees, in the GL_*_ASTC_* formats, of a 2D texture of
> waffles and
> > + * fruit [1].  The base level size was shrunken to 160x106 pixels. The
> files
> > + * under the decompressed directory contain the same miptree in GL_RGBA
> > + * format. Each miplevel was obtained by decompressing the
> corresponding ASTC
> > + * texture with astcenc [2].
> > + *
> > + * This test draws miplevels of the compressed textures according to the
> > + * MIPLAYOUT_BELOW organization scheme. It does the same when drawing
>   ^^^
>
> MIPLAYOUT_BELOW is a term specific to Intel hardware that no one but
> Intel miptree ninjas like yourself will recognize. (In several more years,
> perhaps *no one* will recognize it, because
> MIPLAYOUT_BELOW/MIPLAYOUT_THE_OTHER_ONE was configurable only on legacy
> hardware). If you want to describe the test's image layout, draw
> a little ASCII diagram instead.
>
> Fixed.

> > + * the decompressed texture on the right. Each miplevel of both images
> are
> > + * compared for equality after each level is drawn.
> ^
> drawn
>
I'm assuming you were meaning to say that "each level"  is redundant, so I
modified the sentence accordingly.

> > + *
> > + * [1] The reference image is located at
> http://people.freedesktop.org/~chadversary/permalink/2012-07-09/1574cff2-d091-4421-a3cf-b56c794

Re: [Piglit] [PATCH v2 1/4] arb_texture_compression/invalid-formats: add ASTC to list of formats

2015-09-09 Thread Nanley Chery
On Tue, Sep 8, 2015 at 10:59 AM, Chad Versace <chad.vers...@intel.com>
wrote:

> On Tue 08 Sep 2015, Dylan Baker wrote:
> > This is extending an existing test, does it really need to be added?
>
> If I interpreted correctly the output of `grep
> arb_texture_compression-invalid-formats tests/all.py`, then yes.
>
> Nanley, without adding your ASTC invalid format tests to all.py, do they
> still get run during a full Piglit run?
>
>
They do not get run. It turns out that this test doesn't cycle through
every format it knows about, but instead requires passing in an argument
specifying which format to test. I'll add this change to my v2.

> > On Sep 8, 2015 09:50, "Chad Versace" <chad.vers...@intel.com> wrote:
> >
> > > On Tue 08 Sep 2015, Chad Versace wrote:
> > > > On Fri 28 Aug 2015, Nanley Chery wrote:
> > > > > From: Nanley Chery <nanley.g.ch...@intel.com>
> > > > >
> > > > > ASTC formats are added to the list of formats that should not be
> > > returned by the
> > > > > COMPRESSED_TEXTURE_FORMATS query.
> > > > >
> > > > > Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
> > > > > ---
> > > > >  .../spec/arb_texture_compression/invalid-formats.c | 51
> > > +-
> > > > >  1 file changed, 50 insertions(+), 1 deletion(-)
> > > >
> > > > Patch 1 is
> > > > Reviewed-by: Chad Versace <chad.vers...@intel.com>
> > >
> > > Oops. I retract the rb. You need to add the test to all.py.
> > > ___
> > > Piglit mailing list
> > > Piglit@lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/piglit
> > >
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] Add an array test for KHR_texture_compression_astc_ldr

2015-08-31 Thread Nanley Chery
From: Nanley Chery <nanley.g.ch...@intel.com>

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

Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
 .../khr_texture_compression_astc/CMakeLists.gl.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-miptree-array.c| 294 +
 8 files changed, 295 insertions(+)
 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/spec/khr_texture_compression_astc/CMakeLists.gl.txt 
b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
index 79500f7..5b1c4c7 100644
--- a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
+++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
@@ -10,6 +10,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/compressed/hdr/array/waffles-12x12.ktx
 
b/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-12x12.ktx
new file mode 100644
index 000..88303a5
Binary files /dev/null and 
b/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-12x12.ktx
 differ
diff --git 
a/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-5x5.ktx 
b/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-5x5.ktx
new file mode 100644
index 000..c7b1cba
Binary files /dev/null and 
b/tests/spec/khr_texture_compression_astc/compressed/hdr/array/waffles-5x5.ktx 
differ
diff --git 
a/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-12x12.ktx
 
b/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-12x12.ktx
new file mode 100644
index 000..b9ef01f
Binary files /dev/null and 
b/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-12x12.ktx
 differ
diff --git 
a/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-5x5.ktx 
b/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-5x5.ktx
new file mode 100644
index 000..2cb8df8
Binary files /dev/null and 
b/tests/spec/khr_texture_compression_astc/compressed/ldrl/array/waffles-5x5.ktx 
differ
diff --git 
a/tests/spec/khr_texture_compression_astc/compressed/ldrs/array/waffles-12x12.ktx
 
b/tests/spec/khr_texture_compression_astc/compressed/ldrs/array/waffles-12x12.ktx
new file mode 100644
index 000..c0d7dda
Binary files /dev/null and 
b/tests/spec/khr_texture_compression_astc/compressed/ldrs/array/waffles-12x12.ktx
 differ
diff --git 
a/tests/spec/khr_texture_compression_astc/compressed/ldrs/array/waffles-5x5.ktx 
b/tests/spec/khr_texture_compression_astc/compressed/ldrs/array/waffles-5x5.ktx
new file mode 100644
index 000..7cdc7a1
Binary files /dev/null and 
b/tests/spec/khr_texture_compression_astc/compressed/ldrs/array/waffles-5x5.ktx 
differ
diff --git 
a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c 
b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c
new file mode 100644
index 000..c1f8fa2
--- /dev/null
+++ 
b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree-array.c
@@ -0,0 +1,294 @@
+/*
+ * 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
+ *

[Piglit] [PATCH v2 2/4] util: Add a piglit_probe_rects_equal_rgba() function

2015-08-28 Thread Nanley Chery
From: Nanley Chery nanley.g.ch...@intel.com

This function compares two rectangles for equality. This is useful
to compare the rendering of individual miplevels in a miptree while
avoiding too much resource consumption.

Signed-off-by: Nanley Chery nanley.g.ch...@intel.com
---
 tests/util/piglit-util-gl.c | 81 +
 tests/util/piglit-util-gl.h | 31 +
 2 files changed, 112 insertions(+)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index db17b83..82a6862 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1242,6 +1242,41 @@ piglit_probe_rect_rgb(int x, int y, int w, int h, const 
float *expected)
 }
 
 int
+piglit_probe_rects_equal(int x1, int y1, int x2, int y2,
+   int w, int h, GLenum format)
+{
+   int retval;
+   GLfloat *pixels;
+   int ncomponents, rect_size;
+
+   /* Allocate buffer large enough for two rectangles */
+   ncomponents = piglit_num_components(format);
+   rect_size = w * h * ncomponents;
+   pixels = malloc(2 * rect_size * sizeof(GLfloat));
+
+   /* Load the pixels into the buffer and compare */
+   /* We only need to do one glReadPixels if the images are adjacent */
+   if ((x1 + w) == x2  y1 == y2) {
+   piglit_read_pixels_float(x1, y1, 2*w, h, format, pixels);
+   retval = piglit_compare_image_halves_color(2*w, h,
+  ncomponents,
+  piglit_tolerance,
+  pixels);
+   } else {
+   piglit_read_pixels_float(x1, y1, w, h, format, pixels);
+   piglit_read_pixels_float(x2, y2, w, h, format,
+   pixels +rect_size);
+   retval = piglit_compare_images_color(0, 0, w, h,
+  ncomponents,
+  piglit_tolerance,
+  pixels, pixels + rect_size);
+   }
+
+   free(pixels);
+   return retval;
+}
+
+int
 piglit_probe_rect_rgba(int x, int y, int w, int h, const float *expected)
 {
int i, j, p;
@@ -1378,6 +1413,52 @@ piglit_compute_probe_tolerance(GLenum format, float 
*tolerance)
}
 }
 
+int
+piglit_compare_pixels(int x, int y, const float *expected, const float *probe,
+const float *tolerance, int num_components)
+{
+   int p;
+
+   for (p = 0; p  num_components; ++p) {
+   if (fabs(probe[p] - expected[p]) = tolerance[p]) {
+   printf(Probe at (%i,%i)\n, x, y);
+   printf(  Expected:);
+   print_pixel_float(expected, num_components);
+   printf(\n  Observed:);
+   print_pixel_float(probe, num_components);
+   printf(\n);
+
+   return 0;
+   }
+   }
+
+   return 1;
+}
+
+int
+piglit_compare_image_halves_color(int w, int h, int num_components,
+   const float *tolerance,
+   const float *image)
+{
+   int i, j, half_width;
+
+   half_width = w/2;
+   for (j = 0; j  h; j++) {
+   for (i = 0; i  half_width; i++) {
+   const float *probe =
+   image[(j*w+i)*num_components];
+   const float *expected =
+   image[(j*w+half_width+i)*num_components];
+   if (!piglit_compare_pixels(i, j, expected, probe,
+   tolerance,
+   num_components))
+   return 0;
+   }
+   }
+
+   return 1;
+}
+
 /**
  * Compare two in-memory floating-point images.
  */
diff --git a/tests/util/piglit-util-gl.h b/tests/util/piglit-util-gl.h
index ddba1bb..f06438a 100644
--- a/tests/util/piglit-util-gl.h
+++ b/tests/util/piglit-util-gl.h
@@ -142,6 +142,27 @@ int piglit_probe_rect_rgba(int x, int y, int w, int h, 
const float* expected);
 int piglit_probe_rect_rgba_int(int x, int y, int w, int h, const int* 
expected);
 int piglit_probe_rect_rgba_uint(int x, int y, int w, int h, const unsigned 
int* expected);
 void piglit_compute_probe_tolerance(GLenum format, float *tolerance);
+
+/**
+ * Compare two pixels.
+ * \param x the x coordinate of the pixel being probed
+ * \param y the y coordinate of the pixel being probed
+ */
+int piglit_compare_pixels(int x, int y, const float *expected, const float 
*probe,
+const float *tolerance, int num_components);
+
+/**
+ * Compare two adjacent in-memory floating-point images.
+ * Adjacent means: y1 == y2  x1 == x2 - w;
+ *
+ * \param w the width of the rectangle containing both images

[Piglit] [PATCH v2 3/4] Add miptree tests for khr_texture_compression_astc

2015-08-28 Thread Nanley Chery
From: Nanley Chery nanley.g.ch...@intel.com

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.

Signed-off-by: Nanley Chery nanley.g.ch...@intel.com
---
 tests/all.py   |   6 +
 tests/spec/CMakeLists.txt  |   1 +
 .../khr_texture_compression_astc/CMakeLists.gl.txt |  14 +
 .../CMakeLists.gles2.txt   |   8 +
 .../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-10x6.ktx | Bin 0 - 67848

[Piglit] [PATCH v2 4/4] Add API tests for KHR_texture_compression_astc_ldr

2015-08-28 Thread Nanley Chery
From: Nanley Chery nanley.g.ch...@intel.com

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

Signed-off-by: Nanley Chery nanley.g.ch...@intel.com
---
 .../khr_texture_compression_astc/CMakeLists.gl.txt |   1 +
 .../CMakeLists.gles2.txt   |   1 +
 .../khr_compressed_astc-basic.c| 366 +
 3 files changed, 368 insertions(+)
 create mode 100644 
tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c

diff --git a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt 
b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
index a47c7d3..79500f7 100644
--- a/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
+++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gl.txt
@@ -10,5 +10,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 047b8ac..3fb6fa5 100644
--- a/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt
+++ b/tests/spec/khr_texture_compression_astc/CMakeLists.gles2.txt
@@ -4,5 +4,6 @@ include_directories(
 )
 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..d83ad5e
--- /dev/null
+++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-basic.c
@@ -0,0 +1,366 @@
+/*
+ * Copyright © 2011 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_KHR , 10,  6, 16},
+{GL_COMPRESSED_RGBA_ASTC_10x8_KHR , 10,  8, 16},
+{GL_COMPRESSED_RGBA_ASTC_10x10_KHR, 10, 10, 16},
+{GL_COMPRESSED_RGBA_ASTC_12x10_KHR, 12, 10, 16},
+{GL_COMPRESSED_RGBA_ASTC_12x12_KHR, 12, 12, 16},
+{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR  ,  4,  4, 16},
+{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR  ,  5,  4, 16},
+{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR  ,  5,  5, 16},
+{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR  ,  6,  5, 16},
+{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR  ,  6,  6, 16},
+{GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR  ,  8,  5, 16

[Piglit] [PATCH 3/4] tests: Add miptree tests for KHR_texture_compression_astc_{ldr, hdr}

2015-07-30 Thread Nanley Chery
From: Nanley Chery nanley.g.ch...@intel.com

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.

Signed-off-by: Nanley Chery nanley.g.ch...@intel.com
---

The ASTC binaries are omitted, but can be found here:
http://cgit.freedesktop.org/~nchery/piglit/log/?h=astc

 tests/all.py   |   6 +
 tests/spec/CMakeLists.txt  |   1 +
 .../khr_texture_compression_astc/CMakeLists.gl.txt |  14 +
 .../CMakeLists.gles2.txt   |   8 +
 .../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

[Piglit] [PATCH 2/4] util: Add a piglit_probe_rects_equal_rgba() function

2015-07-29 Thread Nanley Chery
From: Nanley Chery nanley.g.ch...@intel.com

This function compares two rectangles for equality. Among other uses, this
is useful to compare the rendering of individual miplevels in a miptree.

Signed-off-by: Nanley Chery nanley.g.ch...@intel.com
---
 tests/util/piglit-util-gl.c | 88 +
 tests/util/piglit-util-gl.h | 23 
 2 files changed, 111 insertions(+)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 1a24067..c17b382 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1240,6 +1240,41 @@ piglit_probe_rect_rgb(int x, int y, int w, int h, const 
float *expected)
 }
 
 int
+piglit_probe_rects_equal(int x1, int y1, int x2, int y2,
+   int w, int h, GLenum format)
+{
+   int retval;
+   GLfloat *pixels;
+   int ncomponents, rect_size;
+
+   /* Allocate buffer large enough for two rectangles */
+   ncomponents = piglit_num_components(format);
+   rect_size = w * h * ncomponents;
+   pixels = malloc(2 * rect_size * sizeof(GLfloat));
+
+   /* Load the pixels into the buffer and compare */
+   /* We only need to do one glReadPixels if the images are adjacent */
+   if ((x1 + w) == x2  y1 == y2) {
+   piglit_read_pixels_float(x1, y1, 2*w, h, format, pixels);
+   retval = piglit_compare_image_halves_color(2*w, h,
+  ncomponents,
+  piglit_tolerance,
+  pixels);
+   } else {
+   piglit_read_pixels_float(x1, y1, w, h, format, pixels);
+   piglit_read_pixels_float(x2, y2, w, h, format,
+   pixels +rect_size);
+   retval = piglit_compare_images_color(0, 0, w, h,
+  ncomponents,
+  piglit_tolerance,
+  pixels, pixels + rect_size);
+   }
+
+   free(pixels);
+   return retval;
+}
+
+int
 piglit_probe_rect_rgba(int x, int y, int w, int h, const float *expected)
 {
int i, j, p;
@@ -1376,6 +1411,59 @@ piglit_compute_probe_tolerance(GLenum format, float 
*tolerance)
}
 }
 
+static inline int
+piglit_compare_pixels(const float *expected, const float *probe,
+const float *tolerance, int num_components)
+{
+   int p;
+
+   for (p = 0; p  num_components; ++p) {
+   if (fabs(probe[p] - expected[p]) = tolerance[p])
+   return 0;
+   }
+
+   return 1;
+}
+
+
+static void
+print_expected_observed(int x, int y, int num_components,
+   const float *expected, const float *probe)
+{
+   printf(Probe at (%i,%i)\n, x, y);
+   printf(  Expected:);
+   print_pixel_float(expected, num_components);
+   printf(\n  Observed:);
+   print_pixel_float(probe, num_components);
+   printf(\n);
+}
+
+int
+piglit_compare_image_halves_color(int w, int h, int num_components,
+   const float *tolerance, const float *image)
+{
+   int i, j, half_width;
+
+   half_width = w/2;
+   for (j = 0; j  h; j++) {
+   for (i = 0; i  half_width; i++) {
+   const float *probe =
+   image[(j*w+i)*num_components];
+   const float *expected =
+   image[(j*w+half_width+i)*num_components];
+   if (!piglit_compare_pixels(expected, probe,
+   tolerance,
+   num_components)) {
+   print_expected_observed(i, j, num_components,
+   expected, probe);
+   return 0;
+   }
+   }
+   }
+
+   return 1;
+}
+
 /**
  * Compare two in-memory floating-point images.
  */
diff --git a/tests/util/piglit-util-gl.h b/tests/util/piglit-util-gl.h
index ddba1bb..9773d01 100644
--- a/tests/util/piglit-util-gl.h
+++ b/tests/util/piglit-util-gl.h
@@ -142,6 +142,19 @@ int piglit_probe_rect_rgba(int x, int y, int w, int h, 
const float* expected);
 int piglit_probe_rect_rgba_int(int x, int y, int w, int h, const int* 
expected);
 int piglit_probe_rect_rgba_uint(int x, int y, int w, int h, const unsigned 
int* expected);
 void piglit_compute_probe_tolerance(GLenum format, float *tolerance);
+
+/**
+ * Compare two adjacent in-memory floating-point images.
+ * Adjacent means: y1 == y2  x1 == x2 - w;
+ *
+ * \param w the width of the rectangle containing both images
+ * \param h the height of the rectangle containing both images
+ * \param images : the start of the buffer containing the observed image on
+ * the left

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

2015-07-29 Thread Nanley Chery
From: Nanley Chery nanley.g.ch...@intel.com

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

Signed-off-by: Nanley Chery nanley.g.ch...@intel.com
---
 .../spec/arb_texture_compression/invalid-formats.c | 51 +-
 1 file changed, 50 insertions(+), 1 deletion(-)

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 {
fprintf(stderr,
Unrecognized selection `%s'\n, argv[i]);
-- 
2.4.2

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


[Piglit] [PATCH 0/4] Add tests for ASTC

2015-07-29 Thread Nanley Chery
From: Nanley Chery nanley.g.ch...@intel.com

These patches enable testing the rendering of ASTC miptrees as well as the
usage of ASTC tokens in GL commands.

Nanley Chery (4):
  arb_texture_compression/invalid-formats: add ASTC to list of formats
  util: Add a piglit_probe_rects_equal_rgba() function
  tests: Add miptree tests for KHR_texture_compression_astc_{ldr,hdr}
  tests: Add API tests for KHR_texture_compression_astc_{ldr,hdr}

 tests/all.py   |   6 +
 tests/spec/CMakeLists.txt  |   1 +
 .../spec/arb_texture_compression/invalid-formats.c |  51 ++-
 .../khr_texture_compression_astc/CMakeLists.gl.txt |  15 +
 .../CMakeLists.gles2.txt   |   9 +
 .../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

  1   2   >