On 22 May 2012 19:43, Anuj Phogat <span dir="ltr">&lt;<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>&gt;</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">
<div class="im">This test varifies that GL_POLYGON_SMOOTH is ignored in case of multisample<br>
polygons.<br>
<br>
</div>Note: This test passes on AMD&#39;s catalyst and NVIDIA drivers.<br>
<br>
V2: Polygon smoothing is applied uniformly to all attached buffers. So, It is<br>
    redundant to test on depth and stencil buffers. Made the changes to remove<br>
    the redundant code.<br></blockquote><div><br>Reviewed-by: Paul Berry &lt;<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>&gt;<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<div class="im"><br>
Signed-off-by: Anuj Phogat &lt;<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>&gt;<br>
---<br>
 tests/all.tests                                    |    6 +<br>
 .../ext_framebuffer_multisample/CMakeLists.gl.txt  |    1 +<br>
</div> .../ext_framebuffer_multisample/polygon-smooth.cpp |  161 ++++++++++++++++++++<br>
 3 files changed, 168 insertions(+), 0 deletions(-)<br>
<div class="im"> create mode 100644 tests/spec/ext_framebuffer_multisample/polygon-smooth.cpp<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
</div>index b8a1e2b..6018627 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -1357,6 +1357,12 @@ for num_samples in (2, 4, 8, 16, 32):<br>
<div class="im">                test_name)<br>
        ext_framebuffer_multisample[test_name] = PlainExecTest(executable)<br>
<br>
+for num_samples in (2, 4, 8, 16, 32):<br>
</div>+       test_name = &#39; &#39; .join([&#39;polygon-smooth&#39;, str(num_samples)])<br>
<div class="im">+       executable = &#39;ext_framebuffer_multisample-{0} -auto&#39;.format(<br>
+               test_name)<br>
+       ext_framebuffer_multisample[test_name] = PlainExecTest(executable)<br>
+<br>
 ext_framebuffer_object = Group()<br>
 spec[&#39;EXT_framebuffer_object&#39;] = ext_framebuffer_object<br>
 add_fbo_stencil_tests(ext_framebuffer_object, &#39;GL_STENCIL_INDEX1&#39;)<br>
diff --git a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
</div>index 9d5bc91..daa4482 100644<br>
<div class="im">--- a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
+++ b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
@@ -22,6 +22,7 @@ piglit_add_executable (ext_framebuffer_multisample-negative-max-samples negative<br>
 piglit_add_executable (ext_framebuffer_multisample-negative-mismatched-samples negative-mismatched-samples.c)<br>
 piglit_add_executable (ext_framebuffer_multisample-negative-readpixels negative-readpixels.c)<br>
 piglit_add_executable (ext_framebuffer_multisample-point-smooth common.cpp point-smooth.cpp)<br>
+piglit_add_executable (ext_framebuffer_multisample-polygon-smooth common.cpp polygon-smooth.cpp)<br>
 piglit_add_executable (ext_framebuffer_multisample-renderbuffer-samples renderbuffer-samples.c)<br>
 piglit_add_executable (ext_framebuffer_multisample-renderbufferstorage-samples renderbufferstorage-samples.c)<br>
 piglit_add_executable (ext_framebuffer_multisample-samples samples.c)<br>
diff --git a/tests/spec/ext_framebuffer_multisample/polygon-smooth.cpp b/tests/spec/ext_framebuffer_multisample/polygon-smooth.cpp<br>
new file mode 100644<br>
</div>index 0000000..dc086a4<br>
--- /dev/null<br>
+++ b/tests/spec/ext_framebuffer_multisample/polygon-smooth.cpp<br>
@@ -0,0 +1,161 @@<br>
<div><div class="h5">+/*<br>
+ * Copyright © 2012 Intel Corporation<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the &quot;Software&quot;),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ */<br>
+<br>
+#include &quot;common.h&quot;<br>
+<br>
+/**<br>
+ * \file polygon-smooth.cpp<br>
+ *<br>
+ * Page 134 (in the PDF) of the OpenGL 3.0 spec says:<br>
+ * &quot;If MULTISAMPLE is enabled, and the value of SAMPLE BUFFERS is one,<br>
+ * then polygons are rasterized using the following algorithm, regardless<br>
+ * of whether polygon antialias-ing (POLYGON_SMOOTH) is enabled or disabled&quot;.<br>
+ *<br>
</div></div>+ * This test operates by drawing a test pattern in to multisample fbo with<br>
+ * GL_POLYGON_SMOOTH disabled. Blits it in to right half of window system<br>
+ * framebuffer. This is used as reference image.<br>
+ *<br>
<div class="im">+ * Draw the same test pattern for the second time in multisample buffer with<br>
</div>+ * GL_POLYGON_SMOOTH enabled. Blit it in to left half of window system<br>
<div class="im">+ * framebuffer. This is the test image.<br>
+ *<br>
+ * To verify that GL_POLYGON_SMOOTH is ignored during MSAA, compare the two<br>
+ * halves of default framebuffer. They are expected to match.<br>
+ */<br>
+<br>
+int piglit_width = 512; int piglit_height = 256;<br>
+int piglit_window_mode =<br>
+       GLUT_DOUBLE | GLUT_RGBA | GLUT_ALPHA | GLUT_DEPTH | GLUT_STENCIL;<br>
+const int pattern_width = 256; const int pattern_height = 256;<br>
+<br>
+Fbo ms_fbo;<br>
+Test *test = NULL;<br>
+GLbitfield buffer_to_test;<br>
+TestPattern *test_pattern = NULL;<br>
</div><div class="im">+<br>
+void<br>
+print_usage_and_exit(char *prog_name)<br>
+{<br>
</div>+       printf(&quot;Usage: %s &lt;num_samples&gt;\n&quot;,<br>
<div class="im">+              prog_name);<br>
+       piglit_report_result(PIGLIT_FAIL);<br>
+}<br>
</div><div class="im">+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+       int num_samples;<br>
</div>+       if (argc &lt; 2)<br>
<div class="im">+               print_usage_and_exit(argv[0]);<br>
+       {<br>
+               char *endptr = NULL;<br>
+               num_samples = strtol(argv[1], &amp;endptr, 0);<br>
+               if (endptr != argv[1] + strlen(argv[1]))<br>
+                       print_usage_and_exit(argv[0]);<br>
+       }<br>
+<br>
+       piglit_require_gl_version(30);<br>
+<br>
</div><div class="im">+       /* Skip the test if num_samples &gt; GL_MAX_SAMPLES */<br>
+       GLint max_samples;<br>
+       glGetIntegerv(GL_MAX_SAMPLES, &amp;max_samples);<br>
+       if (num_samples &gt; max_samples)<br>
+               piglit_report_result(PIGLIT_SKIP);<br>
+<br>
</div>+       buffer_to_test = GL_COLOR_BUFFER_BIT;<br>
<div class="im">+<br>
+       test_pattern = new Triangles();<br>
</div>+       test_pattern-&gt;compile();<br>
<div><div class="h5">+<br>
+       ms_fbo.init(num_samples, pattern_width, pattern_height,<br>
+                    true /* combine_depth_stencil */,<br>
+                    false /* attach_texture */);<br>
+<br>
+       /* Enable blending to test GL_POLYGON_SMOOTH */<br>
+       glEnable (GL_BLEND);<br>
+       glBlendFunc (GL_SRC_ALPHA_SATURATE, GL_ONE);<br>
+}<br>
+<br>
+enum piglit_result<br>
+piglit_display()<br>
+{<br>
+       bool pass = true;<br>
+       float proj[4][4] = {<br>
+               { 1, 0, 0, 0 },<br>
+               { 0, 1, 0, 0 },<br>
+               { 0, 0, 1, 0 },<br>
+               { 0, 0, 0, 1 }<br>
+       };<br>
+<br>
+       /* Draw test pattern in  multisample ms_fbo with GL_POLYGON_SMOOTH<br>
+        * disabled.<br>
+        */<br>
+       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, ms_fbo.handle);<br>
+       ms_fbo.set_viewport();<br>
+       test_pattern-&gt;draw(proj);<br>
+<br>
</div></div>+       /* Blit ms_fbo to the right half of window system framebuffer. This<br>
+        * is a reference image to test MSAA with polygon smooth.<br>
+        */<br>
+       glBindFramebuffer(GL_READ_FRAMEBUFFER, ms_fbo.handle);<br>
<div class="im">+       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);<br>
+       glBlitFramebuffer(0, 0, pattern_width, pattern_height,<br>
+                         pattern_width, 0, 2 * pattern_width, pattern_height,<br>
+                         GL_COLOR_BUFFER_BIT, GL_NEAREST);<br>
+<br>
</div>+       /* Now draw test pattern in mulisample ms_fbo with GL_POLYGON_SMOOTH<br>
<div class="im">+        * enabled<br>
+        */<br>
+       glDisable(GL_DEPTH_TEST);<br>
+       glEnable(GL_POLYGON_SMOOTH);<br>
+       glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);<br>
+<br>
+       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, ms_fbo.handle);<br>
+       ms_fbo.set_viewport();<br>
+<br>
+       glClear(buffer_to_test);<br>
+       test_pattern-&gt;draw(proj);<br>
+<br>
+       glDisable(GL_POLYGON_SMOOTH);<br>
+<br>
</div>+       /* Blit ms_fbo to the left half of window system framebuffer. This<br>
+        * is the test image.<br>
+        */<br>
<div class="im">+       glBindFramebuffer(GL_READ_FRAMEBUFFER, ms_fbo.handle);<br>
+       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);<br>
+       glBlitFramebuffer(0, 0, pattern_width, pattern_height,<br>
+                         0, 0, pattern_width, pattern_height,<br>
+                         GL_COLOR_BUFFER_BIT, GL_NEAREST);<br>
+<br>
</div>+       /* Check that the left and right halves of the screen match. If they<br>
<div class="HOEnZb"><div class="h5">+        * don&#39;t, then GL_POLYGON_SMOOTH is not ignored with multisample<br>
+        * rendering.<br>
+        */<br>
+       glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);<br>
+       pass = piglit_probe_rect_halves_equal_rgba(0, 0, piglit_width,<br>
+                                                  piglit_height) &amp;&amp; pass;<br>
+       pass = piglit_check_gl_error(GL_NO_ERROR) &amp;&amp; pass;<br>
+<br>
+       piglit_present_results();<br>
+       return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
--<br>
1.7.7.6<br>
<br>
</div></div></blockquote></div><br>