On 18 May 2012 16:56, 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">
This test varifies that GL_POINT_SMOOTH is ignored in case of multisample<br>
points.<br>
<br>
Note: This test passes on AMD&#39;s catalyst drivers.<br></blockquote><div><br>This passes on my nVidia system too.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<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                                    |    7 +<br>
 .../ext_framebuffer_multisample/CMakeLists.gl.txt  |    1 +<br>
 .../ext_framebuffer_multisample/point-smooth.cpp   |  190 ++++++++++++++++++++<br>
 3 files changed, 198 insertions(+), 0 deletions(-)<br>
 create mode 100644 tests/spec/ext_framebuffer_multisample/point-smooth.cpp<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index 0332051..0540b9c 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -1343,6 +1343,13 @@ for num_samples in (2, 4, 8, 16, 32):<br>
                         test_name)<br>
                 ext_framebuffer_multisample[test_name] = PlainExecTest(executable)<br>
<br>
+for num_samples in (2, 4, 8, 16, 32):<br>
+        for buffer_type in (&#39;color&#39;, &#39;depth&#39;, &#39;stencil&#39;):<br>
+                test_name = &#39; &#39; .join([&#39;point-smooth&#39;, str(num_samples), buffer_type])<br>
+                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>
index 42be35b..6ced83b 100644<br>
--- a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
+++ b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
@@ -21,6 +21,7 @@ piglit_add_executable (ext_framebuffer_multisample-negative-copyteximage negativ<br>
 piglit_add_executable (ext_framebuffer_multisample-negative-max-samples negative-max-samples.c)<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-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/point-smooth.cpp b/tests/spec/ext_framebuffer_multisample/point-smooth.cpp<br>
new file mode 100644<br>
index 0000000..fede98d<br>
--- /dev/null<br>
+++ b/tests/spec/ext_framebuffer_multisample/point-smooth.cpp<br>
@@ -0,0 +1,190 @@<br>
+/*<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 point-smooth.cpp<br>
+ *<br>
+ * Page 122 (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 points are rasterized using the following algorithm, regardless<br>
+ * of whether point antialias-ing (POINT SMOOTH) is enabled or disabled&quot;.<br>
+ *<br>
+ * This test operates by drawing a test image with GL_POINT_SMOOTH<br>
+ * enabled in an MSAA buffer. Blit it in to left half of window system<br>
+ * framebuffer.<br>
+ *<br>
+ * Draw same image second time with GL_POINT_SMOOTH disabled. Blit it<br>
+ * in to right half of window system framebuffer. This is the reference<br>
+ * image.<br>
+ *<br>
+ * To verify that GL_POINT_SMOOTH doesn&#39;t affect MSAA, compare the two<br>
+ * halves of default framebuffer. There should be no difference.<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>
+<br>
+const int pattern_width = 256; const int pattern_height = 256;<br>
+<br>
+Fbo test_fbo;<br>
+TestPattern *test_pattern = NULL;<br>
+ManifestProgram *manifest_program = NULL;<br>
+GLbitfield buffer_to_test;<br>
+<br>
+void<br>
+print_usage_and_exit(char *prog_name)<br>
+{<br>
+       printf(&quot;Usage: %s &lt;num_samples&gt; &lt;buffer_type&gt;\n&quot;<br>
+              &quot;  where &lt;buffer_type&gt; is one of:\n&quot;<br>
+              &quot;    color\n&quot;<br>
+              &quot;    stencil\n&quot;<br>
+              &quot;    depth\n&quot;,<br>
+              prog_name);<br>
+       piglit_report_result(PIGLIT_FAIL);<br>
+}<br></blockquote><div><br>As with the previous patch, I&#39;m not seeing the benefit of testing stencil and depth in addition to color.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+       int num_samples;<br>
+       if (argc &lt; 3)<br>
+               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>
+       piglit_require_GLSL_version(130);<br>
+<br>
+       glClear (GL_COLOR_BUFFER_BIT);<br>
+<br>
+       /* 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>
+       if (strcmp(argv[2], &quot;color&quot;) == 0) {<br>
+               test_pattern = new Points();<br>
+               buffer_to_test = GL_COLOR_BUFFER_BIT;<br>
+       } else if (strcmp(argv[2], &quot;depth&quot;) == 0) {<br>
+               test_pattern = new DepthSpiral();<br>
+               manifest_program = new ManifestDepth();<br>
+               buffer_to_test = GL_DEPTH_BUFFER_BIT;<br>
+       } else if (strcmp(argv[2], &quot;stencil&quot;) == 0) {<br>
+               test_pattern = new StencilSpiral();<br>
+               manifest_program = new ManifestStencil();<br>
+               buffer_to_test = GL_STENCIL_BUFFER_BIT;<br>
+       } else {<br>
+               print_usage_and_exit(argv[0]);<br>
+       }<br>
+<br>
+       test_pattern-&gt;compile();<br>
+       if (manifest_program)<br>
+               manifest_program-&gt;compile();<br>
+<br>
+       test_fbo.init(num_samples, pattern_width, pattern_height,<br>
+                    true /* combine_depth_stencil */,<br>
+                    false /* attach_texture */);<br>
+<br>
+       /* Blending is required to test smooth points */<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>
+       /* Draw test pattern in  multisample test_fbo with GL_POINT_SMOOTH<br>
+        * disabled.<br>
+        */<br>
+       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, test_fbo.handle);<br>
+       glClear(buffer_to_test);<br>
+       test_fbo.set_viewport();<br>
+       test_pattern-&gt;draw(proj);<br>
+<br>
+       /* Blit test_fbo to the right half of window system framebuffer.<br>
+        * This is the reference image.<br>
+        */<br>
+       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, test_fbo.handle);<br>
+       test_fbo.set_viewport();<br>
+       if (manifest_program)<br>
+               manifest_program-&gt;run();<br>
+       glBindFramebuffer(GL_READ_FRAMEBUFFER, test_fbo.handle);<br>
+       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>
+       /* Draw test pattern in mulisample test_fbo with GL_POINT_SMOOTH<br>
+        * enabled<br>
+        */<br>
+       glEnable (GL_POINT_SMOOTH);<br>
+       glHint( GL_POINT_SMOOTH_HINT, GL_NICEST );<br>
+       glDisable (GL_DEPTH_TEST);<br>
+<br>
+       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, test_fbo.handle);<br>
+       test_fbo.set_viewport();<br>
+       test_pattern-&gt;draw(proj);<br>
+<br>
+       glDisable(GL_POINT_SMOOTH);<br>
+<br>
+       /* Now blit test_fbo to the left half of window system framebuffer.<br>
+        * This is the test image.<br>
+        */<br>
+       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, test_fbo.handle);<br>
+       test_fbo.set_viewport();<br>
+       if (manifest_program)<br>
+               manifest_program-&gt;run();<br>
+       glBindFramebuffer(GL_READ_FRAMEBUFFER, test_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>
+       /* Check that the left and right halves of the screen match. If they<br>
+        * don&#39;t, then GL_POINT_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>
+<br>
+       pass = piglit_check_gl_error(GL_NO_ERROR) &amp;&amp; pass;<br>
+<br>
+       piglit_present_results();<br>
+<br>
+       return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.7.6<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br>