[Piglit] [PATCH 1/2] arb_vertex_type_10f_10f_11f_rev: add test for api-errors

Chris Forbes chrisf at ijw.co.nz
Thu Nov 7 10:28:14 PST 2013


---
 tests/all.tests                                    |   4 +
 tests/spec/CMakeLists.txt                          |   1 +
 .../CMakeLists.gl.txt                              |  14 ++
 .../arb_vertex_type_10f_11f_11f_rev/CMakeLists.txt |   1 +
 .../arb_vertex_type_10f_11f_11f_rev/api-errors.c   | 213 +++++++++++++++++++++
 5 files changed, 233 insertions(+)
 create mode 100644 tests/spec/arb_vertex_type_10f_11f_11f_rev/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_vertex_type_10f_11f_11f_rev/CMakeLists.txt
 create mode 100644 tests/spec/arb_vertex_type_10f_11f_11f_rev/api-errors.c

diff --git a/tests/all.tests b/tests/all.tests
index f407adb..2f102f4 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2596,6 +2596,10 @@ spec['ARB_vertex_type_2_10_10_10_rev'] = arb_vertex_type_2_10_10_10_rev
 add_plain_test(arb_vertex_type_2_10_10_10_rev, 'draw-vertices-2101010')
 arb_vertex_type_2_10_10_10_rev['attribs'] = concurrent_test('attribs GL_ARB_vertex_type_2_10_10_10_rev')
 
+arb_vertex_type_10f_11f_11f_rev = Group()
+spec['ARB_vertex_type_10f_11f_11f_rev'] = arb_vertex_type_10f_11f_11f_rev
+add_plain_test(arb_vertex_type_10f_11f_11f_rev, 'arb_vertex_type_10f_11f_11f_rev-api-errors')
+
 arb_draw_buffers = Group()
 spec['ARB_draw_buffers'] = arb_draw_buffers
 add_plain_test(arb_draw_buffers, 'arb_draw_buffers-state_change')
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 18b846d..3e48b86 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -78,6 +78,7 @@ add_subdirectory (gles-3.0)
 add_subdirectory (glx_arb_create_context)
 add_subdirectory (glx_ext_import_context)
 add_subdirectory (glx_oml_sync_control)
+add_subdirectory (arb_vertex_type_10f_11f_11f_rev)
 add_subdirectory (arb_vertex_type_2_10_10_10_rev)
 add_subdirectory (ext_texture_array)
 add_subdirectory (ext_texture_integer)
diff --git a/tests/spec/arb_vertex_type_10f_11f_11f_rev/CMakeLists.gl.txt b/tests/spec/arb_vertex_type_10f_11f_11f_rev/CMakeLists.gl.txt
new file mode 100644
index 0000000..02d9314
--- /dev/null
+++ b/tests/spec/arb_vertex_type_10f_11f_11f_rev/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_vertex_type_10f_11f_11f_rev-api-errors api-errors.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/arb_vertex_type_10f_11f_11f_rev/CMakeLists.txt b/tests/spec/arb_vertex_type_10f_11f_11f_rev/CMakeLists.txt
new file mode 100644
index 0000000..144a306
--- /dev/null
+++ b/tests/spec/arb_vertex_type_10f_11f_11f_rev/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_vertex_type_10f_11f_11f_rev/api-errors.c b/tests/spec/arb_vertex_type_10f_11f_11f_rev/api-errors.c
new file mode 100644
index 0000000..09ab431
--- /dev/null
+++ b/tests/spec/arb_vertex_type_10f_11f_11f_rev/api-errors.c
@@ -0,0 +1,213 @@
+/*
+ * Copyright © 2013 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 api-errors.c
+ *
+ * This tests a few error conditions from the ARB_vertex_type_10f_11f_11f_rev extension.
+ */
+
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+	config.supports_gl_compat_version = 30;
+	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+enum piglit_result
+piglit_display()
+{
+	return PIGLIT_FAIL;	/* unreached */
+}
+
+#define TEST(name, err) \
+	do { \
+		if (!piglit_check_gl_error(err)) { \
+			piglit_report_subtest_result(PIGLIT_FAIL, name); \
+			pass = false; \
+		} \
+		else { \
+			piglit_report_subtest_result(PIGLIT_PASS, name); \
+		} \
+	} while(0);
+
+
+static bool
+test_vertex_attrib_format()
+{
+	bool pass = true;
+
+	/* "The error INVALID_OPERATION is generated by VertexAttribFormat, ...
+	 * if <type> is UNSIGNED_INT_10F_11F_11F_REV and <size> is not 3."
+	 */
+
+	glVertexAttribFormat(0, 3, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, 0);
+	TEST("VertexAttribFormat-ok", GL_NO_ERROR);
+
+	glVertexAttribFormat(0, 2, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, 0);
+	TEST("VertexAttribFormat-badsize", GL_INVALID_OPERATION);
+
+	glVertexAttribFormat(0, GL_BGRA, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, 0);
+	TEST("VertexAttribFormat-badsize-bgra", GL_INVALID_OPERATION);
+
+	/* "The error INVALID_ENUM is generated by VertexAttribIFormat,
+	 * VertexAttribLFormat, ...
+	 * if <type> is UNSIGNED_INT_10F_11F_11F_REV."
+	 */
+
+	glVertexAttribIFormat(0, 3, GL_UNSIGNED_INT_10F_11F_11F_REV, 0);
+	TEST("VertexAttribIFormat-not-allowed", GL_INVALID_ENUM);
+
+	glVertexAttribLFormat(0, 3, GL_UNSIGNED_INT_10F_11F_11F_REV, 0);
+	TEST("VertexAttribLFormat-not-allowed", GL_INVALID_ENUM);
+
+	return pass;
+}
+
+
+static bool
+test_legacy_vertex_attribs()
+{
+	bool pass = true;
+
+	/* "The error INVALID_ENUM is generated by VertexPointer, NormalPointer,
+	 *  ColorPointer, SecondaryColorPointer, IndexPointer, EdgeFlagPointer,
+	 *  FogCoordPointer, or TexCoordPointer if <type> is
+	 *  UNSIGNED_INT_10F_11F_11F_REV.
+	 */
+
+	glVertexPointer(3, GL_UNSIGNED_INT_10F_11F_11F_REV, 0, (GLvoid *)0);
+	TEST("VertexPointer-not-allowed", GL_INVALID_ENUM);
+
+	glNormalPointer(GL_UNSIGNED_INT_10F_11F_11F_REV, 0, (GLvoid *)0);
+	TEST("NormalPointer-not-allowed", GL_INVALID_ENUM);
+
+	glColorPointer(3, GL_UNSIGNED_INT_10F_11F_11F_REV, 0, (GLvoid *)0);
+	TEST("ColorPointer-not-allowed", GL_INVALID_ENUM);
+
+	glSecondaryColorPointer(3, GL_UNSIGNED_INT_10F_11F_11F_REV, 0, (GLvoid *)0);
+	TEST("SecondaryColorPointer-not-allowed", GL_INVALID_ENUM);
+
+	glIndexPointer(GL_UNSIGNED_INT_10F_11F_11F_REV, 0, (GLvoid *)0);
+	TEST("IndexPointer-not-allowed", GL_INVALID_ENUM);
+
+	/* spec lists EdgeFlagPointer, but this is a bug -- it does not take a <type> param */
+
+	glFogCoordPointer(GL_UNSIGNED_INT_10F_11F_11F_REV, 0, (GLvoid *)0);
+	TEST("FogCoordPointer-not-allowed", GL_INVALID_ENUM);
+
+	glTexCoordPointer(3, GL_UNSIGNED_INT_10F_11F_11F_REV, 0, (GLvoid *)0);
+	TEST("TexCoordPointer-not-allowed", GL_INVALID_ENUM);
+
+	return pass;
+}
+
+
+static bool
+test_vertex_attribs()
+{
+	bool pass = true;
+	GLuint data = 0;
+
+	/* "The error INVALID_OPERATION is generated by ... , or VertexAttribPointer
+	 * if <type> is UNSIGNED_INT_10F_11F_11F_REV and <size> is not 3.
+	 */
+
+	glVertexAttribPointer(0, 3, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, 0, (GLvoid *)0);
+	TEST("VertexAttribPointer-ok", GL_NO_ERROR);
+
+	glVertexAttribPointer(0, 2, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, 0, (GLvoid *)0);
+	TEST("VertexAttribPointer-badsize", GL_INVALID_OPERATION);
+
+	glVertexAttribPointer(0, GL_BGRA, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, 0, (GLvoid *)0);
+	TEST("VertexAttribPointer-badsize-bgra", GL_INVALID_OPERATION);
+
+	/* The error INVALID_ENUM is generated by .., VertexAttribIPointer,
+	 * VertexAttribLPointer, ... if <type> is UNSIGNED_INT_10F_11F_11F_REV.
+	 */
+
+	glVertexAttribIPointer(0, 3, GL_UNSIGNED_INT_10F_11F_11F_REV, 0, (GLvoid *)0);
+	TEST("VertexAttribIPointer-not-allowed", GL_INVALID_ENUM);
+
+	if (piglit_is_extension_supported("GL_ARB_vertex_attrib_64bit")) {
+		glVertexAttribLPointer(0, 3, GL_UNSIGNED_INT_10F_11F_11F_REV, 0, (GLvoid *)0);
+		TEST("VertexAttribLPointer-not-allowed", GL_INVALID_ENUM);
+	}
+
+	/* The error INVALID_ENUM is generated by ... VertexAttribP4ui, VertexAttribP4uiv
+	 * if <type> is UNSIGNED_INT_10F_11F_11F_REV
+	 */
+
+	glVertexAttribP4ui(0, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, 0);
+	TEST("VertexAttribP4ui-not-allowed", GL_INVALID_ENUM);
+
+	glVertexAttribP4uiv(0, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, &data);
+	TEST("VertexAttribP4uiv-not-allowed", GL_INVALID_ENUM);
+
+	glVertexAttribP1ui(0, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, 0);
+	TEST("VertexAttribP1ui-ok", GL_NO_ERROR);
+
+	glVertexAttribP1uiv(0, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, &data);
+	TEST("VertexAttribP1uiv-ok", GL_NO_ERROR);
+
+	glVertexAttribP2ui(0, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, 0);
+	TEST("VertexAttribP2ui-ok", GL_NO_ERROR);
+
+	glVertexAttribP2uiv(0, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, &data);
+	TEST("VertexAttribP2uiv-ok", GL_NO_ERROR);
+
+	glVertexAttribP3ui(0, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, 0);
+	TEST("VertexAttribP3ui-ok", GL_NO_ERROR);
+
+	glVertexAttribP3uiv(0, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FALSE, &data);
+	TEST("VertexAttribP3uiv-ok", GL_NO_ERROR);
+
+	return pass;
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+	bool pass = true;
+	GLuint bo;
+
+	piglit_require_extension("GL_ARB_vertex_type_2_10_10_10_rev");
+	piglit_require_extension("GL_ARB_vertex_type_10f_11f_11f_rev");
+
+	/* a small temporary bo for tests to work with. content doesn't matter,
+	 * we won't be rendering from it. */
+	glGenBuffers(1, &bo);
+	glBindBuffer(GL_ARRAY_BUFFER, bo);
+	glBufferData(GL_ARRAY_BUFFER, 64, (GLvoid const *)0, GL_STATIC_DRAW);
+
+	if (piglit_is_extension_supported("GL_ARB_vertex_attrib_binding")) {
+		pass = test_vertex_attrib_format() && pass;
+	}
+
+	pass = test_legacy_vertex_attribs() && pass;
+	pass = test_vertex_attribs() && pass;
+
+	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
-- 
1.8.4.2



More information about the Piglit mailing list