From 1ed7a1282c5952aacaf641e9f400b6e7b06b43b9 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Sun, 25 Jun 2023 10:04:42 +0800 Subject: [PATCH] mapi: Merge get_static_proc_address into _glapi_get_proc_address MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Yonggang Luo Reviewed-by: Marek Olšák Reviewed-by: Eric Engestrom Part-of: --- src/mapi/glapi/glapi_getproc.c | 49 +++++++++++++----------------------------- 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/src/mapi/glapi/glapi_getproc.c b/src/mapi/glapi/glapi_getproc.c index a31bc0f..4d364c7 100644 --- a/src/mapi/glapi/glapi_getproc.c +++ b/src/mapi/glapi/glapi_getproc.c @@ -83,30 +83,6 @@ get_static_proc_offset(const char *funcName) } - -/** - * Return dispatch function address for the named static (built-in) function. - * Return NULL if function not found. - */ -static _glapi_proc -get_static_proc_address(const char *funcName) -{ - const glprocs_table_t * const f = get_static_proc( funcName ); - if (f == NULL) { - return NULL; - } - -#if defined(DISPATCH_FUNCTION_SIZE) && defined(GLX_INDIRECT_RENDERING) - return (f->Address == NULL) - ? get_entrypoint_address(f->Offset) - : f->Address; -#elif defined(DISPATCH_FUNCTION_SIZE) - return get_entrypoint_address(f->Offset); -#else - return f->Address; -#endif -} - /********************************************************************** * Extension function management. */ @@ -148,26 +124,31 @@ _glapi_get_proc_offset(const char *funcName) /** - * Return pointer to the named function. If the function name isn't found - * in the name of static functions, try generating a new API entrypoint on - * the fly with assembly language. + * Return dispatch function address for the named static (built-in) function. + * Return NULL if function not found. */ _glapi_proc _glapi_get_proc_address(const char *funcName) { - _glapi_proc func; - init_glapi_relocs_once(); if (!funcName || funcName[0] != 'g' || funcName[1] != 'l') return NULL; - /* search static functions */ - func = get_static_proc_address(funcName); - if (func) - return func; + const glprocs_table_t *const f = get_static_proc(funcName); + if (f == NULL) { + return NULL; + } - return NULL; +#if defined(DISPATCH_FUNCTION_SIZE) && defined(GLX_INDIRECT_RENDERING) + return (f->Address == NULL) + ? get_entrypoint_address(f->Offset) + : f->Address; +#elif defined(DISPATCH_FUNCTION_SIZE) + return get_entrypoint_address(f->Offset); +#else + return f->Address; +#endif } -- 2.7.4