diff options
author | Carl Worth <cworth@cworth.org> | 2012-12-20 11:00:25 -0800 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2013-01-14 11:38:25 -0800 |
commit | 85d57f649d99ccf3bd787f88fc199d4fa077c773 (patch) | |
tree | 0b7037f0c01057c6f4db05b38f5995a871f91957 | |
parent | 279807dfc48d17a8217fa44b23f5376267397b3c (diff) |
Cleanup occlusion-query test to not require function pointers.
With the current piglit dispatch code, the distinction between things
like glBeginQuery and glBeginQueryARB is taken care of already so the
test can be simplified a bit.
Reviewed-by: Eric Anholt <eric@anholt.net>
-rw-r--r-- | tests/spec/arb_occlusion_query/occlusion_query.c | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/tests/spec/arb_occlusion_query/occlusion_query.c b/tests/spec/arb_occlusion_query/occlusion_query.c index ba35ed0c..e099f069 100644 --- a/tests/spec/arb_occlusion_query/occlusion_query.c +++ b/tests/spec/arb_occlusion_query/occlusion_query.c @@ -43,12 +43,6 @@ PIGLIT_GL_TEST_CONFIG_END #define MAX_QUERIES 5 static GLuint occ_queries[MAX_QUERIES]; -static PFNGLGENQUERIESPROC gen_queries = NULL; -static PFNGLBEGINQUERYPROC begin_query = NULL; -static PFNGLENDQUERYPROC end_query = NULL; -static PFNGLGETQUERYIVPROC get_queryiv = NULL; -static PFNGLGETQUERYOBJECTIVPROC get_query_objectiv = NULL; - static void draw_box(float x, float y, float z, float w, float h) { @@ -113,15 +107,15 @@ static int do_test(float x, int all_at_once) draw_box(x + 20.0f, 20.0f, 0.0f, 55.0f, 55.0f); for (i = 0; i < MAX_QUERIES; i++) { - (*begin_query)(GL_SAMPLES_PASSED, occ_queries[i]); + glBeginQuery(GL_SAMPLES_PASSED, occ_queries[i]); glColor3ubv(tests[i].color); draw_box(x + tests[i].x, tests[i].y, tests[i].z, tests[i].w, tests[i].h); - (*end_query)(GL_SAMPLES_PASSED); + glEndQuery(GL_SAMPLES_PASSED); if (! all_at_once) { - (*get_query_objectiv)(occ_queries[i], - GL_QUERY_RESULT, &passed); + glGetQueryObjectiv(occ_queries[i], + GL_QUERY_RESULT, &passed); test_pass &= check_result(passed, tests[i].expected); } } @@ -129,8 +123,8 @@ static int do_test(float x, int all_at_once) if (all_at_once) { for (i = 0; i < MAX_QUERIES; i++) { - (*get_query_objectiv)(occ_queries[i], GL_QUERY_RESULT, - &passed); + glGetQueryObjectiv(occ_queries[i], GL_QUERY_RESULT, + &passed); test_pass &= check_result(passed, tests[i].expected); } } @@ -166,34 +160,18 @@ piglit_init(int argc, char **argv) glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); - - if (piglit_get_gl_version() >= 15) { - gen_queries = glGenQueries; - begin_query = glBeginQuery; - end_query = glEndQuery; - get_queryiv = glGetQueryiv; - get_query_objectiv = glGetQueryObjectiv; - } else if (piglit_is_extension_supported("GL_ARB_occlusion_query")) { - gen_queries = glGenQueriesARB; - begin_query = glBeginQueryARB; - end_query = glEndQueryARB; - get_queryiv = glGetQueryivARB; - get_query_objectiv = glGetQueryObjectivARB; - } else { - piglit_report_result(PIGLIT_SKIP); - } - + piglit_require_extension("GL_ARB_occlusion_query"); /* It is legal for a driver to support the query API but not have * any query bits. I wonder how many applications actually check for * this case... */ - (*get_queryiv)(GL_SAMPLES_PASSED, GL_QUERY_COUNTER_BITS, + glGetQueryiv(GL_SAMPLES_PASSED, GL_QUERY_COUNTER_BITS, & query_bits); if (query_bits == 0) { piglit_report_result(PIGLIT_SKIP); } - (*gen_queries)(MAX_QUERIES, occ_queries); + glGenQueries(MAX_QUERIES, occ_queries); } |