On 22 May 2012 19:42, 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">
<div class="im">This test varifies that GL_POINT_SMOOTH is ignored in case of multisample<br>
points.<br>
<br>
</div>Note: This test passes on AMD and NVIDIA drivers.<br>
<br>
V2: Point smoothing is applied uniformly to all attached buffers. So, It is<br>
redundant to test on depth and stencil buffers.<br></blockquote><div><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><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 <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br>
---<br>
tests/all.tests | 6 +<br>
.../ext_framebuffer_multisample/CMakeLists.gl.txt | 1 +<br>
</div> .../ext_framebuffer_multisample/point-smooth.cpp | 160 ++++++++++++++++++++<br>
3 files changed, 167 insertions(+), 0 deletions(-)<br>
<div class="im"> create mode 100644 tests/spec/ext_framebuffer_multisample/point-smooth.cpp<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
</div>index 710da95..b8a1e2b 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -1351,6 +1351,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 = ' ' .join(['point-smooth', str(num_samples)])<br>
<div class="im">+ executable = 'ext_framebuffer_multisample-{0} -auto'.format(<br>
+ test_name)<br>
+ ext_framebuffer_multisample[test_name] = PlainExecTest(executable)<br>
+<br>
ext_framebuffer_object = Group()<br>
spec['EXT_framebuffer_object'] = ext_framebuffer_object<br>
add_fbo_stencil_tests(ext_framebuffer_object, 'GL_STENCIL_INDEX1')<br>
diff --git a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
</div>index fdb6a7a..9d5bc91 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>
@@ -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>
</div>index 0000000..2fe4953<br>
--- /dev/null<br>
+++ b/tests/spec/ext_framebuffer_multisample/point-smooth.cpp<br>
@@ -0,0 +1,160 @@<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 "Software"),<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 "AS IS", 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 "common.h"<br>
+<br>
+/**<br>
+ * \file point-smooth.cpp<br>
+ *<br>
+ * Page 122 (in the PDF) of the OpenGL 3.0 spec says:<br>
+ * "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".<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'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>
</div></div><div class="im">+GLbitfield buffer_to_test;<br>
+<br>
+void<br>
+print_usage_and_exit(char *prog_name)<br>
+{<br>
</div>+ printf("Usage: %s <num_samples>\n",<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 < 2)<br>
<div class="im">+ print_usage_and_exit(argv[0]);<br>
+ {<br>
+ char *endptr = NULL;<br>
+ num_samples = strtol(argv[1], &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>
</div>+ glClear (GL_COLOR_BUFFER_BIT);<br>
<div class="im">+<br>
+ /* Skip the test if num_samples > GL_MAX_SAMPLES */<br>
+ GLint max_samples;<br>
+ glGetIntegerv(GL_MAX_SAMPLES, &max_samples);<br>
+ if (num_samples > max_samples)<br>
+ piglit_report_result(PIGLIT_SKIP);<br>
+<br>
</div>+ buffer_to_test = GL_COLOR_BUFFER_BIT;<br>
<div class="im">+ test_pattern = new Points();<br>
</div>+ test_pattern->compile();<br>
<div><div class="h5">+<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->draw(proj);<br>
+<br>
+ /* Blit test_fbo to the right half of window system framebuffer.<br>
+ * This is the reference image.<br>
+ */<br>
</div></div>+ glBindFramebuffer(GL_READ_FRAMEBUFFER, test_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>
+ /* 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->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>
</div>+ glBindFramebuffer(GL_READ_FRAMEBUFFER, test_fbo.handle);<br>
<div class="HOEnZb"><div class="h5">+ 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'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) && pass;<br>
+<br>
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
+<br>
+ piglit_present_results();<br>
+<br>
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
--<br>
1.7.7.6<br>
<br>
</div></div></blockquote></div><br>