[Piglit] [PATCH] texture-storage: add specific test for attaching to fbo

Anuj Phogat anuj.phogat at gmail.com
Fri Aug 21 10:43:21 PDT 2015


On Thu, Aug 20, 2015 at 10:34 PM, Tapani Pälli <tapani.palli at intel.com> wrote:
> This test currently crashes on Mesa, tested using i965 driver.
>
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91673
> ---
>  tests/all.py                                       |  2 +
>  tests/spec/arb_texture_storage/CMakeLists.gl.txt   |  1 +
>  .../arb_texture_storage/attach-before-storage.c    | 83 ++++++++++++++++++++++
>  3 files changed, 86 insertions(+)
>  create mode 100644 tests/spec/arb_texture_storage/attach-before-storage.c
>
> diff --git a/tests/all.py b/tests/all.py
> index feccce5..fe088f5 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -2406,6 +2406,8 @@ with profile.group_manager(
>          PiglitGLTest, grouptools.join('spec', 'ARB_texture_storage')) as g:
>      g(['arb_texture_storage-texture-storage'], 'texture-storage',
>        run_concurrent=False)
> +    g(['arb_texture_storage-texture-storage-attach-before'], 'attach-before',
> +      run_concurrent=False)
>
>  with profile.group_manager(
>          PiglitGLTest,
> diff --git a/tests/spec/arb_texture_storage/CMakeLists.gl.txt b/tests/spec/arb_texture_storage/CMakeLists.gl.txt
> index 67613be..2ab19df 100644
> --- a/tests/spec/arb_texture_storage/CMakeLists.gl.txt
> +++ b/tests/spec/arb_texture_storage/CMakeLists.gl.txt
> @@ -10,5 +10,6 @@ link_libraries (
>  )
>
>  piglit_add_executable (arb_texture_storage-texture-storage texture-storage.c)
> +piglit_add_executable (arb_texture_storage-texture-storage-attach-before attach-before-storage.c)
I think better name is arb_texture_storage-attach-before-storage. I'm fine
if you don't want to change it.

>
>  # vim: ft=cmake:
> diff --git a/tests/spec/arb_texture_storage/attach-before-storage.c b/tests/spec/arb_texture_storage/attach-before-storage.c
> new file mode 100644
> index 0000000..38087e7
> --- /dev/null
> +++ b/tests/spec/arb_texture_storage/attach-before-storage.c
> @@ -0,0 +1,83 @@
> +/*
> + * 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 attach-before-storage.c
> + *
> + * Trigger a bug with a codepath where we bind a texture as a framebuffer
> + * attachment, call glTexStorage2D and then update texture contents with
> + * glTexSubImage2D.
> + *
> + * Based on a test case in https://bugs.freedesktop.org/show_bug.cgi?id=91673
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +       config.supports_gl_compat_version = 12;
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +/* Dummy */
> +enum piglit_result
> +piglit_display(void)
> +{
> +       return PIGLIT_FAIL;
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +       GLuint tex, fbo;
> +       char pixels[16] = {
> +               1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4
> +       };
> +
> +       piglit_require_extension("GL_ARB_texture_storage");
> +       piglit_require_extension("GL_ARB_framebuffer_object");
> +
> +       glEnable(GL_TEXTURE_2D);
> +
> +       glGenTextures(1, &tex);
> +       glBindTexture(GL_TEXTURE_2D, tex);
> +
> +       glGenFramebuffers(1, &fbo);
> +       glBindFramebuffer(GL_FRAMEBUFFER, fbo);
> +       glFramebufferTexture2D(GL_FRAMEBUFFER,
> +               GL_COLOR_ATTACHMENT0,
> +               GL_TEXTURE_2D,
> +               tex,
> +               0);
Check for FBO completeness.
> +
> +       glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 2, 2);
> +       glTexSubImage2D(GL_TEXTURE_2D,
> +               0,
> +               0, 0,
> +               2, 2,
> +               GL_RGBA, GL_UNSIGNED_BYTE,
> +               pixels);
> +
> +       glDeleteTextures(1, &tex);
> +       glDeleteFramebuffers(1, &fbo);
> +
May be add a piglit_error_check() here and a comment stating "test passes if it
completes without crashing".
> +       piglit_report_result(PIGLIT_PASS);
> +}
> --
> 2.4.3
>

With these changes:
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the Piglit mailing list