[Piglit] [PATCH] dlist-multidrawarrays: test that glMultiDrawArrays works in a display list

Brian Paul brianp at vmware.com
Wed Mar 26 16:12:00 PDT 2014


---
 tests/all.py                              |    1 +
 tests/spec/CMakeLists.txt                 |    1 +
 tests/spec/gl-1.4/CMakeLists.gl.txt       |   14 +++
 tests/spec/gl-1.4/CMakeLists.txt          |    1 +
 tests/spec/gl-1.4/dlist-multidrawarrays.c |  169 +++++++++++++++++++++++++++++
 5 files changed, 186 insertions(+)
 create mode 100644 tests/spec/gl-1.4/CMakeLists.gl.txt
 create mode 100644 tests/spec/gl-1.4/CMakeLists.txt
 create mode 100644 tests/spec/gl-1.4/dlist-multidrawarrays.c

diff --git a/tests/all.py b/tests/all.py
index 1eda032..81b912e 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -960,6 +960,7 @@ add_plain_test(gl14, 'fdo25614-genmipmap')
 add_plain_test(gl14, 'tex1d-2dborder')
 add_plain_test(gl14, 'blendminmax')
 add_plain_test(gl14, 'blendsquare')
+add_concurrent_test(gl14, "gl-1.4-dlist-multidrawarrays")
 add_msaa_visual_plain_tests(gl14, 'copy-pixels')
 add_plain_test(gl14, 'draw-batch')
 add_plain_test(gl14, 'stencil-wrap')
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 48baf4f..2bd65b3 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -79,6 +79,7 @@ add_subdirectory (glsl-1.40)
 add_subdirectory (glsl-1.50)
 add_subdirectory (glsl-es-3.00)
 add_subdirectory (gl-1.0)
+add_subdirectory (gl-1.4)
 add_subdirectory (gl-2.0)
 add_subdirectory (gl-2.1)
 add_subdirectory (gl-3.0)
diff --git a/tests/spec/gl-1.4/CMakeLists.gl.txt b/tests/spec/gl-1.4/CMakeLists.gl.txt
new file mode 100644
index 0000000..1b1a16f
--- /dev/null
+++ b/tests/spec/gl-1.4/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 (gl-1.4-dlist-multidrawarrays dlist-multidrawarrays.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/gl-1.4/CMakeLists.txt b/tests/spec/gl-1.4/CMakeLists.txt
new file mode 100644
index 0000000..4a012b9
--- /dev/null
+++ b/tests/spec/gl-1.4/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
\ No newline at end of file
diff --git a/tests/spec/gl-1.4/dlist-multidrawarrays.c b/tests/spec/gl-1.4/dlist-multidrawarrays.c
new file mode 100644
index 0000000..c3d9a19
--- /dev/null
+++ b/tests/spec/gl-1.4/dlist-multidrawarrays.c
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2014 VMware, Inc.
+ *
+ * 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.
+ */
+
+/**
+ * Test glMultiDrawArrays and similar functions in a display list.
+ * glMultiDrawArrays is part of GL 1.4 and later.
+ */
+
+#include "piglit-util-gl-common.h"
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+	config.supports_gl_compat_version = 14;
+	config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static const float verts[][2] = {
+	{ -1.0f, -1.0f },
+	{  1.0f, -1.0f },
+	{  1.0f,  1.0f },
+	{ -1.0f,  1.0f }
+};
+
+
+static const float white[3] = { 1.0f, 1.0f, 1.0f };
+
+
+static bool
+test_list(GLuint list, const char *func)
+{
+	bool pass = true;
+
+	glClear(GL_COLOR_BUFFER_BIT);
+	glCallList(list);
+
+	pass = piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, white);
+
+	piglit_present_results();
+
+	glDeleteLists(list, 1);
+
+	if (!pass)
+		fprintf(stderr, "%s in display list failed\n", func);
+
+	return pass;
+}
+
+
+static bool
+test_MultiDrawArrays(void)
+{
+	GLint first = 0, count = 4;
+	GLuint list;
+
+	list = glGenLists(1);
+	glNewList(list, GL_COMPILE);
+	glEnableClientState(GL_VERTEX_ARRAY);
+	glVertexPointer(2, GL_FLOAT, 0, verts);
+	glMultiDrawArrays(GL_TRIANGLE_FAN, &first, &count, 1);
+	glEndList();
+
+	return test_list(list, "glMultiDrawArrays");
+}
+
+
+static bool
+test_MultiDrawElements(void)
+{
+	const GLushort indices[] = { 3, 2, 1, 0 };
+	const GLushort *multiIndices[] = { indices };
+	GLint count = 4;
+	GLuint list;
+
+	list = glGenLists(1);
+	glNewList(list, GL_COMPILE);
+	glEnableClientState(GL_VERTEX_ARRAY);
+	glVertexPointer(2, GL_FLOAT, 0, verts);
+	glMultiDrawElements(GL_TRIANGLE_FAN, &count, GL_UNSIGNED_SHORT,
+			    (const GLvoid * const *) multiIndices, 1);
+	glEndList();
+
+	return test_list(list, "glMultiDrawElements");
+}
+
+
+static bool
+test_MultiModeDrawArraysIBM(void)
+{
+	GLenum mode = GL_TRIANGLE_FAN;
+	GLint first = 0, count = 4;
+	GLuint list;
+
+	list = glGenLists(1);
+	glNewList(list, GL_COMPILE);
+	glEnableClientState(GL_VERTEX_ARRAY);
+	glVertexPointer(2, GL_FLOAT, 0, verts);
+	glMultiModeDrawArraysIBM(&mode, &first, &count, 1, sizeof(GLenum));
+	glEndList();
+
+	return test_list(list, "glMultiModeDrawArraysIBM");
+}
+
+
+static bool
+test_MultiModeDrawElementsIBM(void)
+{
+	const GLushort indices[] = { 3, 2, 1, 0 };
+	const GLushort *multiIndices[] = { indices };
+	GLenum mode = GL_TRIANGLE_FAN;
+	GLint count = 4;
+	GLuint list;
+
+	list = glGenLists(1);
+	glNewList(list, GL_COMPILE);
+	glEnableClientState(GL_VERTEX_ARRAY);
+	glVertexPointer(2, GL_FLOAT, 0, verts);
+	glMultiModeDrawElementsIBM(&mode, &count, GL_UNSIGNED_SHORT,
+				   (const GLvoid * const *) multiIndices,
+				   1, sizeof(GLenum));
+	glEndList();
+
+	return test_list(list, "glMultiModeDrawElementsIBM");
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+	bool pass = true;
+
+	pass = test_MultiDrawArrays() && pass;
+	pass = test_MultiDrawElements() && pass;
+	if (piglit_is_extension_supported("GL_IBM_multimode_draw_arrays")) {
+		pass = test_MultiModeDrawArraysIBM() && pass;
+		pass = test_MultiModeDrawElementsIBM() && pass;
+	}
+
+	piglit_present_results();
+
+	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+	/* nothing */
+}
-- 
1.7.10.4



More information about the Piglit mailing list