[Piglit] [PATCH] Add a test for API errors when GL_BGRA vertex arrays.
Kenneth Graunke
kenneth at whitecape.org
Sun Jul 14 23:16:32 PDT 2013
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
tests/all.tests | 2 +
tests/spec/CMakeLists.txt | 1 +
tests/spec/arb_vertex_array_bgra/CMakeLists.gl.txt | 14 ++++
tests/spec/arb_vertex_array_bgra/CMakeLists.txt | 1 +
tests/spec/arb_vertex_array_bgra/api-errors.c | 85 ++++++++++++++++++++++
5 files changed, 103 insertions(+)
create mode 100644 tests/spec/arb_vertex_array_bgra/CMakeLists.gl.txt
create mode 100644 tests/spec/arb_vertex_array_bgra/CMakeLists.txt
create mode 100644 tests/spec/arb_vertex_array_bgra/api-errors.c
These error conditions are also mandated by the EXT version of the spec,
so I could have written it against that. Not sure which is preferable...
diff --git a/tests/all.tests b/tests/all.tests
index 2a5fbd0..251757f 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1385,6 +1385,8 @@ add_plain_test(apple_vertex_array_object, 'vao-01')
add_plain_test(apple_vertex_array_object, 'vao-02')
apple_vertex_array_object['isvertexarray'] = concurrent_test('arb_vertex_array-isvertexarray apple')
+profile.test_list['ARB_vertex_array_bgra/api-errors'] = PlainExecTest('arb_vertex_array_bgra-api-errors -auto')
+
arb_vertex_array_object = Group()
spec['ARB_vertex_array_object'] = arb_vertex_array_object
add_concurrent_test(arb_vertex_array_object, 'vao-element-array-buffer')
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index e6cd6d2..9163d85 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -46,6 +46,7 @@ add_subdirectory (oes_compressed_etc1_rgb8_texture)
add_subdirectory (oes_compressed_paletted_texture)
add_subdirectory (arb_draw_elements_base_vertex)
add_subdirectory (arb_fragment_program)
+add_subdirectory (arb_vertex_array_bgra)
add_subdirectory (arb_vertex_buffer_object)
add_subdirectory (arb_vertex_program)
add_subdirectory (arb_copy_buffer)
diff --git a/tests/spec/arb_vertex_array_bgra/CMakeLists.gl.txt b/tests/spec/arb_vertex_array_bgra/CMakeLists.gl.txt
new file mode 100644
index 0000000..3f3579b
--- /dev/null
+++ b/tests/spec/arb_vertex_array_bgra/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_array_bgra-api-errors api-errors.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/arb_vertex_array_bgra/CMakeLists.txt b/tests/spec/arb_vertex_array_bgra/CMakeLists.txt
new file mode 100644
index 0000000..144a306
--- /dev/null
+++ b/tests/spec/arb_vertex_array_bgra/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_vertex_array_bgra/api-errors.c b/tests/spec/arb_vertex_array_bgra/api-errors.c
new file mode 100644
index 0000000..7100a78
--- /dev/null
+++ b/tests/spec/arb_vertex_array_bgra/api-errors.c
@@ -0,0 +1,85 @@
+/*
+ * 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 bgra-errors.c
+ *
+ * This tests a few error conditions from the ARB_vertex_array_bgra extension.
+ */
+
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+ config.supports_gl_compat_version = 10;
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+check_invalid_value()
+{
+ if (!piglit_check_gl_error(GL_INVALID_VALUE))
+ piglit_report_result(PIGLIT_FAIL);
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ static GLuint uints[4] = { 255, 0, 0, 127 };
+ static GLubyte ubytes[4] = { 255, 0, 0, 127 };
+
+ piglit_require_gl_version(20);
+ piglit_require_extension("GL_ARB_vertex_array_bgra");
+
+ /* From the GL_ARB_vertex_array_bgra specification:
+ * "The error INVALID_VALUE is generated by VertexAttribPointer if
+ * size is BGRA and normalized is FALSE."
+ */
+ glVertexAttribPointer(1, GL_BGRA, GL_UNSIGNED_BYTE, GL_FALSE,
+ 4 * sizeof(GLubyte), ubytes);
+ check_invalid_value();
+
+ /* From the GL_ARB_vertex_array_bgra specification:
+ * "The error INVALID_VALUE is generated when ColorPointer,
+ * SecondaryPointer, or VertexAttribPointer is called with size
+ * set to BGRA and type is not UNSIGNED_BYTE."
+ */
+ glColorPointer(GL_BGRA, GL_UNSIGNED_INT, 4 * sizeof(GLuint), NULL);
+ check_invalid_value();
+
+ glSecondaryColorPointer(GL_BGRA, GL_UNSIGNED_INT,
+ 4 * sizeof(GLuint), NULL);
+ check_invalid_value();
+
+ glVertexAttribPointer(1, GL_BGRA, GL_UNSIGNED_INT, GL_TRUE,
+ 4 * sizeof(GLuint), uints);
+ check_invalid_value();
+
+ piglit_report_result(PIGLIT_PASS);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+ /* Should never get here. */
+ return PIGLIT_FAIL;
+}
--
1.8.3.2
More information about the Piglit
mailing list