[Piglit] [PATCH V2 3/3] Add test to verify the error conditions in ext_multisample_framebuffer_blit_scaled

Anuj Phogat anuj.phogat at gmail.com
Tue Jul 2 12:20:30 PDT 2013


Note: Test passes on Intel's i965 drivers. Patches for scaled
blitting support on i965 are out for review on mesa-dev mailing list.

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

diff --git a/tests/all.tests b/tests/all.tests
index 5ff88f8..5dff991 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1478,6 +1478,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 b1f837e..5d2df71 100644
--- a/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt
+++ b/tests/spec/ext_framebuffer_multisample/CMakeLists.gl.txt
@@ -48,6 +48,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..28e2145
--- /dev/null
+++ b/tests/spec/ext_framebuffer_multisample/negative-blit-scaled.cpp
@@ -0,0 +1,141 @@
+/*
+ * Copyright © 2013 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;
+
+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 Config(max_samples, pattern_width, pattern_height);
+	multisampled_fbo_1.setup(Config);
+	multisampled_fbo_2.setup(Config);
+	Config.num_samples = 0;
+	singlesampled_fbo.setup(Config);
+
+	if (!piglit_check_gl_error(GL_NO_ERROR)) {
+		piglit_report_result(PIGLIT_FAIL);
+	}
+
+        /* Do multi-sample to multi-sample scaled 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 single-sample to single-sample scaled 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;
+
+	/* Do multi-sample to single-sample scaled blit */
+	glBindFramebuffer(GL_READ_FRAMEBUFFER, multisampled_fbo_1.handle);
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, singlesampled_fbo.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_NO_ERROR) && 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_NO_ERROR) && pass;
+
+	Config.color_internalformat = GL_RGBA8I;
+	multisampled_fbo_1.setup(Config);
+	singlesampled_fbo.setup(Config);
+
+	/* Do multi-sample integer buffer to single-sample scaled blit */
+	glBindFramebuffer(GL_READ_FRAMEBUFFER, multisampled_fbo_1.handle);
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, singlesampled_fbo.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;
+
+	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
+enum piglit_result
+piglit_display()
+{
+        /* UNREACHED */
+	return PIGLIT_FAIL;
+}
-- 
1.8.1.4



More information about the Piglit mailing list