[Piglit] [PATCH 03/21] arb_internalformat_query2: test for the most generic pname checks

2016-01-22 Thread Alejandro Piñeiro
The spec includes conditions for all the pnames. On most cases, it is
generic like this:

 "Possible values returned are . If the resource is not
  supported, or if the operation is not supported, NONE is
  returned."

So this test checks that for those pnames:
 * If it is not supported (using INTERNALFORMAT_SUPPORTED), the
   returned value is zero.
 * If it is supported, and there is available a list of possible
   values, the returned value is among one of those values.

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: most of them passes,
except:

* IMAGE_TEXEL_SIZE
  From spec:
  The size of a texel when the resource when used as an image
  texture is returned in .  This is the value from the
  /Size/ column in Table 3.22. If the resource is not supported
  for image textures, or if image textures are not supported, zero
  is returned.

  NVIDIA proprietary drivers returns 1, 2 or 4, a values not present on Table 
3.22.

* IMAGE_PIXEL_TYPE:
  From spec:
  The pixel type of the resource when used as an image texture is
  returned in .  This is the value from the /Pixel type/
  column in Table 3.22. If the resource is not supported for image
  textures, or if image textures are not supported, NONE is
  returned.

  NVIDIA proprietary drivers returns in some cases
  GL_UNSIGNED_INT_8_8_8_8_REV, that although defined on core spec 4.2,
  it is not included on Table 3.22

* IMAGE_PIXEL_FORMAT:
  From spec:
  The pixel format of the resource when used as an image texture
  is returned in .  This is the value from the /Pixel
  format/ column in Table 3.22. If the resource is not supported
  for image textures, or if image textures are not supported, NONE
  is returned.

  NVIDIA proprietary drivers returns in some cases GL_R11F_G11F_B10F,
  that although defined on core spec 4.2, it is not included on Table
  3.22
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   1 +
 tests/spec/arb_internalformat_query2/common.c  | 599 +
 tests/spec/arb_internalformat_query2/common.h  |  52 +-
 .../generic-pname-checks.c | 234 
 5 files changed, 886 insertions(+), 1 deletion(-)
 create mode 100644 tests/spec/arb_internalformat_query2/common.c
 create mode 100644 tests/spec/arb_internalformat_query2/generic-pname-checks.c

diff --git a/tests/all.py b/tests/all.py
index 8bfd817..19754c6 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3637,6 +3637,7 @@ with profile.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'arb_internalformat_query2')) as g:
 g(['arb_internalformat_query2-api-errors'], 'API error checks')
+g(['arb_internalformat_query2-generic-pname-checks'], 'Individual most 
generic pname checks')
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
index 7a0e857..cd3b07e 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -9,5 +9,6 @@ link_libraries (
 )
 
 piglit_add_executable (arb_internalformat_query2-api-errors api-errors.c)
+piglit_add_executable (arb_internalformat_query2-generic-pname-checks 
generic-pname-checks.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/common.c 
b/tests/spec/arb_internalformat_query2/common.c
new file mode 100644
index 000..83dbd3d
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/common.c
@@ -0,0 +1,599 @@
+/*
+ * 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 "common.h"
+#include   /* for PRIu64 macro */
+
+/* Generic callback type, doing a cast of 

[Piglit] [PATCH 03/21] arb_internalformat_query2: test for the most generic pname checks

2016-01-19 Thread Alejandro Piñeiro
The spec includes conditions for all the pnames. On most cases, it is
generic like this:

 "Possible values returned are . If the resource is not
  supported, or if the operation is not supported, NONE is
  returned."

So this test checks that for those pnames:
 * If it is not supported (using INTERNALFORMAT_SUPPORTED), the
   returned value is zero.
 * If it is supported, and there is available a list of possible
   values, the returned value is among one of those values.

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: most of them passes,
except:

* IMAGE_TEXEL_SIZE
  From spec:
  The size of a texel when the resource when used as an image
  texture is returned in .  This is the value from the
  /Size/ column in Table 3.22. If the resource is not supported
  for image textures, or if image textures are not supported, zero
  is returned.

  NVIDIA proprietary drivers returns 1, 2 or 4, a values not present on Table 
3.22.

* IMAGE_PIXEL_TYPE:
  From spec:
  The pixel type of the resource when used as an image texture is
  returned in .  This is the value from the /Pixel type/
  column in Table 3.22. If the resource is not supported for image
  textures, or if image textures are not supported, NONE is
  returned.

  NVIDIA proprietary drivers returns in some cases
  GL_UNSIGNED_INT_8_8_8_8_REV, that although defined on core spec 4.2,
  it is not included on Table 3.22

* IMAGE_PIXEL_FORMAT:
  From spec:
  The pixel format of the resource when used as an image texture
  is returned in .  This is the value from the /Pixel
  format/ column in Table 3.22. If the resource is not supported
  for image textures, or if image textures are not supported, NONE
  is returned.

  NVIDIA proprietary drivers returns in some cases GL_R11F_G11F_B10F,
  that although defined on core spec 4.2, it is not included on Table
  3.22
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   1 +
 tests/spec/arb_internalformat_query2/common.c  | 314 +
 tests/spec/arb_internalformat_query2/common.h  |  48 +++-
 .../generic-pname-checks.c | 235 +++
 5 files changed, 598 insertions(+), 1 deletion(-)
 create mode 100644 tests/spec/arb_internalformat_query2/common.c
 create mode 100644 tests/spec/arb_internalformat_query2/generic-pname-checks.c

diff --git a/tests/all.py b/tests/all.py
index 3911099..ff57f3b 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3620,6 +3620,7 @@ with profile.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'arb_internalformat_query2')) as g:
 g(['arb_internalformat_query2-api-errors'], 'API error checks')
+g(['arb_internalformat_query2-generic-pname-checks'], 'Individual most 
generic pname checks')
 
 with profile.group_manager(
 PiglitGLTest, grouptools.join('spec', 'arb_map_buffer_range')) as g:
diff --git a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt 
b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
index 7a0e857..cd3b07e 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -9,5 +9,6 @@ link_libraries (
 )
 
 piglit_add_executable (arb_internalformat_query2-api-errors api-errors.c)
+piglit_add_executable (arb_internalformat_query2-generic-pname-checks 
generic-pname-checks.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/common.c 
b/tests/spec/arb_internalformat_query2/common.c
new file mode 100644
index 000..99ea485
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/common.c
@@ -0,0 +1,314 @@
+/*
+ * 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 "common.h"
+#include   /* for PRIu64 macro */
+
+/* Generic callback type, doing a