[Piglit] [PATCH 03/12] Add minmax test for ARB_compute_shader.

Paul Berry stereotype441 at gmail.com
Thu Jan 9 10:59:54 PST 2014


---
 tests/all.tests                                 |  1 +
 tests/spec/CMakeLists.txt                       |  1 +
 tests/spec/arb_compute_shader/CMakeLists.gl.txt | 15 ++++++
 tests/spec/arb_compute_shader/CMakeLists.txt    |  1 +
 tests/spec/arb_compute_shader/minmax.c          | 71 +++++++++++++++++++++++++
 tests/util/minmax-test.c                        | 24 +++++++++
 tests/util/minmax-test.h                        |  2 +
 7 files changed, 115 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_compute_shader/CMakeLists.txt
 create mode 100644 tests/spec/arb_compute_shader/minmax.c

diff --git a/tests/all.tests b/tests/all.tests
index 29d012b..91a9450 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2783,6 +2783,7 @@ import_glsl_parser_tests(spec['ARB_geometry_shader4'],
 
 arb_compute_shader = Group()
 spec['ARB_compute_shader'] = arb_compute_shader
+arb_compute_shader['minmax'] = concurrent_test('arb_compute_shader-minmax')
 import_glsl_parser_tests(spec['ARB_compute_shader'],
                          os.path.join(testsDir, 'spec', 'arb_compute_shader'),
                          ['compiler'])
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 7f6bf47..d49872a 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -1,6 +1,7 @@
 add_subdirectory (amd_performance_monitor)
 add_subdirectory (arb_base_instance)
 add_subdirectory (arb_color_buffer_float)
+add_subdirectory (arb_compute_shader)
 add_subdirectory (arb_debug_output)
 add_subdirectory (khr_debug)
 add_subdirectory (arb_depth_clamp)
diff --git a/tests/spec/arb_compute_shader/CMakeLists.gl.txt b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
new file mode 100644
index 0000000..b79cbf9
--- /dev/null
+++ b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
@@ -0,0 +1,15 @@
+include_directories(
+	${GLEXT_INCLUDE_DIR}
+	${OPENGL_INCLUDE_PATH}
+	${piglit_SOURCE_DIR}/tests/util
+)
+
+link_libraries (
+	piglitutil_${piglit_target_api}
+	${OPENGL_gl_LIBRARY}
+	${OPENGL_glu_LIBRARY}
+)
+
+add_executable (arb_compute_shader-minmax minmax.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/arb_compute_shader/CMakeLists.txt b/tests/spec/arb_compute_shader/CMakeLists.txt
new file mode 100644
index 0000000..144a306
--- /dev/null
+++ b/tests/spec/arb_compute_shader/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_compute_shader/minmax.c b/tests/spec/arb_compute_shader/minmax.c
new file mode 100644
index 0000000..9df6d9b
--- /dev/null
+++ b/tests/spec/arb_compute_shader/minmax.c
@@ -0,0 +1,71 @@
+/*
+ * 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
+ *
+ * Test for the minimum maximum values specified in the
+ * ARB_compute_shader extension.
+ */
+
+#include "piglit-util-gl-common.h"
+#include "minmax-test.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_compat_version = 10;
+	config.supports_gl_core_version = 31;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+	/* UNREACHED */
+	return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+	piglit_require_extension("GL_ARB_compute_shader");
+	piglit_print_minmax_header();
+
+	piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 0, 65535);
+	piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 1, 65535);
+	piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 2, 65535);
+	piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 0, 1024);
+	piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 1, 1024);
+	piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 2, 64);
+	piglit_test_min_int(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, 1024);
+	piglit_test_min_int(GL_MAX_COMPUTE_UNIFORM_BLOCKS, 12);
+	piglit_test_min_int(GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS, 16);
+	piglit_test_min_int(GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS, 8);
+	piglit_test_min_int(GL_MAX_COMPUTE_ATOMIC_COUNTERS, 8);
+	piglit_test_min_int(GL_MAX_COMPUTE_SHARED_MEMORY_SIZE, 32768);
+	piglit_test_min_int(GL_MAX_COMPUTE_UNIFORM_COMPONENTS, 512);
+	piglit_test_min_int(GL_MAX_COMPUTE_IMAGE_UNIFORMS, 8);
+
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+	piglit_report_result(piglit_minmax_pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
diff --git a/tests/util/minmax-test.c b/tests/util/minmax-test.c
index 1cb8ab9..400c10e 100644
--- a/tests/util/minmax-test.c
+++ b/tests/util/minmax-test.c
@@ -113,6 +113,20 @@ piglit_test_int(GLenum token, GLint limit, bool max)
 }
 
 static void
+piglit_test_int_v(GLenum token, GLuint index, GLint limit, bool max)
+{
+	char *name;
+	GLint val = 9999;
+	asprintf(&name, "%s[%d]", piglit_get_gl_enum_name(token), index);
+
+	glGetIntegeri_v(token, index, &val);
+
+	piglit_report_int(name, limit, val,
+			  (max && val <= limit) ||
+			  (!max && val >= limit));
+}
+
+static void
 piglit_test_uint(GLenum token, GLuint limit, bool max)
 {
 	const char *name = piglit_get_gl_enum_name(token);
@@ -166,6 +180,16 @@ piglit_test_uint64(GLenum token, GLuint64 limit, bool max)
 }
 #endif /* !PIGLIT_USE_OPENGL_ES2 */
 
+void piglit_test_min_int_v(GLenum token, GLuint index, GLint min)
+{
+	piglit_test_int_v(token, index, min, false);
+}
+
+void piglit_test_max_int_v(GLenum token, GLuint index, GLint max)
+{
+	piglit_test_int_v(token, index, max, true);
+}
+
 void piglit_test_min_int(GLenum token, GLint min)
 {
 	piglit_test_int(token, min, false);
diff --git a/tests/util/minmax-test.h b/tests/util/minmax-test.h
index 1206716..e1ce551 100644
--- a/tests/util/minmax-test.h
+++ b/tests/util/minmax-test.h
@@ -25,6 +25,8 @@ extern bool piglit_minmax_pass;
 void piglit_print_minmax_header(void);
 void piglit_test_min_int(GLenum token, GLint val);
 void piglit_test_max_int(GLenum token, GLint val);
+void piglit_test_min_int_v(GLenum token, GLuint index, GLint val);
+void piglit_test_max_int_v(GLenum token, GLuint index, GLint val);
 void piglit_test_min_uint(GLenum token, GLuint val);
 void piglit_test_max_uint(GLenum token, GLuint val);
 void piglit_test_min_float(GLenum token, GLfloat val);
-- 
1.8.5.2



More information about the Piglit mailing list