[Piglit] [PATCH 2/3] arb_vertex_array_object: Add IsVertexArray() test

Matt Turner mattst88 at gmail.com
Thu Dec 20 19:45:50 PST 2012


---
 tests/all.tests                                    |    4 +
 tests/spec/CMakeLists.txt                          |    1 +
 .../spec/arb_vertex_array_object/CMakeLists.gl.txt |   13 +++
 tests/spec/arb_vertex_array_object/CMakeLists.txt  |    1 +
 tests/spec/arb_vertex_array_object/isvertexarray.c |   88 ++++++++++++++++++++
 5 files changed, 107 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/arb_vertex_array_object/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_vertex_array_object/CMakeLists.txt
 create mode 100644 tests/spec/arb_vertex_array_object/isvertexarray.c

diff --git a/tests/all.tests b/tests/all.tests
index 05af572..589c4cc 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2632,6 +2632,10 @@ ext_unpack_subimage = Group()
 spec['EXT_unpack_subimage'] = ext_unpack_subimage
 ext_unpack_subimage['basic'] = concurrent_test('ext_unpack_subimage')
 
+arb_vertex_array_object = Group()
+spec['ARB_vertex_array_object'] = arb_vertex_array_object
+arb_vertex_array_object['isvertexarray'] = concurrent_test('arb_vertex_array_object_isvertexarray')
+
 oes_draw_texture = Group()
 spec['OES_draw_texture'] = oes_draw_texture
 oes_draw_texture['oes_draw_texture'] = concurrent_test('oes_draw_texture')
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 1817c9f..9ec37fa 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -64,3 +64,4 @@ add_subdirectory (arb_draw_buffers)
 add_subdirectory (oes_draw_texture)
 add_subdirectory (arb_blend_func_extended)
 add_subdirectory (ext_unpack_subimage)
+add_subdirectory (arb_vertex_array_object)
diff --git a/tests/spec/arb_vertex_array_object/CMakeLists.gl.txt b/tests/spec/arb_vertex_array_object/CMakeLists.gl.txt
new file mode 100644
index 0000000..836ac52
--- /dev/null
+++ b/tests/spec/arb_vertex_array_object/CMakeLists.gl.txt
@@ -0,0 +1,13 @@
+include_directories(
+	${GLEXT_INCLUDE_DIR}
+	${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+	piglitutil_${piglit_target_api}
+	${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (arb_vertex_array-isvertexarray isvertexarray.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/arb_vertex_array_object/CMakeLists.txt b/tests/spec/arb_vertex_array_object/CMakeLists.txt
new file mode 100644
index 0000000..144a306
--- /dev/null
+++ b/tests/spec/arb_vertex_array_object/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_vertex_array_object/isvertexarray.c b/tests/spec/arb_vertex_array_object/isvertexarray.c
new file mode 100644
index 0000000..8624ae4
--- /dev/null
+++ b/tests/spec/arb_vertex_array_object/isvertexarray.c
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+#include "piglit-util-gl-common.h"
+
+/**
+ * @file isvertexarray.c
+ *
+ * Tests basic API support for glIsVertexArray().
+ *
+ * From the ARB_vertex_array_object spec:
+ *
+ *     "The command
+ *
+ *         void GenVertexArrays(sizei n, uint *arrays);
+ *
+ *      returns <n> previous unused vertex array object names in <arrays>. These
+ *      names are marked as used, for the purposes of GenVertexArrays only, but
+ *      they acquire array state only when they are first bound.
+ *
+ *      [...]
+ *
+ *      A vertex array object is created by binding a name returned by
+ *      GenVertexArrays with the command
+ *
+ *         void BindVertexArray(uint array);"
+ */
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_compat_version = 10;
+
+	config.window_width = 32;
+	config.window_height = 32;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+	/* UNREACHED */
+	return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+	GLuint id;
+
+	piglit_require_gl_version(15);
+	piglit_require_extension("GL_ARB_vertex_array_object");
+
+	glGenVertexArrays(1, &id);
+
+	if (glIsVertexArray(id)) {
+		fprintf(stderr, "id recognized incorrectly as a vertex array object.\n");
+		piglit_report_result(PIGLIT_FAIL);
+	}
+
+	glBindVertexArray(id);
+
+	if (!glIsVertexArray(id)) {
+		fprintf(stderr, "id not recognized correctly as a vertex array object.\n");
+		piglit_report_result(PIGLIT_FAIL);
+	}
+
+	piglit_report_result(PIGLIT_PASS);
+}
-- 
1.7.8.6



More information about the Piglit mailing list