[Piglit] [PATCH] arb_vertex_array_bgra: Add tests for glGet*(GL_*_ARRAY_SIZE) == GL_BGRA.

Brian Paul brian.e.paul at gmail.com
Sun Jun 1 13:43:15 PDT 2014


Reviewed-by: Brian Paul <brianp at vmware.com>



On Sun, Jun 1, 2014 at 1:54 PM, <jfonseca at vmware.com> wrote:

> From: José Fonseca <jose.r.fonseca at gmail.com>
>
> Mesa didn't get this quite right, causing problems to ApiTrace --
> https://github.com/apitrace/apitrace/issues/261 .
> ---
>  tests/all.py                                       |  1 +
>  tests/spec/arb_vertex_array_bgra/CMakeLists.gl.txt |  1 +
>  tests/spec/arb_vertex_array_bgra/get.c             | 81
> ++++++++++++++++++++++
>  3 files changed, 83 insertions(+)
>  create mode 100644 tests/spec/arb_vertex_array_bgra/get.c
>
> diff --git a/tests/all.py b/tests/all.py
> index a67e725..8128b4f 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -2157,6 +2157,7 @@ add_plain_test(apple_vertex_array_object, 'vao-02')
>  apple_vertex_array_object['isvertexarray'] =
> concurrent_test('arb_vertex_array-isvertexarray apple')
>
>  profile.test_list['spec/ARB_vertex_array_bgra/api-errors'] =
> PiglitTest('arb_vertex_array_bgra-api-errors -auto')
> +profile.test_list['spec/ARB_vertex_array_bgra/get'] =
> PiglitTest('arb_vertex_array_bgra-get -auto')
>
>  arb_vertex_array_object = {}
>  spec['ARB_vertex_array_object'] = arb_vertex_array_object
> diff --git a/tests/spec/arb_vertex_array_bgra/CMakeLists.gl.txt
> b/tests/spec/arb_vertex_array_bgra/CMakeLists.gl.txt
> index 3f3579b..4ae8eca 100644
> --- a/tests/spec/arb_vertex_array_bgra/CMakeLists.gl.txt
> +++ b/tests/spec/arb_vertex_array_bgra/CMakeLists.gl.txt
> @@ -10,5 +10,6 @@ link_libraries (
>  )
>
>  piglit_add_executable (arb_vertex_array_bgra-api-errors api-errors.c)
> +piglit_add_executable (arb_vertex_array_bgra-get get.c)
>
>  # vim: ft=cmake:
> diff --git a/tests/spec/arb_vertex_array_bgra/get.c
> b/tests/spec/arb_vertex_array_bgra/get.c
> new file mode 100644
> index 0000000..05dc2f3
> --- /dev/null
> +++ b/tests/spec/arb_vertex_array_bgra/get.c
> @@ -0,0 +1,81 @@
> +/*
> + * Copyright 2014 VMware, Inc
> + * Copyright 2013 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.
> + */
> +
> +/*
> + * This tests that glGet*(GL_*_ARRAY_SIZE) returns GL_BGRA.
> + *
> + * Tools like ApiTrace rely on this to work correctly.  See for example
> + * https://github.com/apitrace/apitrace/issues/261 .
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +       config.supports_gl_compat_version = 10;
> +       config.window_visual = PIGLIT_GL_VISUAL_RGB |
> PIGLIT_GL_VISUAL_DOUBLE;
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +       static const GLubyte ubytes[4] = { 255, 0, 0, 127 };
> +       bool pass = true;
> +       GLint size;
> +
> +       piglit_require_gl_version(20);
> +       piglit_require_extension("GL_ARB_vertex_array_bgra");
> +
> +       glColorPointer(GL_BGRA, GL_UNSIGNED_BYTE, sizeof ubytes, ubytes);
> +       size = 0;
> +       glGetIntegerv(GL_COLOR_ARRAY_SIZE, &size);
> +       if (size != GL_BGRA) {
> +               fprintf(stderr, "glGetIntegerv(GL_COLOR_ARRAY_SIZE)
> returned %i, GL_BGRA expected\n", size);
> +               pass = false;
> +       }
> +
> +       glSecondaryColorPointer(GL_BGRA, GL_UNSIGNED_BYTE, sizeof ubytes,
> ubytes);
> +       size = 0;
> +       glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_SIZE, &size);
> +       if (size != GL_BGRA) {
> +               fprintf(stderr,
> "glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_SIZE) returned %i, GL_BGRA
> expected\n", size);
> +               pass = false;
> +       }
> +
> +       glVertexAttribPointer(1, GL_BGRA, GL_UNSIGNED_BYTE, GL_TRUE,
> sizeof ubytes, ubytes);
> +       size = 0;
> +       glGetVertexAttribiv(1, GL_VERTEX_ATTRIB_ARRAY_SIZE, &size);
> +       if (size != GL_BGRA) {
> +               fprintf(stderr,
> "glGetVertexAttribiv(GL_VERTEX_ATTRIB_ARRAY_SIZE) returned %i, GL_BGRA
> expected\n", size);
> +               pass = false;
> +       }
> +
> +       piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
> +}
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +       /* Should never get here. */
> +       return PIGLIT_FAIL;
> +}
> --
> 2.0.0.rc2
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140601/b0eb1585/attachment-0001.html>


More information about the Piglit mailing list