Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
---
 tests/all.tests                                    |   1 +
 .../ext_framebuffer_multisample/CMakeLists.gl.txt  |   1 +
 .../negative-blit-scaled.cpp                       | 111 +++++++++++++++++++++
 3 files changed, 113 insertions(+)
 create mode 100644 
tests/spec/ext_framebuffer_multisample/negative-blit-scaled.cpp

diff --git a/tests/all.tests b/tests/all.tests
index 892f0b7..a3ff557 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1428,6 +1428,7 @@ ext_framebuffer_multisample['blit-mismatched-formats'] = 
concurrent_test('ext_fr
 ext_framebuffer_multisample['dlist'] = 
concurrent_test('ext_framebuffer_multisample-dlist')
 ext_framebuffer_multisample['enable-flag'] = 
PlainExecTest('ext_framebuffer_multisample-enable-flag -auto')
 ext_framebuffer_multisample['minmax'] = 
concurrent_test('ext_framebuffer_multisample-minmax')
+ext_framebuffer_multisample['negative-blit-scaled'] = 
concurrent_test('ext_framebuffer_multisample-negative-blit-scaled')
 ext_framebuffer_multisample['negative-copypixels'] = 
concurrent_test('ext_framebuffer_multisample-negative-copypixels')
 ext_framebuffer_multisample['negative-copyteximage'] = 
concurrent_test('ext_framebuffer_multisample-negative-copyteximage')
 ext_framebuffer_multisample['negative-max-samples'] = 
concurrent_test('ext_framebuffer_multisample-negative-max-samples')
diff --git a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt 
b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt
index 6778de8..99a333b 100644
--- a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt
+++ b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt
@@ -49,6 +49,7 @@ piglit_add_executable 
(ext_framebuffer_multisample-negative-copypixels negative-
 piglit_add_executable (ext_framebuffer_multisample-negative-copyteximage 
negative-copyteximage.c)
 piglit_add_executable (ext_framebuffer_multisample-negative-max-samples 
negative-max-samples.c)
 piglit_add_executable (ext_framebuffer_multisample-negative-mismatched-samples 
negative-mismatched-samples.c)
+piglit_add_executable (ext_framebuffer_multisample-negative-blit-scaled 
common.cpp negative-blit-scaled.cpp)
 piglit_add_executable (ext_framebuffer_multisample-negative-readpixels 
negative-readpixels.c)
 piglit_add_executable (ext_framebuffer_multisample-no-color no-color.cpp 
common.cpp)
 piglit_add_executable (ext_framebuffer_multisample-point-smooth common.cpp 
point-smooth.cpp)
diff --git a/tests/spec/ext_framebuffer_multisample/negative-blit-scaled.cpp 
b/tests/spec/ext_framebuffer_multisample/negative-blit-scaled.cpp
new file mode 100644
index 0000000..d082c72
--- /dev/null
+++ b/tests/spec/ext_framebuffer_multisample/negative-blit-scaled.cpp
@@ -0,0 +1,111 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/** \file negative-blit-scaled.cpp
+ *
+ * This test verifies that expected GL errors are produced for cases mentioned
+ * in EXT_framebuffer_multisample_blit_scaled extension:
+ *
+ * "If the draw framebuffer is framebuffer complete and has a value of
+ * SAMPLE_BUFFERS that is greater than zero, or if the read framebuffer
+ * is framebuffer complete and has a value of SAMPLE_BUFFERS that is
+ * zero, then the error INVALID_OPERATION is generated if BlitFramebuffer
+ * is called and the filter is SCALED_RESOLVE_FASTEST_EXT or
+ * SCALED_RESOLVE_NICEST_EXT."
+ *
+ */
+
+#include "common.h"
+
+const int pattern_width = 256; const int pattern_height = 256;
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+       config.supports_gl_compat_version = 10;
+
+       config.window_width = pattern_width;
+       config.window_height = pattern_height;
+       config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static Fbo multisampled_fbo_1, multisampled_fbo_2, singlesampled_fbo;
+static TestPattern *test_pattern;
+
+void
+piglit_init(int argc, char **argv)
+{
+       bool pass = true;
+       GLint max_samples;
+
+       piglit_require_extension("GL_EXT_framebuffer_multisample_blit_scaled");
+
+       glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
+       FboConfig msConfig(max_samples, pattern_width, pattern_height);
+       msConfig.attach_texture = true;
+
+       singlesampled_fbo.setup(FboConfig(0, pattern_width, pattern_height));
+       multisampled_fbo_1.setup(msConfig);
+       multisampled_fbo_2.setup(msConfig);
+
+       if (!piglit_check_gl_error(GL_NO_ERROR)) {
+               piglit_report_result(PIGLIT_FAIL);
+       }
+
+        /* Do scaled multi-sample to multi-sample blit */
+       glBindFramebuffer(GL_READ_FRAMEBUFFER, multisampled_fbo_1.handle);
+       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, multisampled_fbo_2.handle);
+
+       glBlitFramebuffer(0, 0, pattern_width / 2, pattern_height / 2,
+                         0, 0, pattern_width, pattern_height,
+                         GL_COLOR_BUFFER_BIT, GL_SCALED_RESOLVE_FASTEST_EXT);
+       pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+
+       glBlitFramebuffer(0, 0, pattern_width / 2, pattern_height / 2,
+                         0, 0, pattern_width, pattern_height,
+                         GL_COLOR_BUFFER_BIT, GL_SCALED_RESOLVE_NICEST_EXT);
+       pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+
+       /* Do scaled single-sample to single-sample blit */
+       glBindFramebuffer(GL_READ_FRAMEBUFFER, singlesampled_fbo.handle);
+       glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
+
+       glBlitFramebuffer(0, 0, pattern_width / 2, pattern_height / 2,
+                         0, 0, pattern_width, pattern_height,
+                         GL_COLOR_BUFFER_BIT, GL_SCALED_RESOLVE_FASTEST_EXT);
+       pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+
+       glBlitFramebuffer(0, 0, pattern_width / 2, pattern_height / 2,
+                         0, 0, pattern_width, pattern_height,
+                         GL_COLOR_BUFFER_BIT, GL_SCALED_RESOLVE_NICEST_EXT);
+       pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+
+       piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
+enum piglit_result
+piglit_display()
+{
+        /* UNREACHED */
+       return PIGLIT_FAIL;
+}
-- 
1.8.1.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to