[Piglit] [PATCH 3/3] ARB_texture_view:Test valid and invalid targets for TextureView

2013-10-16 Thread Jon Ashburn
The new target supplied with textureView must be compatible with the
original textures target. This tests  valid and invalid combinations.

Tested on Nvidia Quadro 600, all tests pass.
---
 tests/all.tests   |   1 +
 tests/spec/arb_texture_view/CMakeLists.gl.txt |   1 +
 tests/spec/arb_texture_view/targets.c | 234 ++
 3 files changed, 236 insertions(+)
 create mode 100644 tests/spec/arb_texture_view/targets.c

diff --git a/tests/all.tests b/tests/all.tests
index 4d089b4..83d53c6 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1474,6 +1474,7 @@ spec['ARB_texture_view'] = arb_texture_view
 arb_texture_view['immutable_levels'] = 
concurrent_test('arb_texture_view-texture-immutable-levels')
 arb_texture_view['params'] = concurrent_test('arb_texture_view-params')
 arb_texture_view['formats'] = concurrent_test('arb_texture_view-formats')
+arb_texture_view['targets'] = concurrent_test('arb_texture_view-targets')
 
 tdfx_texture_compression_fxt1 = Group()
 spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index 44b6a64..193aff9 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -12,5 +12,6 @@ link_libraries(
 piglit_add_executable(arb_texture_view-texture-immutable-levels 
texture-immutable-levels.c)
 piglit_add_executable(arb_texture_view-params params.c)
 piglit_add_executable(arb_texture_view-formats formats.c common.c)
+piglit_add_executable(arb_texture_view-targets targets.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_view/targets.c 
b/tests/spec/arb_texture_view/targets.c
new file mode 100644
index 000..d2c0c19
--- /dev/null
+++ b/tests/spec/arb_texture_view/targets.c
@@ -0,0 +1,234 @@
+/*
+ * Copyright © 2013 LunarG, 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
+ * 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: Jon Ashburn 
+ */
+
+/**
+ * \file
+ * This (arb_texture_view-targets) tests valid and invalid new TextureView
+ * targets based on the original textures target.
+ *
+ * Section 8.18 (Texture Views) of OpenGL 4.3 Core says:
+ *"The new texture’s target must be compatible with the target of
+ * origtexture, as defined by table 8.20."
+ *
+ */
+
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 12;
+   config.supports_gl_core_version = 31;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char *TestName = "arb_texture_view-targets";
+
+
+/**
+ * Do error-check tests for texture targets
+ */
+static bool
+test_target_errors(GLenum target)
+{
+   GLint width = 64, height = 14, depth = 8;
+   const GLsizei levels = 1;
+   GLuint tex;
+   enum piglit_result pass = true;
+   GLenum legalTargets[4];
+   unsigned int numTargets, i;
+   GLenum illegalTargets[] = {
+   /* skip multisample */
+   GL_TEXTURE_1D,
+   GL_TEXTURE_2D,
+   GL_TEXTURE_3D,
+   GL_TEXTURE_CUBE_MAP,
+   GL_TEXTURE_RECTANGLE,
+   GL_TEXTURE_1D_ARRAY,
+   GL_TEXTURE_2D_ARRAY,
+   GL_TEXTURE_CUBE_MAP_ARRAY,
+   };
+
+   /* skip 2d_multisample  targets for now */
+   assert(target == GL_TEXTURE_1D ||
+  target == GL_TEXTURE_2D ||
+  target == GL_TEXTURE_3D ||
+  target == GL_TEXTURE_CUBE_MAP ||
+  target == GL_TEXTURE_RECTANGLE ||
+  target == GL_TEXTURE_1D_ARRAY ||
+  target == GL_TEXTURE_2D_ARRAY ||
+  target == GL_TEXTURE_CUBE_MAP_ARRAY);
+
+   glGenTextures(1, &tex);   /* orig tex */
+   glBindTexture(target, tex);

Re: [Piglit] [PATCH 3/3] ARB_texture_view:Test valid and invalid targets for TextureView

2013-10-17 Thread Brian Paul

On 10/16/2013 05:37 PM, Jon Ashburn wrote:

The new target supplied with textureView must be compatible with the
original textures target. This tests  valid and invalid combinations.

Tested on Nvidia Quadro 600, all tests pass.
---
  tests/all.tests   |   1 +
  tests/spec/arb_texture_view/CMakeLists.gl.txt |   1 +
  tests/spec/arb_texture_view/targets.c | 234 ++
  3 files changed, 236 insertions(+)
  create mode 100644 tests/spec/arb_texture_view/targets.c

diff --git a/tests/all.tests b/tests/all.tests
index 4d089b4..83d53c6 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1474,6 +1474,7 @@ spec['ARB_texture_view'] = arb_texture_view
  arb_texture_view['immutable_levels'] = 
concurrent_test('arb_texture_view-texture-immutable-levels')
  arb_texture_view['params'] = concurrent_test('arb_texture_view-params')
  arb_texture_view['formats'] = concurrent_test('arb_texture_view-formats')
+arb_texture_view['targets'] = concurrent_test('arb_texture_view-targets')

  tdfx_texture_compression_fxt1 = Group()
  spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index 44b6a64..193aff9 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -12,5 +12,6 @@ link_libraries(
  piglit_add_executable(arb_texture_view-texture-immutable-levels 
texture-immutable-levels.c)
  piglit_add_executable(arb_texture_view-params params.c)
  piglit_add_executable(arb_texture_view-formats formats.c common.c)
+piglit_add_executable(arb_texture_view-targets targets.c common.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_view/targets.c 
b/tests/spec/arb_texture_view/targets.c
new file mode 100644
index 000..d2c0c19
--- /dev/null
+++ b/tests/spec/arb_texture_view/targets.c
@@ -0,0 +1,234 @@
+/*
+ * Copyright © 2013 LunarG, 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
+ * 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: Jon Ashburn 
+ */
+
+/**
+ * \file
+ * This (arb_texture_view-targets) tests valid and invalid new TextureView
+ * targets based on the original textures target.
+ *
+ * Section 8.18 (Texture Views) of OpenGL 4.3 Core says:
+ *"The new texture’s target must be compatible with the target of
+ * origtexture, as defined by table 8.20."
+ *
+ */
+
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 12;
+   config.supports_gl_core_version = 31;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char *TestName = "arb_texture_view-targets";
+
+



You're calling update_valid_arrays() below but I don't see a declaration 
for it like in the format test.  I think common.h would be good.




+/**
+ * Do error-check tests for texture targets
+ */
+static bool
+test_target_errors(GLenum target)
+{
+   GLint width = 64, height = 14, depth = 8;
+   const GLsizei levels = 1;
+   GLuint tex;
+   enum piglit_result pass = true;


bool pass = true;



+   GLenum legalTargets[4];


Magic number 4?



+   unsigned int numTargets, i;
+   GLenum illegalTargets[] = {


static const?



+   /* skip multisample */
+   GL_TEXTURE_1D,
+   GL_TEXTURE_2D,
+   GL_TEXTURE_3D,
+   GL_TEXTURE_CUBE_MAP,
+   GL_TEXTURE_RECTANGLE,
+   GL_TEXTURE_1D_ARRAY,
+   GL_TEXTURE_2D_ARRAY,
+   GL_TEXTURE_CUBE_MAP_ARRAY,
+   };
+
+   /* skip 2d_multisample  targets for now */
+   assert(target == GL_TEXTURE_1D ||
+  target == GL_TEXTURE_2D ||
+  target == GL_TEXTURE_3D ||
+  target == GL_TEXTURE_CUBE_MAP ||
+  target == GL_TE

Re: [Piglit] [PATCH 3/3] ARB_texture_view:Test valid and invalid targets for TextureView

2013-10-18 Thread Ian Romanick
On 10/16/2013 04:37 PM, Jon Ashburn wrote:
> The new target supplied with textureView must be compatible with the
> original textures target. This tests  valid and invalid combinations.
> 
> Tested on Nvidia Quadro 600, all tests pass.
> ---
>  tests/all.tests   |   1 +
>  tests/spec/arb_texture_view/CMakeLists.gl.txt |   1 +
>  tests/spec/arb_texture_view/targets.c | 234 
> ++
>  3 files changed, 236 insertions(+)
>  create mode 100644 tests/spec/arb_texture_view/targets.c
> 
> diff --git a/tests/all.tests b/tests/all.tests
> index 4d089b4..83d53c6 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1474,6 +1474,7 @@ spec['ARB_texture_view'] = arb_texture_view
>  arb_texture_view['immutable_levels'] = 
> concurrent_test('arb_texture_view-texture-immutable-levels')
>  arb_texture_view['params'] = concurrent_test('arb_texture_view-params')
>  arb_texture_view['formats'] = concurrent_test('arb_texture_view-formats')
> +arb_texture_view['targets'] = concurrent_test('arb_texture_view-targets')
>  
>  tdfx_texture_compression_fxt1 = Group()
>  spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
> diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
> b/tests/spec/arb_texture_view/CMakeLists.gl.txt
> index 44b6a64..193aff9 100644
> --- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
> +++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
> @@ -12,5 +12,6 @@ link_libraries(
>  piglit_add_executable(arb_texture_view-texture-immutable-levels 
> texture-immutable-levels.c)
>  piglit_add_executable(arb_texture_view-params params.c)
>  piglit_add_executable(arb_texture_view-formats formats.c common.c)
> +piglit_add_executable(arb_texture_view-targets targets.c common.c)
>  
>  # vim: ft=cmake:
> diff --git a/tests/spec/arb_texture_view/targets.c 
> b/tests/spec/arb_texture_view/targets.c
> new file mode 100644
> index 000..d2c0c19
> --- /dev/null
> +++ b/tests/spec/arb_texture_view/targets.c
> @@ -0,0 +1,234 @@
> +/*
> + * Copyright © 2013 LunarG, 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
> + * 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: Jon Ashburn 
> + */
> +
> +/**
> + * \file
> + * This (arb_texture_view-targets) tests valid and invalid new TextureView
> + * targets based on the original textures target.
> + *
> + * Section 8.18 (Texture Views) of OpenGL 4.3 Core says:
> + *"The new texture’s target must be compatible with the target of
> + * origtexture, as defined by table 8.20."
> + *
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 12;
> + config.supports_gl_core_version = 31;
> +
> + config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static const char *TestName = "arb_texture_view-targets";
> +
> +
> +/**
> + * Do error-check tests for texture targets
> + */
> +static bool
> +test_target_errors(GLenum target)
> +{
> + GLint width = 64, height = 14, depth = 8;
> + const GLsizei levels = 1;
> + GLuint tex;
> + enum piglit_result pass = true;
> + GLenum legalTargets[4];
> + unsigned int numTargets, i;
> + GLenum illegalTargets[] = {
> + /* skip multisample */
> + GL_TEXTURE_1D,
> + GL_TEXTURE_2D,
> + GL_TEXTURE_3D,
> + GL_TEXTURE_CUBE_MAP,
> + GL_TEXTURE_RECTANGLE,
> + GL_TEXTURE_1D_ARRAY,
> + GL_TEXTURE_2D_ARRAY,
> + GL_TEXTURE_CUBE_MAP_ARRAY,
> + };
> +
> + /* skip 2d_multisample  targets for now */
> + assert(target == GL_TEXTURE_1D ||
> +target == GL_TEXTURE_2D ||
> +target == GL_TEXTURE_3D ||
> +target == GL_TEXTURE_CUBE_MAP ||
> +target == GL_TEXTURE_RECTANGLE ||
> 

Re: [Piglit] [PATCH 3/3] ARB_texture_view:Test valid and invalid targets for TextureView

2013-10-18 Thread Jon Ashburn


On 10/18/2013 12:43 PM, Ian Romanick wrote:

On 10/16/2013 04:37 PM, Jon Ashburn wrote:

The new target supplied with textureView must be compatible with the
original textures target. This tests  valid and invalid combinations.

Tested on Nvidia Quadro 600, all tests pass.
---
  tests/all.tests   |   1 +
  tests/spec/arb_texture_view/CMakeLists.gl.txt |   1 +
  tests/spec/arb_texture_view/targets.c | 234 ++
  3 files changed, 236 insertions(+)
  create mode 100644 tests/spec/arb_texture_view/targets.c

diff --git a/tests/all.tests b/tests/all.tests
index 4d089b4..83d53c6 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1474,6 +1474,7 @@ spec['ARB_texture_view'] = arb_texture_view
  arb_texture_view['immutable_levels'] = 
concurrent_test('arb_texture_view-texture-immutable-levels')
  arb_texture_view['params'] = concurrent_test('arb_texture_view-params')
  arb_texture_view['formats'] = concurrent_test('arb_texture_view-formats')
+arb_texture_view['targets'] = concurrent_test('arb_texture_view-targets')
  
  tdfx_texture_compression_fxt1 = Group()

  spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index 44b6a64..193aff9 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -12,5 +12,6 @@ link_libraries(
  piglit_add_executable(arb_texture_view-texture-immutable-levels 
texture-immutable-levels.c)
  piglit_add_executable(arb_texture_view-params params.c)
  piglit_add_executable(arb_texture_view-formats formats.c common.c)
+piglit_add_executable(arb_texture_view-targets targets.c common.c)
  
  # vim: ft=cmake:

diff --git a/tests/spec/arb_texture_view/targets.c 
b/tests/spec/arb_texture_view/targets.c
new file mode 100644
index 000..d2c0c19
--- /dev/null
+++ b/tests/spec/arb_texture_view/targets.c
@@ -0,0 +1,234 @@
+/*
+ * Copyright © 2013 LunarG, 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
+ * 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: Jon Ashburn 
+ */
+
+/**
+ * \file
+ * This (arb_texture_view-targets) tests valid and invalid new TextureView
+ * targets based on the original textures target.
+ *
+ * Section 8.18 (Texture Views) of OpenGL 4.3 Core says:
+ *"The new texture’s target must be compatible with the target of
+ * origtexture, as defined by table 8.20."
+ *
+ */
+
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 12;
+   config.supports_gl_core_version = 31;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char *TestName = "arb_texture_view-targets";
+
+
+/**
+ * Do error-check tests for texture targets
+ */
+static bool
+test_target_errors(GLenum target)
+{
+   GLint width = 64, height = 14, depth = 8;
+   const GLsizei levels = 1;
+   GLuint tex;
+   enum piglit_result pass = true;
+   GLenum legalTargets[4];
+   unsigned int numTargets, i;
+   GLenum illegalTargets[] = {
+   /* skip multisample */
+   GL_TEXTURE_1D,
+   GL_TEXTURE_2D,
+   GL_TEXTURE_3D,
+   GL_TEXTURE_CUBE_MAP,
+   GL_TEXTURE_RECTANGLE,
+   GL_TEXTURE_1D_ARRAY,
+   GL_TEXTURE_2D_ARRAY,
+   GL_TEXTURE_CUBE_MAP_ARRAY,
+   };
+
+   /* skip 2d_multisample  targets for now */
+   assert(target == GL_TEXTURE_1D ||
+  target == GL_TEXTURE_2D ||
+  target == GL_TEXTURE_3D ||
+  target == GL_TEXTURE_CUBE_MAP ||
+  target == GL_TEXTURE_RECTANGLE ||
+  target == GL_TEXTURE_1D_ARRAY ||
+  target == GL_TEXTURE_2D_ARRAY ||
+  target == GL_TE