On 18 June 2012 07:35, 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">
Signed-off-by: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br>
---<br>
tests/all.tests | 1 +<br>
.../ext_framebuffer_multisample/CMakeLists.gl.txt | 1 +<br>
.../blit-mismatched-samples.cpp | 89 ++++++++++++++++++++<br>
3 files changed, 91 insertions(+), 0 deletions(-)<br>
create mode 100644 tests/spec/ext_framebuffer_multisample/blit-mismatched-samples.cpp<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index a004323..550d330 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -1310,6 +1310,7 @@ arb_vertex_program['minmax'] = concurrent_test('arb_vertex_program-minmax')<br>
<br>
ext_framebuffer_multisample = Group()<br>
spec['EXT_framebuffer_multisample'] = ext_framebuffer_multisample<br>
+ext_framebuffer_multisample['blit-mismatched-samples'] = concurrent_test('ext_framebuffer_multisample-blit-mismatched-samples')<br>
ext_framebuffer_multisample['dlist'] = concurrent_test('ext_framebuffer_multisample-dlist')<br>
ext_framebuffer_multisample['minmax'] = concurrent_test('ext_framebuffer_multisample-minmax')<br>
ext_framebuffer_multisample['negative-copypixels'] = concurrent_test('ext_framebuffer_multisample-negative-copypixels')<br>
diff --git a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
index 1660067..146b80e 100644<br>
--- a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
+++ b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
@@ -10,6 +10,7 @@ link_libraries (<br>
)<br>
<br>
piglit_add_executable (ext_framebuffer_multisample-accuracy common.cpp accuracy.cpp)<br>
+piglit_add_executable (ext_framebuffer_multisample-blit-mismatched-samples common.cpp blit-mismatched-samples.cpp)<br>
piglit_add_executable (ext_framebuffer_multisample-dlist dlist.c)<br>
piglit_add_executable (ext_framebuffer_multisample-formats common.cpp formats.cpp)<br>
piglit_add_executable (ext_framebuffer_multisample-line-smooth common.cpp line-smooth.cpp)<br>
diff --git a/tests/spec/ext_framebuffer_multisample/blit-mismatched-samples.cpp b/tests/spec/ext_framebuffer_multisample/blit-mismatched-samples.cpp<br>
new file mode 100644<br>
index 0000000..9873f7f<br>
--- /dev/null<br>
+++ b/tests/spec/ext_framebuffer_multisample/blit-mismatched-samples.cpp<br>
@@ -0,0 +1,89 @@<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 "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>
+/**<br>
+ * @file blit-mismatched-samples.cpp<br>
+ *<br>
+ * This test verifies if glBlitFramebuffer() throws GL_INVALID_OPERATION with<br>
+ * non-matching samples in multisample framebuffer objects.<br>
+ *<br>
+ * We initialize two FBOs with different sample counts, do blitting operation<br>
+ * and then query the gl error.<br>
+ *<br>
+ * Author: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br>
+ */<br>
+<br>
+#include "common.h"<br>
+<br>
+int piglit_width = 256; int piglit_height = 256;<br>
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGBA;<br>
+<br>
+const int pattern_width = 256; const int pattern_height = 256;<br>
+Fbo src_fbo, dst_fbo;<br>
+<br>
+enum piglit_result<br>
+piglit_display()<br>
+{<br>
+ bool pass = true;<br>
+<br>
+ /* Blit multisample-to-multisample with non-matching sample count */<br>
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, src_fbo.handle);<br>
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dst_fbo.handle);<br>
+ glBlitFramebuffer(0, 0, pattern_width, pattern_height,<br>
+ 0, 0, pattern_width, pattern_height,<br>
+ GL_COLOR_BUFFER_BIT, GL_NEAREST);<br>
+<br>
+ /* Here GL_INVALID_OPERATION is an expected gl error */<br>
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;<br>
+<br>
+ return (pass ? PIGLIT_PASS : PIGLIT_FAIL);<br>
+}<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+ GLint samples, max_samples;<br>
+ piglit_require_gl_version(30);<br>
+<br>
+ /* OpenGL driver is supposed to round up the specified sample count to<br>
+ * the next available sample count. So, this will create the FBO with<br>
+ * minimum supported sample count.<br>
+ */<br>
+ src_fbo.setup(FboConfig(1 /* sample count */,<br>
+ pattern_width,<br>
+ pattern_height));<br>
+<br>
+ glGetIntegerv(GL_MAX_SAMPLES, &max_samples);<br>
+<br>
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, src_fbo.handle);<br>
+ glGetIntegerv(GL_SAMPLES, &samples);<br>
+<br>
+ /* Skip the test if samples = GL_MAX_SAMPLES */<br>
+ if (samples == max_samples)<br>
+ piglit_report_result(PIGLIT_SKIP);<br></blockquote><div><br>It might be nice to print a message before calling PIGLIT_SKIP that explains why the test is skipping. (Maybe something like "the implementation seems to support only one possible sample count").<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>
+ /* Creating FBO with (max_samples + 1) ensures that we get a different<br>
+ * value of sample count in dst_fbo.<br>
+ */<br>
+ dst_fbo.setup(FboConfig(max_samples + 1, pattern_width, pattern_height));<br></blockquote><div><br>I think you mean "samples + 1", not "max_samples + 1". max_samples + 1 asks for more samples than the implementation supports.<br>
<br>Also, I'd recommend adding something like this at the end of piglit_init():<br><br> if (!piglit_check_gl_error(GL_NO_ERROR)) {<br> printf("Error setting up fbos\n");<br> piglit_report_result(PIGLIT_FAIL);<br>
}<br><br>Without it, there's a danger that an error in setting up the fbo's will be mistaken for the expected blit error, and the test will appear to pass when it actually fails.<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>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.7.6<br>
<br>
</font></span></blockquote></div><br>With those minor fixes, this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>