[Piglit] [PATCH 05/15] arb_tessellation_shader: Test GL limits and default state.

Fabian Bieler fabianbieler at fastmail.fm
Mon Mar 24 15:02:44 PDT 2014


Use glGet*v() to test GL limits and default state introduced by
arb_tessellation_shader.

Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
---
 tests/all.py                                       |   5 +
 tests/spec/CMakeLists.txt                          |   1 +
 .../spec/arb_tessellation_shader/CMakeLists.gl.txt |  14 ++
 tests/spec/arb_tessellation_shader/CMakeLists.txt  |   1 +
 tests/spec/arb_tessellation_shader/get.c           | 146 +++++++++++++++++++++
 5 files changed, 167 insertions(+)
 create mode 100644 tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_tessellation_shader/CMakeLists.txt
 create mode 100644 tests/spec/arb_tessellation_shader/get.c

diff --git a/tests/all.py b/tests/all.py
index 50d6b65..48e158a 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1435,6 +1435,11 @@ arb_point_sprite = Group()
 spec['ARB_point_sprite'] = arb_point_sprite
 add_plain_test(arb_point_sprite, 'point-sprite')
 
+# Group ARB_tessellation_shader
+arb_tessellation_shader = Group()
+spec['ARB_tessellation_shader'] = arb_tessellation_shader
+add_concurrent_test(arb_tessellation_shader, 'arb_tessellation_shader-get')
+
 # Group ARB_texture_multisample
 samplers_atm = ['sampler2DMS', 'isampler2DMS', 'usampler2DMS',
 				'sampler2DMSArray', 'isampler2DMSArray', 'usampler2DMSArray']
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index eb3fd51..dce9849 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -37,6 +37,7 @@ add_subdirectory (arb_stencil_texturing)
 add_subdirectory (arb_sync)
 add_subdirectory (arb_uniform_buffer_object)
 add_subdirectory (ati_draw_buffers)
+add_subdirectory (arb_tessellation_shader)
 add_subdirectory (arb_texture_buffer_object)
 add_subdirectory (arb_texture_buffer_range)
 add_subdirectory (arb_texture_compression)
diff --git a/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt b/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
new file mode 100644
index 0000000..60419a9
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/CMakeLists.gl.txt
@@ -0,0 +1,14 @@
+include_directories(
+	${GLEXT_INCLUDE_DIR}
+	${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+	piglitutil_${piglit_target_api}
+	${OPENGL_gl_LIBRARY}
+	${OPENGL_glu_LIBRARY}
+)
+
+piglit_add_executable (arb_tessellation_shader-get get.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/arb_tessellation_shader/CMakeLists.txt b/tests/spec/arb_tessellation_shader/CMakeLists.txt
new file mode 100644
index 0000000..4a012b9
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
\ No newline at end of file
diff --git a/tests/spec/arb_tessellation_shader/get.c b/tests/spec/arb_tessellation_shader/get.c
new file mode 100644
index 0000000..865ba87
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/get.c
@@ -0,0 +1,146 @@
+/*
+ * Copyright © 2014 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 get.c
+ *
+ * Test limits and default state.
+ */
+
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_compat_version = 32;
+	config.supports_gl_core_version = 32;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static bool
+test_limits(void)
+{
+	bool pass = true;
+	int i, v;
+	static const struct {
+		GLenum name;
+		int min;
+	} limits[] = {
+		{GL_MAX_TESS_GEN_LEVEL, 64},
+		{GL_MAX_PATCH_VERTICES, 32},
+		{GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS, 1024},
+		{GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS, 1024},
+		{GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS, 16},
+		{GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS, 16},
+		{GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS, 128},
+		{GL_MAX_TESS_PATCH_COMPONENTS, 120},
+		{GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS, 4096},
+		{GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS, 128},
+		{GL_MAX_TESS_CONTROL_INPUT_COMPONENTS, 128},
+		{GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS, 128},
+		{GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS, 12},
+		{GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS, 12},
+		{GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS, 1024 + 12 * (16384/4)},
+		{GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS, 1024 + 12 * (16384/4)},
+	};
+
+	for (i = 0; i < ARRAY_SIZE(limits); ++i) {
+		glGetIntegerv(limits[i].name, &v);
+		if (v < limits[i].min) {
+			fprintf(stderr, "%s to small: %d < %d\n",
+				piglit_get_gl_enum_name(limits[i].name),
+				v, limits[i].min);
+			pass = false;
+		}
+	}
+
+	return pass;
+}
+
+
+static bool
+test_default_state(void)
+{
+	bool pass = true;
+	int v;
+	float f[4];
+
+	glGetIntegerv(GL_PATCH_VERTICES, &v);
+	if (v != 3) {
+		fprintf(stderr, "default of GL_PATCH_VERTICES wrong: %d "
+			"(expected 3)\n", v);
+		pass = false;
+	}
+
+	memset(f, 0, sizeof(f));
+	glGetFloatv(GL_PATCH_DEFAULT_OUTER_LEVEL, f);
+	if (f[0] != 1.0 || f[1] != 1.0 || f[2] != 1.0 || f[3] != 1.0) {
+		fprintf(stderr, "default of GL_PATCH_DEFAULT_OUTER_LEVEL wrong: "
+			"(%f, %f, %f, %f) (expected (1.0, 1.0, 1.0, 1.0))\n",
+			f[0], f[1], f[2], f[3]);
+		pass = false;
+	}
+
+	memset(f, 0, sizeof(f));
+	/* Set some random values to check for excess writes. */
+	f[2] = 0.125; f[3] = 4000.0;
+	glGetFloatv(GL_PATCH_DEFAULT_INNER_LEVEL, f);
+	if (f[2] != 0.125 || f[3] != 4000.0) {
+		fprintf(stderr, "glGetFloatv(GL_PATCH_DEFAULT_INNER_LEVEL) "
+			"returned excess data\n");
+		pass = false;
+	}
+	if (f[0] != 1.0 || f[1] != 1.0) {
+		fprintf(stderr, "default of GL_PATCH_DEFAULT_INNER_LEVEL wrong: "
+			"(%f, %f) (expected (1.0, 1.0))\n",
+			f[0], f[1]);
+		pass = false;
+	}
+
+	return pass;
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+	bool pass = true;
+
+	piglit_require_extension("GL_ARB_tessellation_shader");
+
+	pass = test_limits() && pass;
+
+	pass = test_default_state() && pass;
+
+	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+	return PIGLIT_PASS;
+}
+
-- 
1.8.3.2



More information about the Piglit mailing list