[Piglit] [PATCH 2/4] arb_vertex_array_bgra: Test all the invalid types
Ian Romanick
idr at freedesktop.org
Fri Feb 7 20:46:03 PST 2014
From: Ian Romanick <ian.d.romanick at intel.com>
Inspired by by code in vertex-array-bgra.c.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
tests/spec/arb_vertex_array_bgra/api-errors.c | 29 ++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/tests/spec/arb_vertex_array_bgra/api-errors.c b/tests/spec/arb_vertex_array_bgra/api-errors.c
index 8000e69..90ac386 100644
--- a/tests/spec/arb_vertex_array_bgra/api-errors.c
+++ b/tests/spec/arb_vertex_array_bgra/api-errors.c
@@ -37,8 +37,18 @@ PIGLIT_GL_TEST_CONFIG_END
void
piglit_init(int argc, char **argv)
{
- static GLuint uints[4] = { 255, 0, 0, 127 };
static GLubyte ubytes[4] = { 255, 0, 0, 127 };
+ static const GLenum invalid_types[] = {
+ GL_BYTE,
+ GL_SHORT,
+ GL_UNSIGNED_SHORT,
+ GL_INT,
+ GL_UNSIGNED_INT,
+ GL_FLOAT,
+ GL_DOUBLE,
+ };
+ unsigned i;
+
bool pass = true;
piglit_require_gl_version(20);
@@ -64,16 +74,17 @@ piglit_init(int argc, char **argv)
* 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);
- pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+ for (i = 0; i < ARRAY_SIZE(invalid_types); i++) {
+ glColorPointer(GL_BGRA, invalid_types[i], 0, NULL);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
- glSecondaryColorPointer(GL_BGRA, GL_UNSIGNED_INT,
- 4 * sizeof(GLuint), NULL);
- pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+ glSecondaryColorPointer(GL_BGRA, invalid_types[i], 0, NULL);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
- glVertexAttribPointer(1, GL_BGRA, GL_UNSIGNED_INT, GL_TRUE,
- 4 * sizeof(GLuint), uints);
- pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+ glVertexAttribPointer(1, GL_BGRA, invalid_types[i], GL_TRUE,
+ 0, NULL);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+ }
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
--
1.8.1.4
More information about the Piglit
mailing list