[Piglit] [PATCH 09/11] arb_get_program_binary: Execercise GL_PROGRAM_BINARY_RETRIEVABLE_HINT

Paul Berry stereotype441 at gmail.com
Fri Oct 4 11:47:34 PDT 2013


On 21 August 2013 09:08, Ian Romanick <idr at freedesktop.org> wrote:

> From: Ian Romanick <ian.d.romanick at intel.com>
>
> This test fails on NVIDIA (304.64 on GTX 260).  It fails because the
> value of GL_PROGRAM_BINARY_RETRIEVABLE_HINT is not "latched" by
> glLinkProgram.  The spec is a little unclear on this topic, and I filed
> a bug in the Khronos bugzilla.  After some discussion about which state
> should be latches vs. live, the concensus was that
>
GL_PROGRAM_BINARY_RETRIEVABLE_HINT.


s/concensus/consensus/.  Also this sentence kind of trails off.  I assume
you mean "the consensuse was that GL_PROGRAM_BINARY_RETRIEVABLE_HINT should
be latched by gl_LinkProgram."

With that fixed, the patch is:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>



>  Updated language has been proposed,
> but a new spec has not been spun.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: James Jones <jajones at nvidia.com>
> ---
>  tests/all.tests                                    |   1 +
>  .../spec/arb_get_program_binary/CMakeLists.gl.txt  |   1 +
>  .../spec/arb_get_program_binary/retrievable_hint.c | 143
> +++++++++++++++++++++
>  3 files changed, 145 insertions(+)
>  create mode 100644 tests/spec/arb_get_program_binary/retrievable_hint.c
>
> diff --git a/tests/all.tests b/tests/all.tests
> index fa3812f..35e1002 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1038,6 +1038,7 @@ arb_es2_compatibility['NUM_SHADER_BINARY_FORMATS
> over-run check'] = concurrent_t
>  arb_get_program_binary = Group()
>  spec['ARB_get_program_binary'] = arb_get_program_binary
>  arb_get_program_binary['NUM_PROGRAM_BINARY_FORMATS over-run check'] =
> concurrent_test('arb_get_program_binary-overrun program')
> +arb_get_program_binary['PROGRAM_BINARY_RETRIEVABLE_HINT'] =
> concurrent_test('arb_get_program_binary-retrievable_hint')
>
>  arb_depth_clamp = Group()
>  spec['ARB_depth_clamp'] = arb_depth_clamp
> diff --git a/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
> b/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
> index be52044..caaa617 100644
> --- a/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
> +++ b/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
> @@ -10,5 +10,6 @@ link_libraries (
>  )
>
>  piglit_add_executable (arb_get_program_binary-overrun overrun.c)
> +piglit_add_executable (arb_get_program_binary-retrievable_hint
> retrievable_hint.c)
>
>  # vim: ft=cmake:
> diff --git a/tests/spec/arb_get_program_binary/retrievable_hint.c
> b/tests/spec/arb_get_program_binary/retrievable_hint.c
> new file mode 100644
> index 0000000..7c5f316
> --- /dev/null
> +++ b/tests/spec/arb_get_program_binary/retrievable_hint.c
> @@ -0,0 +1,143 @@
> +/*
> + * Copyright © 2012 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 coverage.c
> + * Attempt quering every enum in the spec.  Sanity check initial values.
> + *
> + * GL_NUM_PROGRAM_BINARY_FORMATS and GL_PROGRAM_BINARY_FORMATS are not
> + * covered by this test because they are heavily covered by the
> + * overrun test.
> + */
> +
> +#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_TEST_CONFIG_END
> +
> +static const char *vs_text =
> +       "#version 110\n"
> +       "void main() { gl_Position = vec4(0.); }"
> +       ;
> +
> +static const char *fs_text =
> +       "#version 110\n"
> +       "void main() { gl_FragColor = vec4(0.); }"
> +       ;
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +       return PIGLIT_FAIL;
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +       GLuint vs;
> +       GLuint fs;
> +       GLuint prog;
> +       GLint value;
> +       bool pass = true;
> +       bool got_error;
> +
> +       piglit_require_gl_version(20);
> +       piglit_require_extension("GL_ARB_get_program_binary");
> +
> +       vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
> +       fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
> +
> +       prog = piglit_link_simple_program(vs, fs);
> +
> +       /* Check the initial state of GL_PROGRAM_BINARY_RETRIEVABLE_HINT.
>  The
> +        * state table in the extension spec says the initial state is
> +        * GL_FALSE.
> +        */
> +       value = 0xDEADBEEF;
> +       glGetProgramiv(prog, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, &value);
> +       got_error = piglit_check_gl_error(0);
> +
> +       if (!got_error) {
> +               if (value == 0xDEADBEEF) {
> +                       fprintf(stderr,
> +                               "No error generated for "
> +                               "GL_PROGRAM_BINARY_RETRIEVABLE_HINT, but "
> +                               "no value was written either.\n");
> +                       pass = false;
> +               } else if (value != 0) {
> +                       fprintf(stderr,
> +                               "Initial state of "
> +                               "GL_PROGRAM_BINARY_RETRIEVABLE_HINT "
> +                               "was %d instead of 0.\n",
> +                               value);
> +                       pass = false;
> +               }
> +       } else
> +               pass = false;
> +
> +       /* The ARB_get_program_binary spec says:
> +        *
> +        *     "This hint will not take effect until the next time
> LinkProgram
> +        *     or ProgramBinary has been called successfully."
> +        *
> +        * The GL spec contains similar language for attribute locations
> and
> +        * fragment data locations.  In those cases, the queried value is
> only
> +        * updated after relinking.  We'll assume this text means the same
> +        * thing.
> +        */
> +
> +       glProgramParameteri(prog, GL_PROGRAM_BINARY_RETRIEVABLE_HINT,
> GL_TRUE);
> +       got_error = piglit_check_gl_error(0);
> +
> +       glGetProgramiv(prog, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, &value);
> +       got_error = piglit_check_gl_error(0);
> +
> +       if (value != 0) {
> +               fprintf(stderr,
> +                       "State of GL_PROGRAM_BINARY_RETRIEVABLE_HINT "
> +                       "changed without relinking.\n");
> +               pass = false;
> +       }
> +
> +       glLinkProgram(prog);
> +       got_error = piglit_check_gl_error(0);
> +
> +       glGetProgramiv(prog, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, &value);
> +       got_error = piglit_check_gl_error(0);
> +
> +       if (value != GL_TRUE) {
> +               fprintf(stderr,
> +                       "State of GL_PROGRAM_BINARY_RETRIEVABLE_HINT "
> +                       "did not change across relinking.\n");
> +               pass = false;
> +       }
> +
> +       glDeleteShader(vs);
> +       glDeleteShader(fs);
> +       glDeleteProgram(prog);
> +       piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
> +}
> --
> 1.8.1.4
>
> _______________________________________________
> 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/20131004/45552997/attachment-0001.html>


More information about the Piglit mailing list