[Piglit] [PATCH 2/2] GL_ARB_ubo: Add a test for the minimum maximums.

Eric Anholt eric at anholt.net
Mon May 14 16:28:28 PDT 2012


This is closely related to the tests in gl-3.1/minmax, but I included
the logic for geometry shaders that isn't in the 3.1 spec.
---
 tests/all.tests                                    |    1 +
 .../arb_uniform_buffer_object/CMakeLists.gl.txt    |    1 +
 tests/spec/arb_uniform_buffer_object/minmax.c      |   99 ++++++++++++++++++++
 3 files changed, 101 insertions(+)
 create mode 100644 tests/spec/arb_uniform_buffer_object/minmax.c

diff --git a/tests/all.tests b/tests/all.tests
index e05ac7b..f1be7cf 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1630,6 +1630,7 @@ arb_uniform_buffer_object['getuniformblockindex'] = concurrent_test('arb_uniform
 arb_uniform_buffer_object['getuniformindices'] = concurrent_test('arb_uniform_buffer_object-getuniformindices')
 arb_uniform_buffer_object['getuniformlocation'] = concurrent_test('arb_uniform_buffer_object-getuniformlocation')
 arb_uniform_buffer_object['layout-std140'] = concurrent_test('arb_uniform_buffer_object-layout-std140')
+arb_uniform_buffer_object['minmax'] = concurrent_test('minmax')
 
 ati_draw_buffers = Group()
 spec['ATI_draw_buffers'] = ati_draw_buffers
diff --git a/tests/spec/arb_uniform_buffer_object/CMakeLists.gl.txt b/tests/spec/arb_uniform_buffer_object/CMakeLists.gl.txt
index c70e340..f0cc977 100644
--- a/tests/spec/arb_uniform_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_uniform_buffer_object/CMakeLists.gl.txt
@@ -16,5 +16,6 @@ add_executable (arb_uniform_buffer_object-getuniformblockindex getuniformblockin
 add_executable (arb_uniform_buffer_object-getuniformindices getuniformindices.c)
 add_executable (arb_uniform_buffer_object-getuniformlocation getuniformlocation.c)
 add_executable (arb_uniform_buffer_object-layout-std140 layout-std140.c)
+add_executable (arb_uniform_buffer_object-minmax minmax.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_uniform_buffer_object/minmax.c b/tests/spec/arb_uniform_buffer_object/minmax.c
new file mode 100644
index 0000000..b004b70
--- /dev/null
+++ b/tests/spec/arb_uniform_buffer_object/minmax.c
@@ -0,0 +1,99 @@
+/* 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 minmax.c
+ *
+ * Test for the minimum maximum values in section 6.2 "State Tables"
+ * of the GL 3.1 spec.
+ */
+
+#include "piglit-util.h"
+#include "minmax-test.h"
+
+int piglit_width = 32;
+int piglit_height = 32;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_ALPHA;
+
+enum piglit_result
+piglit_display(void)
+{
+	/* UNREACHED */
+	return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+	int vuniforms = 0, vblocks = 0;
+	int guniforms = 0, gblocks = 0;
+	int funiforms = 0, fblocks = 0;
+	int blocksize = 0;
+	bool gs = piglit_is_extension_supported("GL_ARB_geometry_shader4");
+
+	piglit_require_extension("GL_ARB_uniform_buffer_object");
+
+	piglit_print_minmax_header();
+
+	piglit_test_min_int(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, 1024);
+
+	piglit_test_min_int(GL_MAX_VERTEX_UNIFORM_BLOCKS, 12);
+	piglit_test_min_int(GL_MAX_FRAGMENT_UNIFORM_BLOCKS, 12);
+	if (gs)
+		piglit_test_min_int(GL_MAX_GEOMETRY_UNIFORM_BLOCKS, 12);
+
+	piglit_test_min_int(GL_MAX_COMBINED_UNIFORM_BLOCKS, gs ? 36 : 24);
+	piglit_test_min_int(GL_MAX_UNIFORM_BUFFER_BINDINGS, gs ? 36 : 24);
+	piglit_test_min_int(GL_MAX_UNIFORM_BLOCK_SIZE, 16384);
+
+	/* Minimum value for OpenGL 3.1 is
+	 * (MAX_<stage>_UNIFORM_BLOCKS * MAX_UNIFORM_BLOCK_SIZE) +
+	 * MAX_<stage>_UNIFORM_COMPONENTS. Minimum value prior to
+	 * OpenGL 3.1 is MAX_<stage>_UNIFORM_COMPONENTS.
+	 */
+	if (piglit_get_gl_version() >= 31) {
+		glGetIntegerv(GL_MAX_VERTEX_UNIFORM_BLOCKS, &vblocks);
+		glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS, &fblocks);
+	}
+	glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &vuniforms);
+	glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &funiforms);
+	glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &blocksize);
+	piglit_test_min_int(GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS,
+			 vblocks * blocksize + vuniforms);
+	piglit_test_min_int(GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS,
+			 fblocks * blocksize + funiforms);
+	if (gs) {
+		if (piglit_get_gl_version() >= 31) {
+			glGetIntegerv(GL_MAX_GEOMETRY_UNIFORM_BLOCKS, &gblocks);
+		}
+		glGetIntegerv(GL_MAX_GEOMETRY_UNIFORM_COMPONENTS, &guniforms);
+
+		piglit_test_min_int(GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS,
+				    gblocks * blocksize + guniforms);
+	}
+
+	piglit_test_min_int(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, 1);
+
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	piglit_report_result(piglit_minmax_pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
-- 
1.7.10



More information about the Piglit mailing list