On 7 May 2012 10:51, 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 covers following cases:<br>
 - Blit multisample-to-multisample with matching sample count<br>
 - Blit multisample-to-multisample with non-matching sample count<br>
 - Blit multisample-to-multisample with non-matching format<br>
 - Blit multisample-to-multisample nonmatching buffer size<br>
 - Blit singlesample-to-multisample<br>
<br>
Signed-off-by: Anuj Phogat &lt;<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>&gt;<br>
---<br>
 tests/all.tests                                    |    1 +<br>
 .../ext_framebuffer_multisample/CMakeLists.gl.txt  |    1 +<br>
 tests/spec/ext_framebuffer_multisample/blit.c      |  454 ++++++++++++++++++++<br>
 3 files changed, 456 insertions(+), 0 deletions(-)<br>
 create mode 100644 tests/spec/ext_framebuffer_multisample/blit.c<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index 7d3d239..49288fb 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -1277,6 +1277,7 @@ arb_vertex_program[&#39;minmax&#39;] = concurrent_test(&#39;arb_vertex_program-minmax&#39;)<br>
<br>
 ext_framebuffer_multisample = Group()<br>
 spec[&#39;EXT_framebuffer_multisample&#39;] = ext_framebuffer_multisample<br>
+ext_framebuffer_multisample[&#39;blit&#39;] = concurrent_test(&#39;ext_framebuffer_multisample-blit&#39;)<br>
 ext_framebuffer_multisample[&#39;dlist&#39;] = concurrent_test(&#39;ext_framebuffer_multisample-dlist&#39;)<br>
 ext_framebuffer_multisample[&#39;minmax&#39;] = concurrent_test(&#39;ext_framebuffer_multisample-minmax&#39;)<br>
 ext_framebuffer_multisample[&#39;negative-copypixels&#39;] = concurrent_test(&#39;ext_framebuffer_multisample-negative-copypixels&#39;)<br>
diff --git a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
index c451f9f..be3c013 100644<br>
--- a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
+++ b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
@@ -12,6 +12,7 @@ link_libraries (<br>
 )<br>
<br>
 piglit_add_executable (ext_framebuffer_multisample-accuracy accuracy.cpp)<br>
+piglit_add_executable (ext_framebuffer_multisample-blit blit.c)<br>
 piglit_add_executable (ext_framebuffer_multisample-dlist dlist.c)<br>
 piglit_add_executable (ext_framebuffer_multisample-minmax minmax.c)<br>
 piglit_add_executable (ext_framebuffer_multisample-negative-copypixels negative-copypixels.c)<br>
diff --git a/tests/spec/ext_framebuffer_multisample/blit.c b/tests/spec/ext_framebuffer_multisample/blit.c<br>
new file mode 100644<br>
index 0000000..3da16fc<br>
--- /dev/null<br>
+++ b/tests/spec/ext_framebuffer_multisample/blit.c<br>
@@ -0,0 +1,454 @@<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;piglit-util.h&quot;<br>
+/**<br>
+ * @file blit.c<br>
+ *<br>
+ * This test verifies glBlitFramebuffer() with multisample framebuffer objects.<br>
+ * We generate FBOs with specified sample count, clear them to unique colors,<br>
+ * do blitting operation and then probe their color buffers to verify against<br>
+ * expected values.<br>
+ *<br>
+ * Tests following cases:<br>
+ * - Blit multisample-to-multisample with matching sample count<br>
+ * - Blit multisample-to-multisample with non-matching sample count<br>
+ * - Blit multisample-to-multisample with non-matching format<br>
+ * - Blit multisample-to-multisample nonmatching buffer size<br>
+ * - Blit singlesample-to-multisample<br>
+ *<br>
+ * Bottom half of framebuffer draws contents of fbo_ms0 before blit operation.<br>
+ * Top half of framebuffer draws contents of fbo_ms0 after blit operatrion.<br>
+ *<br>
+ */<br>
+<br>
+int piglit_width = 500;<br>
+int piglit_height = 200;<br>
+<br>
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGBA | GLUT_ALPHA;<br>
+int max_samples;<br>
+static GLenum fbo_formats[] = {<br>
+       GL_RED,<br>
+       GL_RG,<br>
+       GL_RGB,<br>
+       GL_ALPHA,<br>
+       /* TODO: Add testing for depth and stencil buffers */<br>
+       //GL_DEPTH_COMPONENT,<br>
+       //GL_STENCIL_INDEX,<br>
+       };<br>
+<br>
+struct fbo_data {<br>
+       GLuint fb_handle;<br>
+       GLuint rb_handle;<br>
+       GLuint tex_handle;<br>
+       GLuint width;<br>
+       GLuint height;<br>
+       GLint samples;<br>
+       GLenum format; };<br>
+<br>
+/* Function to switch ON/OFF MSAA in a FBO */<br>
+static void<br>
+setup_fbo(struct fbo_data *fbo)<br>
+{<br>
+       GLint samples, sample_buffers;<br>
+       GLenum status;<br>
+<br>
+       glGenRenderbuffersEXT(1, &amp;fbo-&gt;rb_handle);<br>
+       glBindRenderbufferEXT(GL_RENDERBUFFER, fbo-&gt;rb_handle);<br>
+<br>
+       if (fbo-&gt;samples)<br>
+               glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER,<br>
+                                                   fbo-&gt;samples,<br>
+                                                   fbo-&gt;format,<br>
+                                                   fbo-&gt;width,<br>
+                                                   fbo-&gt;height);<br>
+       else<br>
+               glRenderbufferStorage(GL_RENDERBUFFER,<br>
+                                     fbo-&gt;format,<br>
+                                     fbo-&gt;width,<br>
+                                     fbo-&gt;height);<br></blockquote><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+       glFramebufferRenderbufferEXT(GL_FRAMEBUFFER,<br>
+                                    GL_COLOR_ATTACHMENT0,<br>
+                                    GL_RENDERBUFFER, fbo-&gt;rb_handle);<br>
+<br>
+       status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER);<br>
+       if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {<br>
+               fprintf(stderr, &quot;FBO incomplete, format = %s\n&quot;,<br>
+                       piglit_get_gl_enum_name(fbo-&gt;format));<br>
+               piglit_report_result(PIGLIT_FAIL);<br>
+       }<br>
+<br>
+       if(!piglit_automatic) {<br>
+               glGetIntegerv(GL_SAMPLES, &amp;samples);<br>
+               glGetIntegerv(GL_SAMPLE_BUFFERS, &amp;sample_buffers);<br>
+               printf(&quot;FBO handle = %d, GL_SAMPLES = %d, MSAA = %s\n&quot;,<br>
+                      fbo-&gt;fb_handle, samples, sample_buffers ? &quot;ON&quot; : &quot;OFF&quot;);<br>
+       }<br>
+}<br>
+<br>
+static void<br>
+init_fbo_data(struct fbo_data *fbo)<br>
+{<br>
+       fbo-&gt;width = piglit_width / 5;<br>
+       fbo-&gt;height = piglit_height / 2;<br>
+       fbo-&gt;format = GL_RGBA;<br>
+}<br>
+<br>
+static void<br>
+generate_fbo(struct fbo_data *fbo)<br>
+{<br>
+       glGenFramebuffersEXT(1, &amp;fbo-&gt;fb_handle);<br>
+       glBindFramebufferEXT(GL_FRAMEBUFFER, fbo-&gt;fb_handle);<br>
+       setup_fbo(fbo);<br>
+}<br>
+<br>
+static void<br>
+destroy_fbo(struct fbo_data *fbo)<br>
+{<br>
+       glDeleteRenderbuffersEXT(1, &amp;fbo-&gt;rb_handle);<br>
+       glDeleteFramebuffersEXT(1, &amp;fbo-&gt;fb_handle);<br>
+       fbo-&gt;rb_handle = fbo-&gt;fb_handle = 0;<br>
+}<br></blockquote><div><br>Not trying to start a language war here, but I think the above code would be an excellent candidate for converting into a C++ class.  init_fbo_data() and generate_fbo() would become the constructor, and destroy_fbo() would become the destructor.<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>
+static void<br>
+blit_fbo(int src_x1, int src_y1, int src_x2, int src_y2,<br>
+        int dst_x1, int dst_y1, int dst_x2, int dst_y2,<br>
+        struct fbo_data *src_fbo, struct fbo_data *dst_fbo,<br>
+        bool blit_to_default)<br>
+{<br>
+       if (blit_to_default)<br>
+               glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);<br>
+       else<br>
+               glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT,<br>
+                                    dst_fbo-&gt;fb_handle);<br>
+<br>
+       glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, src_fbo-&gt;fb_handle);<br>
+<br>
+       /* In case of multisample FBO, glBlitFramebufferEXT invokes the<br>
+        * multisample to single sample resolution for each pixel */<br>
+<br>
+       glBlitFramebufferEXT(src_x1, src_y1, src_x2, src_y2,<br>
+                            dst_x1, dst_y1, dst_x2, dst_y2,<br>
+                            GL_COLOR_BUFFER_BIT, GL_NEAREST);<br>
+}<br></blockquote><div><br>Looking through the code that follows, it looks like every call to blit_fbo() does one of two things:<br>- Blit the entire source fbo to the entire destination fbo.<br>- Blit the entire source fbo to an offset within the default framebuffer.<br>

<br>I would recommend splitting this up into two functions, one for each purpose, and only pass in the arguments that can&#39;t be derived from looking at the fbo_data struct.  For example, something like:<br><br>void blit_fbo_to_fbo(struct fbo_data *src, struct fbo_data *dst);<br>

void blit_fbo_to_default(struct fbo_data *src, int dst_x1, int dst_y1);<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>
+<br>
+static bool<br>
+test_blit_ms_ms_matching_samples(void)<br>
+{<br>
+       bool result = true;<br>
+       struct fbo_data fbo_ms0, fbo_ms1;<br>
+       GLint i;<br>
+       GLuint w, h;<br>
+       GLfloat green[4] = {0.0, 1.0, 0.0, 1.0};<br>
+<br>
+       init_fbo_data(&amp;fbo_ms0); init_fbo_data(&amp;fbo_ms1);<br>
+       w = fbo_ms0.width; h = fbo_ms0.height;<br>
+<br>
+       for(i = 2; i &lt;= max_samples; i += 2) {<br>
+               fbo_ms0.samples = fbo_ms1.samples = i;<br>
+               /* Create a fbo with  multisample render buffer */<br>
+               generate_fbo(&amp;fbo_ms0);<br>
+               glClearColor(1.0, 0.0, 0.0, 1.0);<br>
+               glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+               /* Blit the multisampled fbo in to default framebuffer */<br>
+               blit_fbo(0, 0, w, h, 0, 0, w, h, &amp;fbo_ms0, NULL, true);<br>
+<br>
+               /* Create another fbo with multisample render buffer */<br>
+               generate_fbo(&amp;fbo_ms1);<br>
+               glClearColor(0.0, 1.0, 0.0, 1.0);<br>
+               glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+               /* Blit  fbo_ms1 to fbo_ms0 */<br>
+               blit_fbo(0, 0, w, h, 0, 0, w, h, &amp;fbo_ms1, &amp;fbo_ms0, false);<br>
+<br>
+               result = piglit_check_gl_error(GL_NO_ERROR)<br>
+                        &amp;&amp; result;<br>
+<br>
+               /* Blit fbo_ms0 to default fb */<br>
+               blit_fbo(0, 0, w, h, 0, h, w, 2 * h, &amp;fbo_ms0, NULL, true);<br>
+<br>
+               glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);<br>
+<br>
+               /* Probe fbo_ms0 and compare to expected color.<br>
+                */<br>
+               result = piglit_probe_rect_rgba(0, h, w, h, green)<br>
+                        &amp;&amp; result;<br>
+<br>
+               destroy_fbo(&amp;fbo_ms0);<br>
+               destroy_fbo(&amp;fbo_ms1);<br>
+       }<br>
+       return result;<br>
+}<br>
+<br>
+static bool<br>
+test_blit_ms_ms_non_matching_samples(void)<br>
+{<br>
+       bool result = true;<br>
+       struct fbo_data fbo_ms0, fbo_ms1;<br>
+       GLint i;<br>
+       GLuint w, h;<br>
+       GLfloat yellow[4] = {1.0, 1.0, 0.0, 1.0};<br>
+<br>
+       init_fbo_data(&amp;fbo_ms0); init_fbo_data(&amp;fbo_ms1);<br>
+       w = fbo_ms0.width; h = fbo_ms0.height;<br>
+<br>
+       for(i = 4; i &lt;= max_samples; i += 2) {<br>
+               fbo_ms0.samples = i; fbo_ms1.samples = i - 2;<br>
+               /* Create a fbo with  multisample render buffer */<br>
+               generate_fbo(&amp;fbo_ms0);<br>
+               glClearColor(1.0, 1.0, 0.0, 1.0);<br>
+               glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+               /* Blit the multisampled fbo in to default framebuffer */<br>
+               blit_fbo(0, 0, w, h, w, 0, 2 * w, h, &amp;fbo_ms0, NULL, true);<br>
+<br>
+               /* Create another fbo with multisample render buffer */<br>
+               generate_fbo(&amp;fbo_ms1);<br>
+               glClearColor(0.0, 1.0, 0.0, 1.0);<br>
+               glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+               /* Blit  fbo_ms1 to fbo_ms0 */<br>
+               blit_fbo(0, 0, w, h, 0, 0, w, h, &amp;fbo_ms1, &amp;fbo_ms0, false);<br>
+<br>
+               result = piglit_check_gl_error(GL_INVALID_OPERATION)<br>
+                        &amp;&amp; result;<br>
+<br>
+               /* Verify that no blitting is done. Blit fbo_ms0 to default fb.<br>
+                */<br>
+               blit_fbo(0, 0, w, h, w, h, 2 * w, 2 * h, &amp;fbo_ms0, NULL, true);<br>
+<br>
+               glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);<br>
+<br>
+               /* Probe fbo_ms0 and compare to expected color.<br>
+                */<br>
+               result = piglit_probe_rect_rgba(w, h, w, h, yellow)<br>
+                        &amp;&amp; result;<br>
+<br>
+               destroy_fbo(&amp;fbo_ms0);<br>
+               destroy_fbo(&amp;fbo_ms1);<br>
+       }<br>
+       return result;<br>
+}<br>
+<br>
+static bool<br>
+test_blit_ms_ms_non_matching_formats(void)<br>
+{<br>
+       bool result = true;<br>
+       struct fbo_data fbo_ms0, fbo_ms1;<br>
+       GLint i, j;<br>
+       GLuint w, h;<br>
+       GLfloat blue[4] = {0.0, 0.0, 1.0, 1.0};<br>
+<br>
+       init_fbo_data(&amp;fbo_ms0); init_fbo_data(&amp;fbo_ms1);<br>
+       w = fbo_ms0.width; h = fbo_ms0.height;<br>
+<br>
+       for(j = 0; j &lt; ARRAY_SIZE(fbo_formats); j++) {<br>
+               for(i = 2; i &lt;= max_samples; i += 2) {<br>
+                       fbo_ms0.samples = fbo_ms1.samples = i;<br>
+                       fbo_ms1.format = fbo_formats[j];<br>
+<br>
+                       /* Create a fbo with  multisample render buffer */<br>
+                       generate_fbo(&amp;fbo_ms0);<br>
+                       glClearColor(0.0, 0.0, 1.0, 1.0);<br>
+                       glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+                       /* Blit the multisampled fbo in to default<br>
+                        * framebuffer */<br>
+                       blit_fbo(0, 0, w, h, 2 * w, 0, 3 * w, h, &amp;fbo_ms0, NULL, true);<br>
+<br>
+                       /* Create another fbo with multisample render buffer */<br>
+                       generate_fbo(&amp;fbo_ms1);<br>
+                       glClearColor(0.4, 0.6, 0.8, 0.5);<br>
+                       glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+                       /* Blit fbo_ms1 to fbo_ms0 */<br>
+                       blit_fbo(0, 0, w, h, 0, 0, w, h, &amp;fbo_ms1, &amp;fbo_ms0, false);<br>
+<br>
+                       result = piglit_check_gl_error(GL_INVALID_OPERATION)<br>
+                                &amp;&amp; result;<br>
+<br>
+                       /* Blit fbo_ms0 to default fb */<br>
+                       blit_fbo(0, 0, w, h, 2 * w, h, 3 * w, 2 * h, &amp;fbo_ms0, NULL, true);<br>
+<br>
+                       glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);<br>
+<br>
+                       /* Probe fbo_ms0 and compare to expected color */<br>
+                       result = piglit_probe_rect_rgba(2 * w, h, w, h, blue)<br>
+                                &amp;&amp; result;<br>
+<br>
+                       destroy_fbo(&amp;fbo_ms0);<br>
+                       destroy_fbo(&amp;fbo_ms1);<br>
+               }<br>
+       }<br>
+       return result;<br>
+}<br>
+<br>
+static bool test_blit_ms_ms_non_matching_buffer_size(void)<br>
+{<br>
+       bool result = true;<br>
+       struct fbo_data fbo_ms0, fbo_ms1;<br>
+       GLfloat cyan[4] = {0.0, 1.0, 1.0, 1.0};<br>
+       GLint i;<br>
+       GLuint w, h;<br>
+<br>
+       init_fbo_data(&amp;fbo_ms0); init_fbo_data(&amp;fbo_ms1);<br>
+       w = fbo_ms0.width; h = fbo_ms0.height;<br>
+<br>
+        fbo_ms1.width = piglit_width / 8;<br>
+        fbo_ms1.height = piglit_height/2;<br>
+<br>
+       for(i = 2; i &lt;= max_samples; i += 2) {<br>
+<br>
+               fbo_ms0.samples = fbo_ms1.samples = i;<br>
+<br>
+               /* Create a fbo with  multisample render buffer */<br>
+               generate_fbo(&amp;fbo_ms0);<br>
+               glClearColor(0.0, 1.0, 1.0, 1.0);<br>
+               glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+               /* Blit the multisampled fbo in to default framebuffer */<br>
+               blit_fbo(0, 0, w, h, 3 * w, 0, 4 * w, h, &amp;fbo_ms0, NULL, true);<br>
+<br>
+               /* Create another fbo with multisample render buffer */<br>
+               generate_fbo(&amp;fbo_ms1);<br>
+               glClearColor(0.0, 1.0, 0.0, 1.0);<br>
+               glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+               /* Blit  fbo_ms1 to fbo_ms0 */<br>
+               blit_fbo(0, 0, fbo_ms1.width, fbo_ms1.height,<br>
+                        0, 0, w, h, &amp;fbo_ms1, &amp;fbo_ms0, false);<br>
+<br>
+               result = piglit_check_gl_error(GL_INVALID_OPERATION)<br>
+                        &amp;&amp; result;<br>
+<br>
+               /* Blit fbo_ms0 to default fb */<br>
+               blit_fbo(0, 0, w, h, 3 * w, h, 4 * w, 2 * h, &amp;fbo_ms0, NULL, true);<br>
+<br>
+               glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);<br>
+<br>
+               /* Probe fbo_ms0 and compare to expected color.<br>
+                */<br>
+               result = piglit_probe_rect_rgba(3 * w, h, w, h, cyan)<br>
+                        &amp;&amp; result;<br>
+<br>
+               destroy_fbo(&amp;fbo_ms0);<br>
+               destroy_fbo(&amp;fbo_ms1);<br>
+       }<br>
+       return result;<br>
+}<br>
+<br>
+static bool<br>
+test_blit_ss_ms(void)<br></blockquote><div><br>I think this function is probably redundant with my &quot;Add a test of MSAA upsampling&quot; patch.<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>
+       bool result = true;<br>
+       struct fbo_data fbo_ms0, fbo_ss1;<br>
+       GLfloat green[4] = {0.0, 1.0, 0.0, 1.0};<br>
+       GLint i;<br>
+       GLuint w, h;<br>
+<br>
+       init_fbo_data(&amp;fbo_ms0); init_fbo_data(&amp;fbo_ss1);<br>
+       w = fbo_ms0.width; h = fbo_ms0.height;<br>
+<br>
+       for(i = 2; i &lt;= max_samples; i += 2) {<br>
+               fbo_ms0.samples = i; fbo_ss1.samples = 0;<br>
+<br>
+               /* Create a fbo with  multisample render buffer */<br>
+               generate_fbo(&amp;fbo_ms0);<br>
+               glClearColor(1.0, 0.0, 1.0, 1.0);<br>
+               glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+               /* Blit the multisampled fbo in to default framebuffer */<br>
+               blit_fbo(0, 0, w, h, 4 * w, 0, 5 * w, h, &amp;fbo_ms0, NULL, true);<br>
+<br>
+               /* Create another fbo with single sample render buffer */<br>
+               generate_fbo(&amp;fbo_ss1);<br>
+               glClearColor(0.0, 1.0, 0.0, 1.0);<br>
+               glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+               /* Blit  fbo_ss1 to fbo_ms0 */<br>
+               blit_fbo(0, 0, w, h, 0, 0, w, h, &amp;fbo_ss1, &amp;fbo_ms0, false);<br>
+<br>
+               result = piglit_check_gl_error(GL_NO_ERROR)<br>
+                        &amp;&amp; result;<br>
+<br>
+               /* Blit fbo_ms0 to default fb */<br>
+               blit_fbo(0, 0, w, h, 4 * w, h, 5 * w, 2 * h, &amp;fbo_ms0, NULL, true);<br>
+<br>
+               glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);<br>
+<br>
+               /* Probe fbo_ms0 and compare to expected color */<br>
+               result = piglit_probe_rect_rgba(4 * w, h, w, h, green)<br>
+                        &amp;&amp; result;<br>
+<br>
+               destroy_fbo(&amp;fbo_ms0);<br>
+               destroy_fbo(&amp;fbo_ss1);<br>
+       }<br>
+       return result;<br>
+}<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+       bool pass = true;<br>
+<br>
+       glClearColor(0.4, 0.4, 0.4, 1.0);<br>
+       glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+       glGetIntegerv(GL_MAX_SAMPLES, &amp;max_samples);<br>
+<br>
+       /* Blit multisample-to-multisample with matching sample count */<br>
+       pass = test_blit_ms_ms_matching_samples()<br>
+              &amp;&amp; pass;<br>
+<br>
+       /* Blit multisample-to-multisample with non-matching sample count */<br>
+       pass = test_blit_ms_ms_non_matching_samples()<br>
+              &amp;&amp; pass;<br>
+<br>
+       /* Blit multisample-to-multisample with non-matching format */<br>
+       pass = test_blit_ms_ms_non_matching_formats()<br>
+              &amp;&amp; pass;<br>
+<br>
+       /* Blit multisample-to-multisample with non-matching buffer size */<br>
+       pass = test_blit_ms_ms_non_matching_buffer_size()<br>
+              &amp;&amp; pass;<br>
+<br>
+       /* Blit singlesample-to-multisample */<br>
+       pass = test_blit_ss_ms()<br>
+              &amp;&amp; pass;<br>
+<br>
+       if (!piglit_automatic)<br>
+               piglit_present_results();<br>
+<br>
+       return (pass ? PIGLIT_PASS : PIGLIT_FAIL);<br>
+}<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+       piglit_ortho_projection(piglit_width, piglit_height, GL_TRUE);<br>
+       piglit_require_extension(&quot;GL_EXT_framebuffer_multisample&quot;);<br>
+       piglit_require_extension(&quot;GL_EXT_framebuffer_blit&quot;);<br>
+}<br>
<span><font color="#888888">--<br>
1.7.7.6<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org" target="_blank">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>