[Piglit] [PATCH 12/12] msaa: Add depth buffer testing to sample-alpha-to-coverage test case

Paul Berry stereotype441 at gmail.com
Tue Jul 17 12:15:19 PDT 2012


On 16 July 2012 15:58, Anuj Phogat <anuj.phogat at gmail.com> wrote:

> Tests the depth buffer only for coverage value equal to 0.0 and 1.0 because
> depth buffer behaviour is undefined for intermediate coverage values.
>
> This test found an issue with the current implemantation of msaa for i965
> on mesa. Following patch on mesa makes this test to pass:
> [PATCH] i965/msaa: Set KILL_ENABLE when GL_ALPHA_TO_COVERAGE enabled
> commit 6c355cca9149e43850cf27f2d0821fab1e7a69f5
>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  tests/all.tests                                    |    9 ++--
>  .../sample-alpha-to-coverage.cpp                   |   47
> +++++++++++++------
>  2 files changed, 37 insertions(+), 19 deletions(-)
>
> diff --git a/tests/all.tests b/tests/all.tests
> index 27951bb..9970923 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1418,10 +1418,11 @@ for num_samples in MSAA_SAMPLE_COUNTS:
>                  ext_framebuffer_multisample[test_name] =
> PlainExecTest(executable)
>
>  for num_samples in MSAA_SAMPLE_COUNTS:
> -        test_name = ' '.join(['sample-alpha-to-coverage',
> str(num_samples)])
> -        executable = 'ext_framebuffer_multisample-{0} -auto'.format(
> -                test_name)
> -        ext_framebuffer_multisample[test_name] = PlainExecTest(executable)
> +        for buffer_type in ('color', 'depth'):
> +                test_name = ' '.join(['sample-alpha-to-coverage',
> str(num_samples), buffer_type])
> +                executable = 'ext_framebuffer_multisample-{0}
> -auto'.format(
> +                        test_name)
> +                ext_framebuffer_multisample[test_name] =
> PlainExecTest(executable)
>
>  for num_samples in MSAA_SAMPLE_COUNTS:
>          test_name = ' '.join(['sample-alpha-to-one', str(num_samples)])
> diff --git
> a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
> b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
> index b8ccf5d..89c910e 100644
> --- a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
> +++ b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
> @@ -47,10 +47,16 @@ PIGLIT_GL_TEST_MAIN(512 /*window_width*/,
>                     768 /*window_height*/,
>                     GLUT_DOUBLE | GLUT_RGBA | GLUT_ALPHA)
>
> +static GLenum buffer_to_test;
> +
>  void
>  print_usage_and_exit(char *prog_name)
>  {
> -        printf("Usage: %s <num_samples>\n", prog_name);
> +       printf("Usage: %s <num_samples> <test_type>\n"
> +              "  where <test_type> is one of:\n"
> +              "    color\n"
> +              "    depth\n",
> +              prog_name);
>         piglit_report_result(PIGLIT_FAIL);
>  }
>
> @@ -58,9 +64,9 @@ void
>  piglit_init(int argc, char **argv)
>  {
>         int samples;
> -       int num_attachments = 1;
> -
> -       if (argc < 2)
> +       int num_attachments;
> +       piglit_require_gl_version(30);
> +       if (argc < 3)
>                 print_usage_and_exit(argv[0]);
>         {
>                 char *endptr = NULL;
> @@ -68,8 +74,16 @@ piglit_init(int argc, char **argv)
>                 if (endptr != argv[1] + strlen(argv[1]))
>                         print_usage_and_exit(argv[0]);
>         }
> -
> -       piglit_require_gl_version(30);
> +       if (strcmp(argv[2], "color") == 0) {
> +               buffer_to_test = GL_COLOR_BUFFER_BIT;
> +               num_attachments = 3;
> +       } else if (strcmp(argv[2], "depth") == 0) {
> +               buffer_to_test = GL_DEPTH_BUFFER_BIT;
> +               num_attachments = 1;
> +               glEnable(GL_DEPTH_TEST);
> +               glDepthFunc(GL_ALWAYS);
> +       } else
> +               print_usage_and_exit(argv[0]);
>

I'm confused.  Before this patch, it looks like the test only tested color
buffers and always used num_attachments = 1.  After this patch, it uses
num_attachments = 3 when testing color and num_attachments = 1 when testing
depth.

Don't we want to use num_attachments = 1 in both cases for this test?

Other than that this patch is:

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


>
>         int pattern_width = piglit_width / 2;
>         int pattern_height = piglit_height / num_attachments;
> @@ -89,7 +103,7 @@ piglit_init(int argc, char **argv)
>                                       pattern_width,
>                                       pattern_height,
>                                       num_attachments,
> -                                     GL_COLOR_BUFFER_BIT,
> +                                     buffer_to_test,
>                                       GL_RGBA);
>         shader_compile();
>  }
> @@ -103,13 +117,13 @@ piglit_display()
>         glClear(GL_COLOR_BUFFER_BIT);
>         allocate_data_arrays();
>
> -       /* Reference image drawn when sample_alpha_to_coverage is enabled,
> -        * doesn't represent an expected image. Reference image is drawn
> only
> -        * to visualize the image difference caused by enabling
> -        * sample_alpha_to_coverage
> +       /* Reference image drawn here doesn't represent an expected image.
> +        * Reference image is drawn only to visualize the image difference
> +        * caused by enabling sample_alpha_to_coverage in test image.
>          */
> -       draw_reference_image(true /* sample_alpha_to_coverage */,
> -                            false /* sample_alpha_to_one */);
> +       if(buffer_to_test == GL_COLOR_BUFFER_BIT)
> +               draw_reference_image(true /* sample_alpha_to_coverage */,
> +                                    false /* sample_alpha_to_one */);
>
>         draw_test_image(true /* sample_alpha_to_coverage */,
>                         false /* sample_alpha_to_one */);
> @@ -123,12 +137,15 @@ piglit_display()
>          * of 1 / num_samples makes image compare (test / reference image)
>          * unsuitable for this test.
>          */
> -       pass = probe_framebuffer_color() && pass;
> +       if(buffer_to_test == GL_COLOR_BUFFER_BIT)
> +               pass = probe_framebuffer_color() && pass;
> +       else if (buffer_to_test == GL_DEPTH_BUFFER_BIT)
> +               pass = probe_framebuffer_depth() && pass;
>
>         /* Free the memory allocated for data arrays */
>         free_data_arrays();
>
> -       if (!piglit_automatic)
> +       if (!piglit_automatic && buffer_to_test == GL_COLOR_BUFFER_BIT)
>                 piglit_present_results();
>
>         return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> --
> 1.7.7.6
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20120717/293e163c/attachment.html>


More information about the Piglit mailing list