Re: [Piglit] [PATCH v2] arb_direct_state_access: Add a FramebufferTextureLayer cube-map test

2015-05-21 Thread Fredrik Höglund
On Thursday 21 May 2015, Ian Romanick wrote:
 On 04/29/2015 12:21 PM, Fredrik Höglund wrote:
  This test verifies that faces of a cube-map texture can be attached
  to a framebuffer object using glNamedFramebufferTextureLayer and
  glFramebufferTextureLayer.
  ---
  
  v2: - Remove the check for ARB_vertex_array_object (core in 3.0)
  - Fix the executable name in all.py
  
   tests/all.py   |   4 +
   .../spec/arb_direct_state_access/CMakeLists.gl.txt |   1 +
   .../fbo-texturelayer-cubemap.c | 321 
  +
   3 files changed, 326 insertions(+)
   create mode 100644 
  tests/spec/arb_direct_state_access/fbo-texturelayer-cubemap.c
  
  diff --git a/tests/all.py b/tests/all.py
  index 6197c18..efecc09 100755
  --- a/tests/all.py
  +++ b/tests/all.py
  @@ -4305,6 +4305,10 @@ with profile.group_manager(
   g(['arb_direct_state_access-create-programpipelines'],
 'create-programpipelines')
   g(['arb_direct_state_access-create-queries'], 'create-queries')
  +g(['arb_direct_state_access-fbo-texturelayer-cubemap', 
  'glNamedFramebufferTextureLayer'],
  +  'fbo-texturelayer-cubemap glNamedFramebufferTextureLayer')
  +g(['arb_direct_state_access-fbo-texturelayer-cubemap', 
  'glFramebufferTextureLayer'],
  +  'fbo-texturelayer-cubemap glFramebufferTextureLayer')
   
   with profile.group_manager(
   PiglitGLTest,
  diff --git a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt 
  b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
  index a5ae423..1b837f9 100644
  --- a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
  +++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
  @@ -36,4 +36,5 @@ piglit_add_executable 
  (arb_direct_state_access-texture-buffer texture-buffer.c)
   piglit_add_executable (arb_direct_state_access-create-samplers 
  create-samplers.c)
   piglit_add_executable (arb_direct_state_access-create-programpipelines 
  create-programpipelines.c)
   piglit_add_executable (arb_direct_state_access-create-queries 
  create-queries.c)
  +piglit_add_executable (arb_direct_state_access-fbo-texturelayer-cubemap 
  fbo-texturelayer-cubemap.c)
   # vim: ft=cmake:
  diff --git a/tests/spec/arb_direct_state_access/fbo-texturelayer-cubemap.c 
  b/tests/spec/arb_direct_state_access/fbo-texturelayer-cubemap.c
  new file mode 100644
  index 000..e3e9ac3
  --- /dev/null
  +++ b/tests/spec/arb_direct_state_access/fbo-texturelayer-cubemap.c
  @@ -0,0 +1,321 @@
  +/*
  + * Copyright (C) 2015 Fredrik Höglund
  + *
  + * 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
  + * THE AUTHORS 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.
  + */
  +
  +/**
  + * @file fbo-texturelayer-cubemap.c
  + *
  + * Verifies that faces of a cube-map texture can be attached to a
  + * framebuffer object using NamedFramebufferTextureLayer and
  + * FramebufferTextureLayer.
  + */
  +
  +#include piglit-util-gl.h
  +
  +
  +PIGLIT_GL_TEST_CONFIG_BEGIN
  +
  +   config.supports_gl_core_version = 31;
  +
  +   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
  +
  +PIGLIT_GL_TEST_CONFIG_END
  +
  +
  +const char *vs =
  +#version 140\n
  +#extension GL_ARB_draw_instanced : require\n
  +in vec4 piglit_vertex;\n
  +in vec3 piglit_texcoord;\n
  +out vec3 texcoord;\n
  +void main(void)\n{\n
  +gl_Position = piglit_vertex;\n
  +gl_Position.xy +=\n
  +vec2(gl_InstanceID) * vec2(1.0 / 3.0, -1.0 / 3.0);\n
  +texcoord = piglit_texcoord;\n
  +};
  +
  +const char *fs =
  +#version 140\n
  +in vec3 texcoord;\n
  +out vec4 fragColor;\n
  +uniform samplerCube sampler;\n
  +void main(void)\n{\n
  +fragColor = texture(sampler, texcoord);\n
  +};
  +
  +static bool test_named_fbo = false;
  +
  +
  +static bool
  +check_attachment_parameter(GLuint fbo, GLenum 

Re: [Piglit] [PATCH v2] arb_direct_state_access: Add a FramebufferTextureLayer cube-map test

2015-05-20 Thread Ian Romanick
On 04/29/2015 12:21 PM, Fredrik Höglund wrote:
 This test verifies that faces of a cube-map texture can be attached
 to a framebuffer object using glNamedFramebufferTextureLayer and
 glFramebufferTextureLayer.
 ---
 
 v2: - Remove the check for ARB_vertex_array_object (core in 3.0)
 - Fix the executable name in all.py
 
  tests/all.py   |   4 +
  .../spec/arb_direct_state_access/CMakeLists.gl.txt |   1 +
  .../fbo-texturelayer-cubemap.c | 321 
 +
  3 files changed, 326 insertions(+)
  create mode 100644 
 tests/spec/arb_direct_state_access/fbo-texturelayer-cubemap.c
 
 diff --git a/tests/all.py b/tests/all.py
 index 6197c18..efecc09 100755
 --- a/tests/all.py
 +++ b/tests/all.py
 @@ -4305,6 +4305,10 @@ with profile.group_manager(
  g(['arb_direct_state_access-create-programpipelines'],
'create-programpipelines')
  g(['arb_direct_state_access-create-queries'], 'create-queries')
 +g(['arb_direct_state_access-fbo-texturelayer-cubemap', 
 'glNamedFramebufferTextureLayer'],
 +  'fbo-texturelayer-cubemap glNamedFramebufferTextureLayer')
 +g(['arb_direct_state_access-fbo-texturelayer-cubemap', 
 'glFramebufferTextureLayer'],
 +  'fbo-texturelayer-cubemap glFramebufferTextureLayer')
  
  with profile.group_manager(
  PiglitGLTest,
 diff --git a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt 
 b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
 index a5ae423..1b837f9 100644
 --- a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
 +++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
 @@ -36,4 +36,5 @@ piglit_add_executable 
 (arb_direct_state_access-texture-buffer texture-buffer.c)
  piglit_add_executable (arb_direct_state_access-create-samplers 
 create-samplers.c)
  piglit_add_executable (arb_direct_state_access-create-programpipelines 
 create-programpipelines.c)
  piglit_add_executable (arb_direct_state_access-create-queries 
 create-queries.c)
 +piglit_add_executable (arb_direct_state_access-fbo-texturelayer-cubemap 
 fbo-texturelayer-cubemap.c)
  # vim: ft=cmake:
 diff --git a/tests/spec/arb_direct_state_access/fbo-texturelayer-cubemap.c 
 b/tests/spec/arb_direct_state_access/fbo-texturelayer-cubemap.c
 new file mode 100644
 index 000..e3e9ac3
 --- /dev/null
 +++ b/tests/spec/arb_direct_state_access/fbo-texturelayer-cubemap.c
 @@ -0,0 +1,321 @@
 +/*
 + * Copyright (C) 2015 Fredrik Höglund
 + *
 + * 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
 + * THE AUTHORS 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.
 + */
 +
 +/**
 + * @file fbo-texturelayer-cubemap.c
 + *
 + * Verifies that faces of a cube-map texture can be attached to a
 + * framebuffer object using NamedFramebufferTextureLayer and
 + * FramebufferTextureLayer.
 + */
 +
 +#include piglit-util-gl.h
 +
 +
 +PIGLIT_GL_TEST_CONFIG_BEGIN
 +
 + config.supports_gl_core_version = 31;
 +
 + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
 +
 +PIGLIT_GL_TEST_CONFIG_END
 +
 +
 +const char *vs =
 +#version 140\n
 +#extension GL_ARB_draw_instanced : require\n
 +in vec4 piglit_vertex;\n
 +in vec3 piglit_texcoord;\n
 +out vec3 texcoord;\n
 +void main(void)\n{\n
 +gl_Position = piglit_vertex;\n
 +gl_Position.xy +=\n
 +vec2(gl_InstanceID) * vec2(1.0 / 3.0, -1.0 / 3.0);\n
 +texcoord = piglit_texcoord;\n
 +};
 +
 +const char *fs =
 +#version 140\n
 +in vec3 texcoord;\n
 +out vec4 fragColor;\n
 +uniform samplerCube sampler;\n
 +void main(void)\n{\n
 +fragColor = texture(sampler, texcoord);\n
 +};
 +
 +static bool test_named_fbo = false;
 +
 +
 +static bool
 +check_attachment_parameter(GLuint fbo, GLenum attachment,
 +   GLenum pname, GLint expected, int line)
 +{
 + GLint value;
 + glGetNamedFramebufferAttachmentParameteriv(fbo, attachment,
 +