Re: [Piglit] [PATCH] ext_texture_integer: add new tex formats test

2015-09-01 Thread Brian Paul

On 08/31/2015 05:38 PM, Ilia Mirkin wrote:

On Mon, Aug 31, 2015 at 7:21 PM, Brian Paul  wrote:

Test glTexImage2D() and glGetTexImage() with a variety of internalFormats
and user formats/types.

Note: currently fails with Mesa, passes with NVIDIA.
---
  tests/all.py |   1 +
  tests/spec/ext_texture_integer/CMakeLists.gl.txt |   1 +
  tests/spec/ext_texture_integer/texformats.c  | 182 +++
  3 files changed, 184 insertions(+)
  create mode 100644 tests/spec/ext_texture_integer/texformats.c

diff --git a/tests/all.py b/tests/all.py
index fe088f5..9320722 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3127,6 +3127,7 @@ with profile.group_manager(
  g(['ext_texture_integer-getteximage-clamping'], 'getteximage-clamping')
  g(['ext_texture_integer-getteximage-clamping', 'GL_ARB_texture_rg'],
'getteximage-clamping GL_ARB_texture_rg')
+g(['ext_texture_integer-texformats']),
  g(['ext_texture_integer-texture_integer_glsl130'],
'texture_integer_glsl130')
  g(['fbo-integer'], run_concurrent=False)
diff --git a/tests/spec/ext_texture_integer/CMakeLists.gl.txt 
b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
index 44d9399..2932bc2 100644
--- a/tests/spec/ext_texture_integer/CMakeLists.gl.txt
+++ b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ link_libraries (

  piglit_add_executable (ext_texture_integer-fbo-blending fbo-blending.c)
  piglit_add_executable (ext_texture_integer-fbo_integer_precision_clear 
fbo-integer-precision-clear.c)
+piglit_add_executable (ext_texture_integer-texformats texformats.c)
  piglit_add_executable (ext_texture_integer-fbo_integer_readpixels_sint_uint 
fbo-integer-readpixels-sint-uint.c)
  piglit_add_executable (ext_texture_integer-getteximage-clamping 
getteximage-clamping.c)
  piglit_add_executable (ext_texture_integer-texture_integer_glsl130 
texture-integer-glsl130.c)
diff --git a/tests/spec/ext_texture_integer/texformats.c 
b/tests/spec/ext_texture_integer/texformats.c
new file mode 100644
index 000..5a4f387
--- /dev/null
+++ b/tests/spec/ext_texture_integer/texformats.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2015 VMware, Inc.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/**
+ * Test glTexImage2D and glGetTexImage with a variety of combinations of
+ * internal formats, and user-specified formats/types.
+ *
+ * Brian Paul
+ * 31 August 2015
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static bool
+test_format(GLenum intFormat, GLenum format, GLenum type)
+{
+   const int width = 8, height = 8;
+   GLuint tex;
+   GLubyte *image, *getimage;
+   bool pass = true;
+   int i, bytes;
+
+   switch (intFormat) {
+   case GL_ALPHA8I_EXT:
+   case GL_ALPHA8UI_EXT:
+   bytes = 1;
+   break;
+   case GL_ALPHA16I_EXT:
+   case GL_ALPHA16UI_EXT:
+   bytes = 2;
+   break;
+   case GL_ALPHA32I_EXT:
+   case GL_ALPHA32UI_EXT:
+   bytes = 4;
+   break;
+   case GL_RGB8I:
+   case GL_RGB8UI:
+   bytes = 3;
+   break;
+   case GL_RGBA8I:
+   case GL_RGBA8UI:
+   bytes = 4;
+   break;
+   case GL_RGB16I:
+   case GL_RGB16UI:
+   bytes = 6;
+   break;
+   case GL_RGBA16I:
+   case GL_RGBA16UI:
+   bytes = 8;
+   break;
+   case GL_RGB32I:
+   case GL_RGB32UI:
+   bytes = 12;
+   break;
+   case GL_RGBA32I:
+   case GL_RGBA32UI:
+   bytes = 16;
+   break;
+   default:
+   assert(!"Unexpected format");
+  

[Piglit] [PATCH] ext_texture_integer: add new tex formats test

2015-09-01 Thread Brian Paul
Test glTexImage2D() and glGetTexImage() with a variety of internalFormats
and user formats/types.

Note: currently fails with Mesa, passes with NVIDIA.

v2: fix % vs. & mix-up, move test code into piglit_init().
---
 tests/all.py |   1 +
 tests/spec/ext_texture_integer/CMakeLists.gl.txt |   1 +
 tests/spec/ext_texture_integer/texformats.c  | 185 +++
 3 files changed, 187 insertions(+)
 create mode 100644 tests/spec/ext_texture_integer/texformats.c

diff --git a/tests/all.py b/tests/all.py
index fe088f5..9320722 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3127,6 +3127,7 @@ with profile.group_manager(
 g(['ext_texture_integer-getteximage-clamping'], 'getteximage-clamping')
 g(['ext_texture_integer-getteximage-clamping', 'GL_ARB_texture_rg'],
   'getteximage-clamping GL_ARB_texture_rg')
+g(['ext_texture_integer-texformats']),
 g(['ext_texture_integer-texture_integer_glsl130'],
   'texture_integer_glsl130')
 g(['fbo-integer'], run_concurrent=False)
diff --git a/tests/spec/ext_texture_integer/CMakeLists.gl.txt 
b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
index 44d9399..2932bc2 100644
--- a/tests/spec/ext_texture_integer/CMakeLists.gl.txt
+++ b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ link_libraries (
 
 piglit_add_executable (ext_texture_integer-fbo-blending fbo-blending.c)
 piglit_add_executable (ext_texture_integer-fbo_integer_precision_clear 
fbo-integer-precision-clear.c)
+piglit_add_executable (ext_texture_integer-texformats texformats.c)
 piglit_add_executable (ext_texture_integer-fbo_integer_readpixels_sint_uint 
fbo-integer-readpixels-sint-uint.c)
 piglit_add_executable (ext_texture_integer-getteximage-clamping 
getteximage-clamping.c)
 piglit_add_executable (ext_texture_integer-texture_integer_glsl130 
texture-integer-glsl130.c)
diff --git a/tests/spec/ext_texture_integer/texformats.c 
b/tests/spec/ext_texture_integer/texformats.c
new file mode 100644
index 000..4e7abcc
--- /dev/null
+++ b/tests/spec/ext_texture_integer/texformats.c
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2015 VMware, Inc.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/**
+ * Test glTexImage2D and glGetTexImage with a variety of combinations of
+ * internal formats, and user-specified formats/types.
+ *
+ * Brian Paul
+ * 31 August 2015
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static bool
+test_format(GLenum intFormat, GLenum format, GLenum type)
+{
+   const int width = 8, height = 8;
+   GLuint tex;
+   GLubyte *image, *getimage;
+   bool pass = true;
+   int i, bytes;
+
+   switch (intFormat) {
+   case GL_ALPHA8I_EXT:
+   case GL_ALPHA8UI_EXT:
+   bytes = 1;
+   break;
+   case GL_ALPHA16I_EXT:
+   case GL_ALPHA16UI_EXT:
+   bytes = 2;
+   break;
+   case GL_ALPHA32I_EXT:
+   case GL_ALPHA32UI_EXT:
+   bytes = 4;
+   break;
+   case GL_RGB8I:
+   case GL_RGB8UI:
+   bytes = 3;
+   break;
+   case GL_RGBA8I:
+   case GL_RGBA8UI:
+   bytes = 4;
+   break;
+   case GL_RGB16I:
+   case GL_RGB16UI:
+   bytes = 6;
+   break;
+   case GL_RGBA16I:
+   case GL_RGBA16UI:
+   bytes = 8;
+   break;
+   case GL_RGB32I:
+   case GL_RGB32UI:
+   bytes = 12;
+   break;
+   case GL_RGBA32I:
+   case GL_RGBA32UI:
+   bytes = 16;
+   break;
+   default:
+   assert(!"Unexpected format");
+   bytes = 0;
+   }
+
+   image = malloc(width * height * 

[Piglit] [PATCH] ext_texture_integer: add new tex formats test

2015-08-31 Thread Brian Paul
Test glTexImage2D() and glGetTexImage() with a variety of internalFormats
and user formats/types.

Note: currently fails with Mesa, passes with NVIDIA.
---
 tests/all.py |   1 +
 tests/spec/ext_texture_integer/CMakeLists.gl.txt |   1 +
 tests/spec/ext_texture_integer/texformats.c  | 182 +++
 3 files changed, 184 insertions(+)
 create mode 100644 tests/spec/ext_texture_integer/texformats.c

diff --git a/tests/all.py b/tests/all.py
index fe088f5..9320722 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3127,6 +3127,7 @@ with profile.group_manager(
 g(['ext_texture_integer-getteximage-clamping'], 'getteximage-clamping')
 g(['ext_texture_integer-getteximage-clamping', 'GL_ARB_texture_rg'],
   'getteximage-clamping GL_ARB_texture_rg')
+g(['ext_texture_integer-texformats']),
 g(['ext_texture_integer-texture_integer_glsl130'],
   'texture_integer_glsl130')
 g(['fbo-integer'], run_concurrent=False)
diff --git a/tests/spec/ext_texture_integer/CMakeLists.gl.txt 
b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
index 44d9399..2932bc2 100644
--- a/tests/spec/ext_texture_integer/CMakeLists.gl.txt
+++ b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ link_libraries (
 
 piglit_add_executable (ext_texture_integer-fbo-blending fbo-blending.c)
 piglit_add_executable (ext_texture_integer-fbo_integer_precision_clear 
fbo-integer-precision-clear.c)
+piglit_add_executable (ext_texture_integer-texformats texformats.c)
 piglit_add_executable (ext_texture_integer-fbo_integer_readpixels_sint_uint 
fbo-integer-readpixels-sint-uint.c)
 piglit_add_executable (ext_texture_integer-getteximage-clamping 
getteximage-clamping.c)
 piglit_add_executable (ext_texture_integer-texture_integer_glsl130 
texture-integer-glsl130.c)
diff --git a/tests/spec/ext_texture_integer/texformats.c 
b/tests/spec/ext_texture_integer/texformats.c
new file mode 100644
index 000..5a4f387
--- /dev/null
+++ b/tests/spec/ext_texture_integer/texformats.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2015 VMware, Inc.
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/**
+ * Test glTexImage2D and glGetTexImage with a variety of combinations of
+ * internal formats, and user-specified formats/types.
+ *
+ * Brian Paul
+ * 31 August 2015
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static bool
+test_format(GLenum intFormat, GLenum format, GLenum type)
+{
+   const int width = 8, height = 8;
+   GLuint tex;
+   GLubyte *image, *getimage;
+   bool pass = true;
+   int i, bytes;
+
+   switch (intFormat) {
+   case GL_ALPHA8I_EXT:
+   case GL_ALPHA8UI_EXT:
+   bytes = 1;
+   break;
+   case GL_ALPHA16I_EXT:
+   case GL_ALPHA16UI_EXT:
+   bytes = 2;
+   break;
+   case GL_ALPHA32I_EXT:
+   case GL_ALPHA32UI_EXT:
+   bytes = 4;
+   break;
+   case GL_RGB8I:
+   case GL_RGB8UI:
+   bytes = 3;
+   break;
+   case GL_RGBA8I:
+   case GL_RGBA8UI:
+   bytes = 4;
+   break;
+   case GL_RGB16I:
+   case GL_RGB16UI:
+   bytes = 6;
+   break;
+   case GL_RGBA16I:
+   case GL_RGBA16UI:
+   bytes = 8;
+   break;
+   case GL_RGB32I:
+   case GL_RGB32UI:
+   bytes = 12;
+   break;
+   case GL_RGBA32I:
+   case GL_RGBA32UI:
+   bytes = 16;
+   break;
+   default:
+   assert(!"Unexpected format");
+   bytes = 0;
+   }
+
+   image = malloc(width * height * bytes);
+   for (i = 0; i < width * height * bytes; i++) {

Re: [Piglit] [PATCH] ext_texture_integer: add new tex formats test

2015-08-31 Thread Ilia Mirkin
On Mon, Aug 31, 2015 at 7:21 PM, Brian Paul  wrote:
> Test glTexImage2D() and glGetTexImage() with a variety of internalFormats
> and user formats/types.
>
> Note: currently fails with Mesa, passes with NVIDIA.
> ---
>  tests/all.py |   1 +
>  tests/spec/ext_texture_integer/CMakeLists.gl.txt |   1 +
>  tests/spec/ext_texture_integer/texformats.c  | 182 
> +++
>  3 files changed, 184 insertions(+)
>  create mode 100644 tests/spec/ext_texture_integer/texformats.c
>
> diff --git a/tests/all.py b/tests/all.py
> index fe088f5..9320722 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -3127,6 +3127,7 @@ with profile.group_manager(
>  g(['ext_texture_integer-getteximage-clamping'], 'getteximage-clamping')
>  g(['ext_texture_integer-getteximage-clamping', 'GL_ARB_texture_rg'],
>'getteximage-clamping GL_ARB_texture_rg')
> +g(['ext_texture_integer-texformats']),
>  g(['ext_texture_integer-texture_integer_glsl130'],
>'texture_integer_glsl130')
>  g(['fbo-integer'], run_concurrent=False)
> diff --git a/tests/spec/ext_texture_integer/CMakeLists.gl.txt 
> b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
> index 44d9399..2932bc2 100644
> --- a/tests/spec/ext_texture_integer/CMakeLists.gl.txt
> +++ b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
> @@ -12,6 +12,7 @@ link_libraries (
>
>  piglit_add_executable (ext_texture_integer-fbo-blending fbo-blending.c)
>  piglit_add_executable (ext_texture_integer-fbo_integer_precision_clear 
> fbo-integer-precision-clear.c)
> +piglit_add_executable (ext_texture_integer-texformats texformats.c)
>  piglit_add_executable (ext_texture_integer-fbo_integer_readpixels_sint_uint 
> fbo-integer-readpixels-sint-uint.c)
>  piglit_add_executable (ext_texture_integer-getteximage-clamping 
> getteximage-clamping.c)
>  piglit_add_executable (ext_texture_integer-texture_integer_glsl130 
> texture-integer-glsl130.c)
> diff --git a/tests/spec/ext_texture_integer/texformats.c 
> b/tests/spec/ext_texture_integer/texformats.c
> new file mode 100644
> index 000..5a4f387
> --- /dev/null
> +++ b/tests/spec/ext_texture_integer/texformats.c
> @@ -0,0 +1,182 @@
> +/*
> + * Copyright (c) 2015 VMware, Inc.
> + *
> + * 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
> + * on the rights to use, copy, modify, merge, publish, distribute, sub
> + * license, 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
> + * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
> + * 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.
> + */
> +
> +/**
> + * Test glTexImage2D and glGetTexImage with a variety of combinations of
> + * internal formats, and user-specified formats/types.
> + *
> + * Brian Paul
> + * 31 August 2015
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +   config.supports_gl_compat_version = 10;
> +   config.window_visual = PIGLIT_GL_VISUAL_RGBA;
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +
> +static bool
> +test_format(GLenum intFormat, GLenum format, GLenum type)
> +{
> +   const int width = 8, height = 8;
> +   GLuint tex;
> +   GLubyte *image, *getimage;
> +   bool pass = true;
> +   int i, bytes;
> +
> +   switch (intFormat) {
> +   case GL_ALPHA8I_EXT:
> +   case GL_ALPHA8UI_EXT:
> +   bytes = 1;
> +   break;
> +   case GL_ALPHA16I_EXT:
> +   case GL_ALPHA16UI_EXT:
> +   bytes = 2;
> +   break;
> +   case GL_ALPHA32I_EXT:
> +   case GL_ALPHA32UI_EXT:
> +   bytes = 4;
> +   break;
> +   case GL_RGB8I:
> +   case GL_RGB8UI:
> +   bytes = 3;
> +   break;
> +   case GL_RGBA8I:
> +   case GL_RGBA8UI:
> +   bytes = 4;
> +   break;
> +   case GL_RGB16I:
> +   case GL_RGB16UI:
> +   bytes = 6;
> +   break;
> +   case GL_RGBA16I:
> +   case GL_RGBA16UI:
> +   bytes = 8;
> +   break;
> +   case GL_RGB32I:
> +   case GL_RGB32UI:
> +   bytes = 12;
> +  

Re: [Piglit] [PATCH] ext_texture_integer: add new tex formats test

2015-08-31 Thread Dave Airlie
On 1 September 2015 at 09:21, Brian Paul  wrote:
> Test glTexImage2D() and glGetTexImage() with a variety of internalFormats
> and user formats/types.
>
> Note: currently fails with Mesa, passes with NVIDIA.

As requested this passes on mesa with my format patches applied.

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