EGL functions has to be called before dispatch can be initialized making function pointers chicked-egg problem for resolving. But there is no need for runtime selection of resolving functions so we can drop functions pointers.
Signed-off-by: Pauli Nieminen <[email protected]> --- tests/util/piglit-dispatch-init.c | 26 +++++++++++--------------- tests/util/piglit-dispatch.c | 37 +------------------------------------ tests/util/piglit-dispatch.h | 6 ++++++ tests/util/piglit-util-core.h | 19 +------------------ 4 files changed, 19 insertions(+), 69 deletions(-) diff --git a/tests/util/piglit-dispatch-init.c b/tests/util/piglit-dispatch-init.c index dbe9842..ad83528 100644 --- a/tests/util/piglit-dispatch-init.c +++ b/tests/util/piglit-dispatch-init.c @@ -59,8 +59,8 @@ * piglit test from the burden of having to pre-check whether the * implementation supports the functionality being tested. */ -static void -default_unsupported(const char *name) +void +unsupported(const char *name) { printf("Function \"%s\" not supported on this implementation\n", name); piglit_report_result(PIGLIT_SKIP); @@ -74,8 +74,8 @@ default_unsupported(const char *name) * GetProcAddress() for functions that the implementation claims to * support. So if it does happen we terminate the test with a FAIL. */ -static void -default_get_proc_address_failure(const char *function_name) +void +get_proc_address_failure(const char *function_name) { printf("GetProcAddress failed for \"%s\"\n", function_name); piglit_report_result(PIGLIT_FAIL); @@ -88,7 +88,7 @@ default_get_proc_address_failure(const char *function_name) * functions, and core GL functions for GL versions above 1.3, on * Windows. */ -static piglit_dispatch_function_ptr +piglit_dispatch_function_ptr get_ext_proc_address(const char *function_name) { #ifdef USE_WAFFLE @@ -104,7 +104,7 @@ get_ext_proc_address(const char *function_name) * This function is used to retrieve the address of core GL functions * on windows. */ -static piglit_dispatch_function_ptr +piglit_dispatch_function_ptr get_core_proc_address(const char *function_name, int gl_10x_version) { /* Try first to resolve egl core functions with dlsym */ @@ -135,7 +135,7 @@ get_core_proc_address(const char *function_name, int gl_10x_version) * This function is used to retrieve the address of all GL functions * on Apple. */ -static piglit_dispatch_function_ptr +piglit_dispatch_function_ptr get_ext_proc_address(const char *function_name) { static const char *opengl_path = @@ -157,7 +157,7 @@ get_ext_proc_address(const char *function_name) * This function is used to retrieve the address of core GL functions * on Apple. */ -static piglit_dispatch_function_ptr +piglit_dispatch_function_ptr get_core_proc_address(const char *function_name, int gl_10x_version) { /* We don't need to worry about the GL version, since on Apple @@ -174,7 +174,7 @@ get_core_proc_address(const char *function_name, int gl_10x_version) * This function is used to retrieve the address of all GL functions * on Linux. */ -static piglit_dispatch_function_ptr +piglit_dispatch_function_ptr get_ext_proc_address(const char *function_name) { #ifdef USE_WAFFLE @@ -190,7 +190,7 @@ get_ext_proc_address(const char *function_name) * This function is used to retrieve the address of core GL functions * on Linux. */ -static piglit_dispatch_function_ptr +piglit_dispatch_function_ptr get_core_proc_address(const char *function_name, int gl_10x_version) { /* We don't need to worry about the GL version, since on Apple @@ -233,11 +233,7 @@ piglit_dispatch_default_init() if (already_initialized) return; - piglit_dispatch_init(PIGLIT_DISPATCH_GL, - get_core_proc_address, - get_ext_proc_address, - default_unsupported, - default_get_proc_address_failure); + piglit_dispatch_init(); already_initialized = true; } diff --git a/tests/util/piglit-dispatch.c b/tests/util/piglit-dispatch.c index 48e03ff..904acc9 100644 --- a/tests/util/piglit-dispatch.c +++ b/tests/util/piglit-dispatch.c @@ -28,30 +28,6 @@ #endif /* Global state maintained by the Piglit dispatch mechanism: */ - -/** - * Which function to call to get the address of a core function. - */ -static piglit_get_core_proc_address_function_ptr get_core_proc_address = NULL; - -/** - * Which function to call to get the address of a function defined in - * an extension. - */ -static piglit_get_ext_proc_address_function_ptr get_ext_proc_address = NULL; - -/** - * Which function to call if the test attempts to call a function that - * is not supported by the implementation. - */ -static piglit_error_function_ptr unsupported = NULL; - -/** - * Which function to call if get_core_proc_address or - * get_ext_proc_address returns NULL. - */ -static piglit_error_function_ptr get_proc_address_failure = NULL; - /** * The GL version extracted from glGetString(GL_VERSION), times 10. * For example, if the GL version is 2.1, the value 21 is stored here. @@ -167,19 +143,8 @@ check_extension(const char *name) * get_core_proc() or get_ext_proc(). */ void -piglit_dispatch_init(piglit_dispatch_api api, - piglit_get_core_proc_address_function_ptr get_core_proc, - piglit_get_ext_proc_address_function_ptr get_ext_proc, - piglit_error_function_ptr unsupported_proc, - piglit_error_function_ptr failure_proc) +piglit_dispatch_init(void) { - (void) api; /* Not yet implemented--assume GL. */ - - get_core_proc_address = get_core_proc; - get_ext_proc_address = get_ext_proc; - unsupported = unsupported_proc; - get_proc_address_failure = failure_proc; - /* No need to reset the dispatch pointers the first time */ if (is_initialized) { reset_dispatch_pointers(); diff --git a/tests/util/piglit-dispatch.h b/tests/util/piglit-dispatch.h index adc01e4..6979a14 100644 --- a/tests/util/piglit-dispatch.h +++ b/tests/util/piglit-dispatch.h @@ -110,6 +110,12 @@ typedef void (APIENTRY *piglit_dispatch_function_ptr)(void); piglit_dispatch_function_ptr piglit_dispatch_resolve_function(const char *name); +void unsupported(const char *name); +void get_proc_address_failure(const char *function_name); +piglit_dispatch_function_ptr get_core_proc_address(const char *function_name, + int gl_10x_version); +piglit_dispatch_function_ptr get_ext_proc_address(const char *function_name); + #include "generated_dispatch.h" void piglit_dispatch_default_init(); diff --git a/tests/util/piglit-util-core.h b/tests/util/piglit-util-core.h index 46dd1c8..513e5da 100644 --- a/tests/util/piglit-util-core.h +++ b/tests/util/piglit-util-core.h @@ -64,28 +64,11 @@ void piglit_report_result(enum piglit_result result); #endif -typedef enum { - PIGLIT_DISPATCH_GL, - PIGLIT_DISPATCH_GL_FWD, - PIGLIT_DISPATCH_ES1, - PIGLIT_DISPATCH_ES2 -} piglit_dispatch_api; - typedef void (APIENTRY *piglit_dispatch_function_ptr)(void); -typedef piglit_dispatch_function_ptr (*piglit_get_core_proc_address_function_ptr)(const char *, int); - -typedef piglit_dispatch_function_ptr (*piglit_get_ext_proc_address_function_ptr)(const char *); - typedef piglit_dispatch_function_ptr (*piglit_dispatch_resolver_ptr)(); -typedef void (*piglit_error_function_ptr)(const char *); - -void piglit_dispatch_init(piglit_dispatch_api api, - piglit_get_core_proc_address_function_ptr get_core_proc, - piglit_get_ext_proc_address_function_ptr get_ext_proc, - piglit_error_function_ptr unsupported_proc, - piglit_error_function_ptr failure_proc); +void piglit_dispatch_init(void); #ifdef __cplusplus } -- 1.7.5.4 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
