diff options
author | Fredrik Höglund <fredrik@kde.org> | 2015-03-22 13:22:35 +0100 |
---|---|---|
committer | Fredrik Höglund <fredrik@kde.org> | 2015-04-02 13:53:54 +0200 |
commit | 9a01bbd30c916e6ab284aaa4073365880c78685b (patch) | |
tree | 0372bdc5c0ae53aa243d8c31dbb29268881774dc | |
parent | 5344756ab174dd996fbd26c96c20c2bc28f4900c (diff) |
dsa/utils: Add check_indexed_vao_param()
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.
Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
-rw-r--r-- | tests/spec/arb_direct_state_access/dsa-utils.c | 17 | ||||
-rw-r--r-- | tests/spec/arb_direct_state_access/dsa-utils.h | 7 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/spec/arb_direct_state_access/dsa-utils.c b/tests/spec/arb_direct_state_access/dsa-utils.c index ec7bb24d8..f065dbc54 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 7bcf0047b..707a9674c 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 |