[Piglit] [PATCH 01/14] dsa/utils: Add check_indexed_vao_param()
Fredrik Höglund
fredrik at kde.org
Tue Mar 31 10:26:33 PDT 2015
This function returns true if the given parameter matches the expected
value, and false otherwise.
An error message is printed if the parameter value doesn't match the
expected value.
---
tests/spec/arb_direct_state_access/dsa-utils.c | 17 +++++++++++++++++
tests/spec/arb_direct_state_access/dsa-utils.h | 7 +++++++
2 files changed, 24 insertions(+)
diff --git a/tests/spec/arb_direct_state_access/dsa-utils.c b/tests/spec/arb_direct_state_access/dsa-utils.c
index ec7bb24..f065dbc 100644
--- a/tests/spec/arb_direct_state_access/dsa-utils.c
+++ b/tests/spec/arb_direct_state_access/dsa-utils.c
@@ -77,3 +77,20 @@ dsa_texture_with_unit(GLuint unit)
{
glUniform1i(dsa_uniform, unit);
}
+
+bool
+check_indexed_vao_param_(GLuint vao, GLuint index, GLuint param,
+ GLuint expected, const char *file, int line)
+{
+ GLuint value;
+ glGetVertexArrayIndexediv(vao, index, param, (GLint *) &value);
+
+ if (value != expected) {
+ fprintf(stderr, "%s[%u] was %u, expected %u (%s:%d)\n",
+ piglit_get_gl_enum_name(param),
+ index, value, expected, file, line);
+ return false;
+ }
+
+ return true;
+}
diff --git a/tests/spec/arb_direct_state_access/dsa-utils.h b/tests/spec/arb_direct_state_access/dsa-utils.h
index 7bcf004..707a967 100644
--- a/tests/spec/arb_direct_state_access/dsa-utils.h
+++ b/tests/spec/arb_direct_state_access/dsa-utils.h
@@ -59,6 +59,13 @@ void dsa_init_program(void);
void dsa_texture_with_unit(GLuint);
+bool check_indexed_vao_param_(GLuint vao, GLuint index, GLuint param,
+ GLuint expected, const char *file, int line);
+
+#define check_indexed_vao_param(vao, index, param, expected) \
+ check_indexed_vao_param_(vao, index, param, expected, \
+ __FILE__, __LINE__)
+
#ifdef __cplusplus
} /* end extern "C" */
#endif
--
2.1.4
More information about the Piglit
mailing list