[Piglit] [PATCH 21/21] arb_internalformat_query2: Added tests for {COLOR, DEPTH, STENCIL}_COMPONENTS

2016-01-22 Thread Alejandro Piñeiro
From: Antia Puentes 

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: pass.
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   1 +
 .../arb_internalformat_query2/format-components.c  | 281 +
 3 files changed, 283 insertions(+)
 create mode 100644 tests/spec/arb_internalformat_query2/format-components.c

diff --git a/tests/all.py b/tests/all.py
index 0eb30c8..e8d3bb6 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3648,6 +3648,7 @@ with profile.group_manager(
 g(['arb_internalformat_query2-minmax'], 'minmax check for 
SAMPLES/NUM_SAMPLE_COUNTS')
 g(['arb_internalformat_query2-image-texture'], 'Checks for pnames related 
to ARB_image_load_store that return values from Table 3.22 (OpenGL 4.2)')
 g(['arb_internalformat_query2-filter'], 'FILTER pname checks.')
+g(['arb_internalformat_query2-format-components'], 
'{COLOR,DEPTH,STENCIL}_COMPONENTS 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 f3da78d..13590a0 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -20,5 +20,6 @@ piglit_add_executable 
(arb_internalformat_query2-texture-compressed-block textur
 piglit_add_executable (arb_internalformat_query2-minmax minmax.c common.c)
 piglit_add_executable (arb_internalformat_query2-image-texture image-texture.c 
common.c)
 piglit_add_executable (arb_internalformat_query2-filter filter.c common.c)
+piglit_add_executable (arb_internalformat_query2-format-components 
format-components.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/format-components.c 
b/tests/spec/arb_internalformat_query2/format-components.c
new file mode 100644
index 000..10d7f52
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/format-components.c
@@ -0,0 +1,281 @@
+/*
+ * 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.
+ */
+
+/**
+ * \file format-components.c
+ *
+ * Tests if the values returned by:
+ *
+ *  * COLOR_COMPONENTS
+ *  * STENCIL_COMPONENTS
+ *  * DEPTH_COMPONENTS
+ *
+ * are correct for all the internalformats.
+ */
+
+#include "common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+config.supports_gl_compat_version = 10;
+config.window_visual = PIGLIT_GL_VISUAL_RGB;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+return PIGLIT_FAIL;
+}
+
+static const GLenum pnames[] = {
+GL_COLOR_COMPONENTS,
+GL_STENCIL_COMPONENTS,
+GL_DEPTH_COMPONENTS,
+};
+
+static GLboolean
+is_color_format(GLenum internalformat)
+{
+switch (internalformat) {
+case GL_RED:
+case GL_RG:
+case GL_RGB:
+case GL_RGBA:
+case GL_R8:
+case GL_R8_SNORM:
+case GL_R16:
+case GL_R16_SNORM:
+case GL_RG8:
+case GL_RG8_SNORM:
+case GL_RG16:
+case GL_RG16_SNORM:
+case GL_R3_G3_B2:
+case GL_RGB4:
+case GL_RGB5:
+case GL_RGB8:
+case GL_RGB8_SNORM:
+case GL_RGB10:
+case GL_RGB12:
+case GL_RGB16:
+case GL_RGB16_SNORM:
+case GL_RGBA2:
+case GL_RGBA4:
+case GL_RGB5_A1:
+case GL_RGBA8:
+case GL_RGBA8_SNORM:
+case GL_RGB10_A2:
+case GL_RGB10_A2UI:
+case GL_RGBA12:
+case GL_RGBA16:
+case GL_RGBA16_SNORM:
+case GL_SRGB8:
+case GL_SRGB8_ALPHA8:
+case GL_R16F:
+case GL_RG16F:
+case GL_RGB16F:
+case GL_RGBA16F:
+case GL_R32F:
+case GL_RG32F:
+case 

[Piglit] [PATCH 21/21] arb_internalformat_query2: Added tests for {COLOR, DEPTH, STENCIL}_COMPONENTS

2016-01-19 Thread Alejandro Piñeiro
From: Antia Puentes 

Tested on NVIDIA GeForce GTX 950 - NVIDIA 352.55: pass.
---
 tests/all.py   |   1 +
 .../arb_internalformat_query2/CMakeLists.gl.txt|   1 +
 .../arb_internalformat_query2/format-components.c  | 280 +
 3 files changed, 282 insertions(+)
 create mode 100644 tests/spec/arb_internalformat_query2/format-components.c

diff --git a/tests/all.py b/tests/all.py
index ea251c3..45cdf9d 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3631,6 +3631,7 @@ with profile.group_manager(
 g(['arb_internalformat_query2-minmax'], 'minmax check for 
SAMPLES/NUM_SAMPLE_COUNTS')
 g(['arb_internalformat_query2-image-texture'], 'Checks for pnames related 
to ARB_image_load_store that return values from Table 3.22 (OpenGL 4.2)')
 g(['arb_internalformat_query2-filter'], 'FILTER pname checks.')
+g(['arb_internalformat_query2-format-components'], 
'{COLOR,DEPTH,STENCIL}_COMPONENTS 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 f3da78d..13590a0 100644
--- a/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
+++ b/tests/spec/arb_internalformat_query2/CMakeLists.gl.txt
@@ -20,5 +20,6 @@ piglit_add_executable 
(arb_internalformat_query2-texture-compressed-block textur
 piglit_add_executable (arb_internalformat_query2-minmax minmax.c common.c)
 piglit_add_executable (arb_internalformat_query2-image-texture image-texture.c 
common.c)
 piglit_add_executable (arb_internalformat_query2-filter filter.c common.c)
+piglit_add_executable (arb_internalformat_query2-format-components 
format-components.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_internalformat_query2/format-components.c 
b/tests/spec/arb_internalformat_query2/format-components.c
new file mode 100644
index 000..98fe959
--- /dev/null
+++ b/tests/spec/arb_internalformat_query2/format-components.c
@@ -0,0 +1,280 @@
+/*
+ * 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.
+ */
+
+/**
+ * \file format-components.c
+ *
+ * Tests if the values returned by:
+ *
+ *  * COLOR_COMPONENTS
+ *  * STENCIL_COMPONENTS
+ *  * DEPTH_COMPONENTS
+ *
+ * are correct for all the internalformats.
+ */
+
+#include "common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+config.supports_gl_compat_version = 10;
+config.window_visual = PIGLIT_GL_VISUAL_RGB;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+return PIGLIT_FAIL;
+}
+
+static const GLenum pnames[] = {
+GL_COLOR_COMPONENTS,
+GL_STENCIL_COMPONENTS,
+GL_DEPTH_COMPONENTS,
+};
+
+static GLboolean
+is_color_format(GLenum internalformat)
+{
+switch (internalformat) {
+case GL_RED:
+case GL_RG:
+case GL_RGB:
+case GL_RGBA:
+case GL_R8:
+case GL_R8_SNORM:
+case GL_R16:
+case GL_R16_SNORM:
+case GL_RG8:
+case GL_RG8_SNORM:
+case GL_RG16:
+case GL_RG16_SNORM:
+case GL_R3_G3_B2:
+case GL_RGB4:
+case GL_RGB5:
+case GL_RGB8:
+case GL_RGB8_SNORM:
+case GL_RGB10:
+case GL_RGB12:
+case GL_RGB16:
+case GL_RGB16_SNORM:
+case GL_RGBA2:
+case GL_RGBA4:
+case GL_RGB5_A1:
+case GL_RGBA8:
+case GL_RGBA8_SNORM:
+case GL_RGB10_A2:
+case GL_RGB10_A2UI:
+case GL_RGBA12:
+case GL_RGBA16:
+case GL_RGBA16_SNORM:
+case GL_SRGB8:
+case GL_SRGB8_ALPHA8:
+case GL_R16F:
+case GL_RG16F:
+case GL_RGB16F:
+case GL_RGBA16F:
+case GL_R32F:
+case GL_RG32F:
+case