[Piglit] [PATCH V2] Enable etc2 tests on gl contexts that support GL_ARB_ES3_compatibility extension

Matt Turner mattst88 at gmail.com
Fri Mar 8 15:00:03 PST 2013


On Thu, Mar 7, 2013 at 11:34 AM, Anuj Phogat <anuj.phogat at gmail.com> wrote:
> V2: Enable the test to choose core/compat GL context at run time.
>     Add GL version of test to all.tests.
>     Use VAO to enable the test run on core context.
>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  tests/all.tests                                    | 10 +++-
>  tests/spec/gles-3.0/CMakeLists.gl.txt              |  4 ++
>  tests/spec/gles-3.0/CMakeLists.gles3.txt           |  2 +-
>  .../gles-3.0/oes_compressed_etc2_texture-miptree.c | 66 ++++++++++++++++++----
>  4 files changed, 69 insertions(+), 13 deletions(-)
>  create mode 100644 tests/spec/gles-3.0/CMakeLists.gl.txt
>
> diff --git a/tests/all.tests b/tests/all.tests
> index 1dccd9a..b2acb29 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -2801,7 +2801,7 @@ add_concurrent_test(gles20, 'fbo_discard_gles2')
>  gles30 = Group()
>  spec['!OpenGL ES 3.0'] = gles30
>  for tex_format in ('rgb8', 'srgb8', 'rgba8', 'srgb8-alpha8', 'r11', 'rg11', 'rgb8-punchthrough-alpha1', 'srgb8-punchthrough-alpha1'):
> -       test_name = ' ' .join(['oes_compressed_etc2_texture-miptree', tex_format])
> +       test_name = ' ' .join(['oes_compressed_etc2_texture-miptree_gles3', tex_format])
>         executable = '{0} -auto'.format(test_name)
>         gles30[test_name] = concurrent_test(executable)
>  gles30['minmax'] = concurrent_test('minmax_gles3')
> @@ -2809,6 +2809,14 @@ for test_mode in ['teximage', 'texsubimage']:
>          test_name = 'ext_texture_array-compressed_gles3 {0}'.format(test_mode)
>          gles30[test_name] = PlainExecTest(test_name + ' -auto -fbo')
>
> +arb_es3_compatibility = Group()
> +spec['ARB_ES3_compatibility'] = arb_es3_compatibility
> +for tex_format in ('rgb8', 'srgb8', 'rgba8', 'srgb8-alpha8', 'r11', 'rg11', 'rgb8-punchthrough-alpha1', 'srgb8-punchthrough-alpha1'):
> +       for context in ('core', 'compat'):
> +               test_name = ' ' .join(['oes_compressed_etc2_texture-miptree', tex_format, context])
> +               executable = '{0}'.format(test_name)
> +               arb_es3_compatibility[test_name] = concurrent_test(executable)
> +
>  add_shader_test_dir(spec, os.path.join(generatedTestDir, 'spec'),
>                     recursive=True)
>  import_glsl_parser_tests(profile.tests, generatedTestDir, ['spec'])
> diff --git a/tests/spec/gles-3.0/CMakeLists.gl.txt b/tests/spec/gles-3.0/CMakeLists.gl.txt
> new file mode 100644
> index 0000000..8bf0614
> --- /dev/null
> +++ b/tests/spec/gles-3.0/CMakeLists.gl.txt
> @@ -0,0 +1,4 @@
> +link_libraries (
> +       piglitutil_${piglit_target_api}
> +)
> +piglit_add_executable(oes_compressed_etc2_texture-miptree oes_compressed_etc2_texture-miptree.c)
> diff --git a/tests/spec/gles-3.0/CMakeLists.gles3.txt b/tests/spec/gles-3.0/CMakeLists.gles3.txt
> index d02e8c6..13cef0c 100644
> --- a/tests/spec/gles-3.0/CMakeLists.gles3.txt
> +++ b/tests/spec/gles-3.0/CMakeLists.gles3.txt
> @@ -3,6 +3,6 @@ link_libraries(
>         )
>
>  piglit_add_executable(minmax_${piglit_target_api} minmax.c)
> -piglit_add_executable(oes_compressed_etc2_texture-miptree oes_compressed_etc2_texture-miptree.c)
> +piglit_add_executable(oes_compressed_etc2_texture-miptree_gles3 oes_compressed_etc2_texture-miptree.c)
>
>  # vim: ft=cmake:
> diff --git a/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c b/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c
> index fceafab..0e29fd1 100644
> --- a/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c
> +++ b/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c
> @@ -54,13 +54,6 @@ static const int num_vertices = 4;
>  static const int window_width = 128;
>  static const int window_height = 64;
>
> -PIGLIT_GL_TEST_CONFIG_BEGIN
> -       config.supports_gl_es_version = 30;
> -       config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
> -
> -PIGLIT_GL_TEST_CONFIG_END
> -
> -
>  static GLuint prog;
>
>  /* Texture objects. */
> @@ -108,7 +101,7 @@ load_texture(const char *filename, GLuint *tex_name)
>  void
>  print_usage_and_exit(char *prog_name)
>  {
> -        printf("Usage: %s <format>\n"
> +        printf("Usage: %s <format> %s\n"
>                 "  where <format> is one of:\n"
>                "    rgb8\n"
>                "    srgb8\n"
> @@ -117,7 +110,14 @@ print_usage_and_exit(char *prog_name)
>                "    r11\n"
>                "    rg11\n"
>                "    rgb8-punchthrough-alpha1\n"
> -              "    srgb8-punchthrough-alpha1\n", prog_name);
> +              "    srgb8-punchthrough-alpha1\n"
> +#if defined(PIGLIT_USE_OPENGL)
> +              "  <profile> is one of:\n"
> +              "    compat\n"
> +              "    core\n", prog_name, "<profile>");
> +#elif defined(PIGLIT_USE_OPENGL_ES3)
> +              ,prog_name, "");
> +#endif
>         piglit_report_result(PIGLIT_FAIL);
>  }
>
> @@ -173,9 +173,10 @@ piglit_init(int argc, char **argv)
>
>         GLint vertex_loc;
>         GLuint vertex_buf;
> +       GLuint vao;
>
> -       if (argc < 2)
> -               print_usage_and_exit(argv[0]);
> +       if (!piglit_is_gles())
> +               piglit_require_extension("GL_ARB_ES3_compatibility");
>
>         if (strcmp(argv[1], "rgb8") == 0) {
>                 compressed_filename =
> @@ -245,6 +246,8 @@ piglit_init(int argc, char **argv)
>         glUseProgram(prog);
>
>         vertex_loc = glGetAttribLocation(prog, "vertex");
> +       glGenVertexArrays(1, &vao);
> +       glBindVertexArray(vao);
>         glGenBuffers(1, &vertex_buf);
>         glBindBuffer(GL_ARRAY_BUFFER, vertex_buf);
>         glEnableVertexAttribArray(vertex_loc);
> @@ -309,3 +312,44 @@ piglit_display(void)
>
>         return pass ? PIGLIT_PASS : PIGLIT_FAIL;
>  }
> +
> +int
> +main(int argc, char *argv[])
> +{
> +       struct piglit_gl_test_config config;
> +       bool test_compat = true;
> +
> +#if defined(PIGLIT_USE_OPENGL)
> +       if (argc < 3)
> +               print_usage_and_exit(argv[0]);
> +
> +       test_compat = strcmp(argv[2], "compat") == 0;
> +
> +       if (!test_compat && strcmp(argv[2], "core") != 0)
> +               print_usage_and_exit(argv[0]);
> +
> +#elif defined(PIGLIT_USE_OPENGL_ES3)
> +       if (argc < 2)
> +               print_usage_and_exit(argv[0]);
> +#endif
> +
> +       piglit_gl_test_config_init(&config);
> +       config.init = piglit_init;
> +       config.display = piglit_display;
> +
> +       if (test_compat)
> +               config.supports_gl_compat_version = 10;
> +       else
> +               config.supports_gl_core_version = 31;
> +
> +       config.supports_gl_es_version = 30;
> +
> +       config.window_width = 150;
> +       config.window_height = 150;
> +       config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_ALPHA;
> +
> +       piglit_gl_test_run(argc, argv, &config);
> +
> +       assert(false);
> +       return 0;
> +}
> --
> 1.7.11.7

Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the Piglit mailing list