[Piglit] [PATCH v2 13/16] squash! shader_runner: add ability to run multiple tests per process

Marek Olšák maraeo at gmail.com
Thu Oct 6 13:57:31 UTC 2016


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Fri, Sep 30, 2016 at 11:17 PM, Dylan Baker <dylan at pnwbakers.com> wrote:
> These are changes since version 1, again split out for easier review.
>
>  - use glClearDepthf for GL ES instead of glClearDepth, which doesn't
>    exist in GLES
>  - Never attempt to disable GL_PROGRAM_POINT_SIZE in OpenGL ES (which
>    causes failures, and I can't seem to find any evidence of it's
>    existence in ES)
>  - Don't call glMatrixMode in GLES (which I also can't find references
>    to in the spec).
>  - disable clip panes based on GL_MAX_CLIP_PLANES, rather than assuming
>    the number of planes. This fixes tests on i965/gen4 hardware
>  - Fix patching of tessellation shaders for ES 3.2 and with
>    OES_tessellation_shader
>  - Move check for argc < 2 before OpenGL calls
>  - Set num_uniform_blocks to 0 when tearing down UBOs
> ---
>
> This patch in new in v2
>
>  tests/shaders/shader_runner.c | 66 +++++++++++++++++++++---------------
>  1 file changed, 40 insertions(+), 26 deletions(-)
>
> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> index 50bda7c..6323c64 100644
> --- a/tests/shaders/shader_runner.c
> +++ b/tests/shaders/shader_runner.c
> @@ -2806,6 +2806,7 @@ teardown_ubos(void)
>         glDeleteBuffers(num_uniform_blocks, uniform_block_bos);
>         free(uniform_block_bos);
>         uniform_block_bos = NULL;
> +       num_uniform_blocks = 0;
>  }
>
>  static enum piglit_result
> @@ -3589,6 +3590,10 @@ piglit_init(int argc, char **argv)
>         float default_piglit_tolerance[4];
>
>         report_subtests = piglit_strip_arg(&argc, argv, "-report-subtests");
> +       if (argc < 2) {
> +               printf("usage: shader_runner <test.shader_test>\n");
> +               exit(1);
> +       }
>
>         memcpy(default_piglit_tolerance, piglit_tolerance,
>                sizeof(piglit_tolerance));
> @@ -3621,7 +3626,6 @@ piglit_init(int argc, char **argv)
>             piglit_is_extension_supported("GL_EXT_geometry_shader4"))
>                 glGetIntegerv(GL_MAX_VARYING_COMPONENTS,
>                               &gl_max_varying_components);
> -       glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max_clip_planes);
>  #else
>         glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS,
>                       &gl_max_fragment_uniform_components);
> @@ -3632,8 +3636,9 @@ piglit_init(int argc, char **argv)
>         gl_max_fragment_uniform_components *= 4;
>         gl_max_vertex_uniform_components *= 4;
>         gl_max_varying_components *= 4;
> -       gl_max_clip_planes = 0;
>  #endif
> +       glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max_clip_planes);
> +
>         if (gl_version.num >= 20 ||
>             piglit_is_extension_supported("GL_ARB_vertex_shader"))
>                 glGetIntegerv(GL_MAX_VERTEX_ATTRIBS,
> @@ -3641,16 +3646,11 @@ piglit_init(int argc, char **argv)
>         else
>                 gl_max_vertex_attribs = 16;
>
> -       if (argc < 2) {
> -               printf("usage: shader_runner <test.shader_test>\n");
> -               exit(1);
> -       }
> -
>         render_width = piglit_width;
>         render_height = piglit_height;
>
>         /* Automatic mode can run multiple tests per session. */
> -       if (piglit_automatic) {
> +       if (report_subtests) {
>                 char testname[4096], *ext;
>                 int i, j;
>
> @@ -3705,33 +3705,29 @@ piglit_init(int argc, char **argv)
>
>                         /* Clear GL states to defaults. */
>                         glClearColor(0, 0, 0, 0);
> +# if PIGLIT_USE_OPENGL
>                         glClearDepth(1);
> +# else
> +                       glClearDepthf(1.0);
> +# endif
>                         glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
>                         glActiveTexture(GL_TEXTURE0);
>                         glUseProgram(0);
>                         glDisable(GL_DEPTH_TEST);
>                         glBindBuffer(GL_ARRAY_BUFFER, 0);
> -                       glDisable(GL_CLIP_PLANE0);
> -                       glDisable(GL_CLIP_PLANE1);
> -                       glDisable(GL_CLIP_PLANE2);
> -                       glDisable(GL_CLIP_PLANE3);
> -                       glDisable(GL_CLIP_PLANE4);
> -                       glDisable(GL_CLIP_PLANE5);
> -                       if (es || gl_version.num >= 30) {
> -                               glDisable(GL_CLIP_PLANE0+6);
> -                               glDisable(GL_CLIP_PLANE0+7);
> +
> +                       for (int k = 0; k < gl_max_clip_planes; k++) {
> +                               glDisable(GL_CLIP_PLANE0 + k);
>                         }
>
> -                       if (es)
> -                               glEnable(GL_PROGRAM_POINT_SIZE);
> -                       else if (gl_version.num >= 20 ||
> -                                piglit_is_extension_supported("GL_ARB_vertex_program"))
> +                       if (!(es) && (gl_version.num >= 20 ||
> +                            piglit_is_extension_supported("GL_ARB_vertex_program")))
>                                 glDisable(GL_PROGRAM_POINT_SIZE);
>
>                         for (int i = 0; i < 16; i++)
>                                 glDisableVertexAttribArray(i);
>
> -                       if (!piglit_is_core_profile) {
> +                       if (!piglit_is_core_profile && !es) {
>                                 glMatrixMode(GL_PROJECTION);
>                                 glLoadIdentity();
>                                 glMatrixMode(GL_MODELVIEW);
> @@ -3757,15 +3753,33 @@ piglit_init(int argc, char **argv)
>                         if (piglit_is_extension_supported("GL_EXT_provoking_vertex"))
>                                 glProvokingVertexEXT(GL_LAST_VERTEX_CONVENTION_EXT);
>
> -                       if (gl_version.num >= (gl_version.es ? 32 : 40) ||
> -                           piglit_is_extension_supported(gl_version.es ?
> -                                                         "GL_OES_tessellation_shader" :
> -                                                         "GL_ARB_tessellation_shader")) {
> +# if PIGLIT_USE_OPENGL
> +                       if (gl_version.num >= 40 ||
> +                           piglit_is_extension_supported("GL_ARB_tessellation_shader")) {
>                                 static float ones[] = {1, 1, 1, 1};
>                                 glPatchParameteri(GL_PATCH_VERTICES, 3);
>                                 glPatchParameterfv(GL_PATCH_DEFAULT_OUTER_LEVEL, ones);
>                                 glPatchParameterfv(GL_PATCH_DEFAULT_INNER_LEVEL, ones);
>                         }
> +# else
> +                       /* Ideally one would use the following code:
> +                        *
> +                        * if (gl_version.num >= 32) {
> +                        *         glPatchParameteri(GL_PATCH_VERTICES, 3);
> +                        * }
> +                        *
> +                        * however, that doesn't work with mesa because those
> +                        * symbols apparently need to be exported, but that
> +                        * breaks non-gles builds.
> +                        *
> +                        * It seems rather unlikely that an implementation
> +                        * would have GLES 3.2 support but not
> +                        * OES_tessellation_shader.
> +                        */
> +                       if (piglit_is_extension_supported("GL_OES_tessellation_shader")) {
> +                               glPatchParameteriOES(GL_PATCH_VERTICES_OES, 3);
> +                       }
> +# endif
>
>                         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
>
> --
> git-series 0.8.10
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list