[Piglit] [PATCH] arb_viewport_array: Clear with many scissor rectangles set

Ian Romanick idr at freedesktop.org
Fri Jan 17 11:30:43 PST 2014


From: Ian Romanick <ian.d.romanick at intel.com>

Set the scissor rectangle for all of the possible viewports to different
values, and verify that only the scissor rectangle for viewport 0
affects the clear.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 tests/all.py                                    |  1 +
 tests/spec/arb_viewport_array/CMakeLists.gl.txt |  1 +
 tests/spec/arb_viewport_array/clear.c           | 84 +++++++++++++++++++++++++
 3 files changed, 86 insertions(+)
 create mode 100644 tests/spec/arb_viewport_array/clear.c

diff --git a/tests/all.py b/tests/all.py
index f81765c..abadb1f 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2140,6 +2140,7 @@ arb_viewport_array['minmax'] = concurrent_test('arb_viewport_array-minmax')
 arb_viewport_array['render-viewport'] = concurrent_test('arb_viewport_array-render-viewport')
 arb_viewport_array['render-depthrange'] = concurrent_test('arb_viewport_array-render-depthrange')
 arb_viewport_array['render-scissor'] = concurrent_test('arb_viewport_array-render-scissor')
+arb_viewport_array['clear'] =  PlainExecTest(['ab_viewport_array-clear', '-auto', '-fbo'])
 
 nv_vertex_program = Group()
 spec['NV_vertex_program'] = nv_vertex_program
diff --git a/tests/spec/arb_viewport_array/CMakeLists.gl.txt b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
index 7cf98ff..485334d 100644
--- a/tests/spec/arb_viewport_array/CMakeLists.gl.txt
+++ b/tests/spec/arb_viewport_array/CMakeLists.gl.txt
@@ -9,6 +9,7 @@ link_libraries(
 	${OPENGL_glu_LIBRARY}
 	)
 
+piglit_add_executable(arb_viewport_array-clear clear.c)
 piglit_add_executable(arb_viewport_array-viewport-indices viewport_indices.c)
 piglit_add_executable(arb_viewport_array-depthrange-indices depth_range_indices.c)
 piglit_add_executable(arb_viewport_array-scissor-check scissor_check.c)
diff --git a/tests/spec/arb_viewport_array/clear.c b/tests/spec/arb_viewport_array/clear.c
new file mode 100644
index 0000000..f316b22
--- /dev/null
+++ b/tests/spec/arb_viewport_array/clear.c
@@ -0,0 +1,84 @@
+/*
+ * 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 clear.c
+ * Verify that glClear uses the scissor rectangle from viewport 0.
+ */
+
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_compat_version = 10;
+	config.supports_gl_core_version = 31;
+
+	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLint num_viewports;
+
+void
+piglit_init(int argc, char **argv)
+{
+	piglit_require_extension("GL_ARB_viewport_array");
+	glGetIntegerv(GL_MAX_VIEWPORTS, &num_viewports);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+	static const float expected[] = {
+		0.f, 1.f, 0.f, 1.f
+	};
+
+	const int slice_height = (piglit_height + num_viewports - 2)
+		/ (num_viewports - 1);
+
+	bool pass = false;
+	int i;
+
+	glDisable(GL_SCISSOR_TEST);
+	glClearColor(0., 0., 0., 0.);
+	glClear(GL_COLOR_BUFFER_BIT);
+
+	glScissorIndexed(0, 0, 0, piglit_width, piglit_height);
+	glEnablei(GL_SCISSOR_TEST, 0);
+
+	for (i = 1; i < num_viewports; i++) {
+		glEnablei(GL_SCISSOR_TEST, i);
+		glScissorIndexed(i,
+				 0, i * slice_height,
+				 piglit_width, slice_height);
+	}
+
+	glClearColor(0., 1., 0., 1.);
+	glClear(GL_COLOR_BUFFER_BIT);
+
+	pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
+				      expected);
+
+	piglit_present_results();
+	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
-- 
1.8.1.4



More information about the Piglit mailing list