<div dir="ltr">On 5 August 2013 15:13, 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_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This test verifies that same output is produced by scaled blitting<br>
of texture or renderbuffer color attachments with GL_LINEAR filter.<br>
It compares the output from following rendering<br>
scenarios:<br>
1. Scaled blit using a single-sampled framebuffer with texture<br>
   attachment.<br>
2. Scaled blit using a single-sampled framebuffer with renderbuffer<br>
   attachment.<br>
<br>
Signed-off-by: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>><br>
---<br>
 tests/all.tests                                    |   1 +<br>
 .../ext_framebuffer_multisample/CMakeLists.gl.txt  |   1 +<br>
 .../attachments-blit-scaled-linear.cpp             | 163 +++++++++++++++++++++<br>
 3 files changed, 165 insertions(+)<br>
 create mode 100644 tests/spec/ext_framebuffer_multisample/attachments-blit-scaled-linear.cpp<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index 07961b5..932f5ea 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -1101,6 +1101,7 @@ for format in ('rgba', 'depth', 'stencil'):<br>
 add_plain_test(arb_framebuffer_object, 'fbo-alpha')<br>
 add_plain_test(arb_framebuffer_object, 'fbo-blit-stretch')<br>
 add_plain_test(arb_framebuffer_object, 'fbo-blit-scaled-linear')<br>
+add_plain_test(arb_framebuffer_object, 'attachments-blit-scaled-linear')<br></blockquote><div><br></div><div>I think you mean<br><br>add_plain_test(arb_framebuffer_object, 'fbo-attachments-blit-scaled-linear')<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
 add_plain_test(arb_framebuffer_object, 'fbo-deriv')<br>
 add_plain_test(arb_framebuffer_object, 'fbo-luminance-alpha')<br>
 add_plain_test(arb_framebuffer_object, 'fbo-getframebufferattachmentparameter-01')<br>
diff --git a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
index db26758..cf8a164 100644<br>
--- a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
+++ b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt<br>
@@ -25,6 +25,7 @@ piglit_add_executable (ext_framebuffer_multisample-bitmap common.cpp bitmap.cpp)<br>
 piglit_add_executable (ext_framebuffer_multisample-blit-flipped common.cpp blit-flipped.cpp)<br>
 piglit_add_executable (ext_framebuffer_multisample-blit-scaled common.cpp blit-scaled.cpp)<br>
 piglit_add_executable (fbo-blit-scaled-linear common.cpp blit-scaled-linear.cpp)<br>
+piglit_add_executable (fbo-attachments-blit-scaled-linear common.cpp attachments-blit-scaled-linear.cpp)<br></blockquote><div><br></div><div>The comment I made on "Add test to verify the accuracy of scaled blitting with GL_LINEAR filter" applies here as well (I'd prefer to see the test pattern moved to tests/util, and then this test can go in the arb_framebuffer_object directory.) <br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
 piglit_add_executable (ext_framebuffer_multisample-blit-mismatched-samples common.cpp blit-mismatched-samples.cpp)<br>
 piglit_add_executable (ext_framebuffer_multisample-blit-mismatched-sizes common.cpp blit-mismatched-sizes.cpp)<br>
 piglit_add_executable (ext_framebuffer_multisample-blit-mismatched-formats common.cpp blit-mismatched-formats.cpp)<br>
diff --git a/tests/spec/ext_framebuffer_multisample/attachments-blit-scaled-linear.cpp b/tests/spec/ext_framebuffer_multisample/attachments-blit-scaled-linear.cpp<br>
new file mode 100644<br>
index 0000000..bb4b2e5<br>
--- /dev/null<br>
+++ b/tests/spec/ext_framebuffer_multisample/attachments-blit-scaled-linear.cpp<br>
@@ -0,0 +1,163 @@<br>
+/*<br>
+ * Copyright © 2013 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>
+/** \file attachments-blit-scaled-linear.cpp<br>
+ *<br>
+ * This test verifies that same output is produced by scaled blitting<br>
+ * of texture or renderbuffer color attachments with GL_LINEAR filter.<br>
+ * It compares the output from following rendering scenarios:<br>
+ * 1. Scaled blit using a single-sampled framebuffer with texture attachment.<br>
+ * 2. Scaled blit using a single-sampled framebuffer with renderbuffer<br>
+ *    attachment.<br>
+ */<br>
+<br>
+#include "common.h"<br>
+const int pattern_width = 258; const int pattern_height = 258;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+<br>
+       config.supports_gl_compat_version = 10;<br>
+<br>
+       config.window_width = pattern_width * 2;<br>
+       config.window_height = pattern_height;<br>
+       config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+static TestPattern *test_pattern;<br>
+const int srcX0 = 6, srcY0 = 7, dstX0 = 0, dstY0 = 0;<br>
+const int srcX1 = pattern_width / 2, srcY1 = pattern_height / 2;<br>
+static Fbo fbo_tex, fbo_rb, fbo;<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+       piglit_require_gl_version(21);<br>
+       piglit_require_extension("GL_ARB_vertex_array_object");<br>
+       fbo.setup(FboConfig(0, 2 * pattern_width, pattern_height));<br>
+       /* Create two singlesample FBOs with same format and dimensions but<br>
+        * different color attachment types.<br>
+        */<br>
+       FboConfig Config(0, pattern_width, pattern_height);<br>
+       Config.attach_texture = true;<br>
+       fbo_tex.setup(Config);<br>
+       Config.attach_texture = false;<br>
+       fbo_rb.setup(Config);<br>
+<br>
+       test_pattern = new Triangles();<br>
+       test_pattern->compile();<br>
+<br>
+       if (!piglit_check_gl_error(GL_NO_ERROR)) {<br>
+               piglit_report_result(PIGLIT_FAIL);<br>
+       }<br>
+}<br>
+<br>
+bool test_blit_scaled_linear()<br>
+{<br>
+       GLfloat scale;<br>
+       GLint samples;<br>
+       bool pass = true, result = true;<br>
+<br>
+       /* Draw the test pattern into the framebuffer with texture<br>
+        * attachment.<br>
+        */<br>
+       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo_tex.handle);<br>
+       glViewport(0, 0, srcX1, srcY1);<br>
+       glGetIntegerv(GL_SAMPLES, &samples);<br>
+       glClear(GL_COLOR_BUFFER_BIT);<br>
+       test_pattern->draw(TestPattern::no_projection);<br>
+<br>
+       /* Blit the framebuffer with texture attachment into the<br>
+        * framebuffer with renderbuffer attachment without scaling.<br>
+        */<br>
+       glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo_tex.handle);<br>
+       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo_rb.handle);<br>
+       glClear(GL_COLOR_BUFFER_BIT);<br>
+       glBlitFramebuffer(0, 0,<br>
+                         fbo_tex.config.width,<br>
+                         fbo_tex.config.height,<br>
+                         0, 0,<br>
+                         fbo_tex.config.width,<br>
+                         fbo_tex.config.height,<br>
+                         GL_COLOR_BUFFER_BIT, GL_NEAREST);<br>
+<br>
+       for(scale = 0.1; scale < 2.5f; scale += 0.1) {<br>
+               glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);<br>
+               glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+               /* Do scaled blit of fbo_tex to left half of fbo */<br>
+               glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo_tex.handle);<br>
+               glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo.handle);<br>
+                glClearColor(0.0, 1.0, 0.0, 1.0);<br>
+               glClear(GL_COLOR_BUFFER_BIT);<br>
+                glClearColor(0.0, 0.0, 0.0, 0.0);<br>
+               glEnable(GL_SCISSOR_TEST);<br>
+               glScissor(0, 0, pattern_width, pattern_height);<br>
+               glBlitFramebuffer(srcX0, srcY0,<br>
+                                 srcX1, srcY1,<br>
+                                 dstX0, dstY0,<br>
+                                 dstX0 + srcX1 * scale, dstY0 + srcY1 * scale,<br>
+                                 GL_COLOR_BUFFER_BIT,<br>
+                                 GL_LINEAR);<br>
+               glDisable(GL_SCISSOR_TEST);<br>
+<br>
+               /* Do scaled blit of fbo_rb to right half of fbo */<br>
+               glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo_rb.handle);<br>
+               glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo.handle);<br>
+               glBlitFramebuffer(srcX0, srcY0,<br>
+                                 srcX1, srcY1,<br>
+                                 pattern_width + dstX0, dstY0,<br>
+                                 pattern_width + dstX0 + srcX1 * scale,<br>
+                                 dstY0 + srcY1 * scale,<br>
+                                 GL_COLOR_BUFFER_BIT,<br>
+                                 GL_LINEAR);<br>
+<br>
+               pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
+               glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo.handle);<br>
+               result = piglit_probe_rect_halves_equal_rgba(0, 0,<br>
+                                                           piglit_width,<br>
+                                                           piglit_height);<br>
+               pass = result && pass;<br>
+<br>
+               glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo.handle);<br>
+               glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);<br>
+               glBlitFramebuffer(0, 0, 2 * pattern_width, piglit_height,<br>
+                                  0, 0, 2 * pattern_width, piglit_height,<br>
+                                  GL_COLOR_BUFFER_BIT, GL_NEAREST);<br>
+               piglit_present_results();<br>
+               printf("scale = %f, result = %s\n",<br>
+                      scale, result ? "pass" : "fail");<br>
+       }<br>
+       return pass;<br>
+}<br>
+<br>
+enum piglit_result<br>
+piglit_display()<br>
+{<br>
+       bool pass = true;<br>
+       printf("Left Image: Linear scaled blit using texture attachment.\n"<br>
+              "Right Image: Linear scaled blit using renderbuffer attachment.\n");<br>
+       pass = test_blit_scaled_linear()<br>
+              && pass;<br>
+       return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
<span><font color="#888888">--<br>
1.8.1.4<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></div></div>