On 16 July 2012 15:58, Anuj Phogat <span dir="ltr"><<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Tests the depth buffer only for coverage value equal to 0.0 and 1.0 because<br>
depth buffer behaviour is undefined for intermediate coverage values.<br>
<br>
This test found an issue with the current implemantation of msaa for i965<br>
on mesa. Following patch on mesa makes this test to pass:<br>
[PATCH] i965/msaa: Set KILL_ENABLE when GL_ALPHA_TO_COVERAGE enabled<br>
commit 6c355cca9149e43850cf27f2d0821fab1e7a69f5<br>
<br>
Signed-off-by: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br>
---<br>
 tests/all.tests                                    |    9 ++--<br>
 .../sample-alpha-to-coverage.cpp                   |   47 +++++++++++++------<br>
 2 files changed, 37 insertions(+), 19 deletions(-)<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index 27951bb..9970923 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -1418,10 +1418,11 @@ for num_samples in MSAA_SAMPLE_COUNTS:<br>
                 ext_framebuffer_multisample[test_name] = PlainExecTest(executable)<br>
<br>
 for num_samples in MSAA_SAMPLE_COUNTS:<br>
-        test_name = ' '.join(['sample-alpha-to-coverage', str(num_samples)])<br>
-        executable = 'ext_framebuffer_multisample-{0} -auto'.format(<br>
-                test_name)<br>
-        ext_framebuffer_multisample[test_name] = PlainExecTest(executable)<br>
+        for buffer_type in ('color', 'depth'):<br>
+                test_name = ' '.join(['sample-alpha-to-coverage', str(num_samples), buffer_type])<br>
+                executable = 'ext_framebuffer_multisample-{0} -auto'.format(<br>
+                        test_name)<br>
+                ext_framebuffer_multisample[test_name] = PlainExecTest(executable)<br>
<br>
 for num_samples in MSAA_SAMPLE_COUNTS:<br>
         test_name = ' '.join(['sample-alpha-to-one', str(num_samples)])<br>
diff --git a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp<br>
index b8ccf5d..89c910e 100644<br>
--- a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp<br>
+++ b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp<br>
@@ -47,10 +47,16 @@ PIGLIT_GL_TEST_MAIN(512 /*window_width*/,<br>
                    768 /*window_height*/,<br>
                    GLUT_DOUBLE | GLUT_RGBA | GLUT_ALPHA)<br>
<br>
+static GLenum buffer_to_test;<br>
+<br>
 void<br>
 print_usage_and_exit(char *prog_name)<br>
 {<br>
-        printf("Usage: %s <num_samples>\n", prog_name);<br>
+       printf("Usage: %s <num_samples> <test_type>\n"<br>
+              "  where <test_type> is one of:\n"<br>
+              "    color\n"<br>
+              "    depth\n",<br>
+              prog_name);<br>
        piglit_report_result(PIGLIT_FAIL);<br>
 }<br>
<br>
@@ -58,9 +64,9 @@ void<br>
 piglit_init(int argc, char **argv)<br>
 {<br>
        int samples;<br>
-       int num_attachments = 1;<br>
-<br>
-       if (argc < 2)<br>
+       int num_attachments;<br>
+       piglit_require_gl_version(30);<br>
+       if (argc < 3)<br>
                print_usage_and_exit(argv[0]);<br>
        {<br>
                char *endptr = NULL;<br>
@@ -68,8 +74,16 @@ piglit_init(int argc, char **argv)<br>
                if (endptr != argv[1] + strlen(argv[1]))<br>
                        print_usage_and_exit(argv[0]);<br>
        }<br>
-<br>
-       piglit_require_gl_version(30);<br>
+       if (strcmp(argv[2], "color") == 0) {<br>
+               buffer_to_test = GL_COLOR_BUFFER_BIT;<br>
+               num_attachments = 3;<br>
+       } else if (strcmp(argv[2], "depth") == 0) {<br>
+               buffer_to_test = GL_DEPTH_BUFFER_BIT;<br>
+               num_attachments = 1;<br>
+               glEnable(GL_DEPTH_TEST);<br>
+               glDepthFunc(GL_ALWAYS);<br>
+       } else<br>
+               print_usage_and_exit(argv[0]);<br></blockquote><div><br>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.<br>
<br>Don't we want to use num_attachments = 1 in both cases for this test?<br><br>Other than that this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
 </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
        int pattern_width = piglit_width / 2;<br>
        int pattern_height = piglit_height / num_attachments;<br>
@@ -89,7 +103,7 @@ piglit_init(int argc, char **argv)<br>
                                      pattern_width,<br>
                                      pattern_height,<br>
                                      num_attachments,<br>
-                                     GL_COLOR_BUFFER_BIT,<br>
+                                     buffer_to_test,<br>
                                      GL_RGBA);<br>
        shader_compile();<br>
 }<br>
@@ -103,13 +117,13 @@ piglit_display()<br>
        glClear(GL_COLOR_BUFFER_BIT);<br>
        allocate_data_arrays();<br>
<br>
-       /* Reference image drawn when sample_alpha_to_coverage is enabled,<br>
-        * doesn't represent an expected image. Reference image is drawn only<br>
-        * to visualize the image difference caused by enabling<br>
-        * sample_alpha_to_coverage<br>
+       /* Reference image drawn here doesn't represent an expected image.<br>
+        * Reference image is drawn only to visualize the image difference<br>
+        * caused by enabling sample_alpha_to_coverage in test image.<br>
         */<br>
-       draw_reference_image(true /* sample_alpha_to_coverage */,<br>
-                            false /* sample_alpha_to_one */);<br>
+       if(buffer_to_test == GL_COLOR_BUFFER_BIT)<br>
+               draw_reference_image(true /* sample_alpha_to_coverage */,<br>
+                                    false /* sample_alpha_to_one */);<br>
<br>
        draw_test_image(true /* sample_alpha_to_coverage */,<br>
                        false /* sample_alpha_to_one */);<br>
@@ -123,12 +137,15 @@ piglit_display()<br>
         * of 1 / num_samples makes image compare (test / reference image)<br>
         * unsuitable for this test.<br>
         */<br>
-       pass = probe_framebuffer_color() && pass;<br>
+       if(buffer_to_test == GL_COLOR_BUFFER_BIT)<br>
+               pass = probe_framebuffer_color() && pass;<br>
+       else if (buffer_to_test == GL_DEPTH_BUFFER_BIT)<br>
+               pass = probe_framebuffer_depth() && pass;<br>
<br>
        /* Free the memory allocated for data arrays */<br>
        free_data_arrays();<br>
<br>
-       if (!piglit_automatic)<br>
+       if (!piglit_automatic && buffer_to_test == GL_COLOR_BUFFER_BIT)<br>
                piglit_present_results();<br>
<br>
        return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.7.6<br>
<br>
</font></span></blockquote></div><br>