[Piglit] [PATCH] glut framework: skip if implementation doesn't support required GL version.

Vinson Lee vlee at freedesktop.org
Fri Oct 11 07:21:21 CEST 2013


On Tue, Oct 8, 2013 at 5:12 PM, Paul Berry <stereotype441 at gmail.com> wrote:
> In effect, we are already doing this when Waffle is in use, since
> Waffle uses a context creation mechanism that ensures that the context
> won't be created if the implementation doesn't support the GL version
> needed by the test.  But for GLUT we need to do the check manually,
> since GLUT always just creates the highest GL version context it can.
> ---
>  .../piglit-framework-gl/piglit_glut_framework.c    | 28 ++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>
> diff --git a/tests/util/piglit-framework-gl/piglit_glut_framework.c b/tests/util/piglit-framework-gl/piglit_glut_framework.c
> index a28a177..716f314 100644
> --- a/tests/util/piglit-framework-gl/piglit_glut_framework.c
> +++ b/tests/util/piglit-framework-gl/piglit_glut_framework.c
> @@ -169,6 +169,31 @@ set_reshape_func(struct piglit_gl_framework *gl_fw,
>         glutReshapeFunc(func);
>  }
>
> +/**
> + * Check that the context's actual version is no less than the
> + * requested version.
> + */
> +static bool
> +check_gl_version(const struct piglit_gl_test_config *test_config)
> +{
> +       int actual_version = piglit_get_gl_version();
> +
> +       /* GLUT only supports GL compatibility contexts, so we only
> +        * have to check supports_gl_compat_version.
> +        */
> +       if (actual_version < test_config->supports_gl_compat_version) {
> +               printf("Test requires GL version %d.%d, but actual version is "
> +                      "%d.%d\n",
> +                      test_config->supports_gl_compat_version / 10,
> +                      test_config->supports_gl_compat_version % 10,
> +                      actual_version / 10,
> +                      actual_version % 10);
> +               return false;
> +       }
> +
> +       return true;
> +}
> +
>  struct piglit_gl_framework*
>  piglit_glut_framework_create(const struct piglit_gl_test_config *test_config)
>  {
> @@ -191,6 +216,9 @@ piglit_glut_framework_create(const struct piglit_gl_test_config *test_config)
>
>         init_glut();
>
> +       if (!check_gl_version(test_config))
> +               piglit_report_result(PIGLIT_SKIP);
> +
>         glut_fw.gl_fw.swap_buffers = swap_buffers;
>         glut_fw.gl_fw.run_test = run_test;
>         glut_fw.gl_fw.post_redisplay = post_redisplay;
> --
> 1.8.4
>

Now seeing GLSL 1.50 tests being skipped instead on failing.

Tested-by: Vinson Lee <vlee at freedesktop.org>


More information about the Piglit mailing list