diff options
author | George Sapountzis <[email protected]> | 2010-03-08 02:53:57 +0200 |
---|---|---|
committer | George Sapountzis <[email protected]> | 2010-03-10 18:44:46 +0200 |
commit | 0d1dde5b010feba1afe5b51cc6fe66c85371f70b (patch) | |
tree | 7076abc398d3de2dc540556314d515a5549e2096 /src/mesa/glapi/glapi_getproc.c | |
parent | c4b630efdb882f824e9099b9cb2e07d8db2e3549 (diff) |
glapi: comments for _glapi_add_dispatch
Diffstat (limited to 'src/mesa/glapi/glapi_getproc.c')
-rw-r--r-- | src/mesa/glapi/glapi_getproc.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/mesa/glapi/glapi_getproc.c b/src/mesa/glapi/glapi_getproc.c index 1badff81ea7..921df262af8 100644 --- a/src/mesa/glapi/glapi_getproc.c +++ b/src/mesa/glapi/glapi_getproc.c @@ -409,6 +409,10 @@ _glapi_add_dispatch( const char * const * function_names, (void) memset( is_static, 0, sizeof( is_static ) ); (void) memset( entry, 0, sizeof( entry ) ); + /* Find the _single_ dispatch offset for all function names that already + * exist (and have a dispatch offset). + */ + for ( i = 0 ; function_names[i] != NULL ; i++ ) { const char * funcName = function_names[i]; int static_offset; @@ -417,11 +421,6 @@ _glapi_add_dispatch( const char * const * function_names, if (funcName[0] != 'g' || funcName[1] != 'l') return -1; - /* Determine if the named function already exists. If the function does - * exist, it must have the same parameter signature as the function - * being added. - */ - /* search built-in functions */ static_offset = get_static_proc_offset(funcName); @@ -466,16 +465,25 @@ _glapi_add_dispatch( const char * const * function_names, } } + /* If all function names are either new (or with no dispatch offset), + * allocate a new dispatch offset. + */ + if (offset == ~0) { offset = next_dynamic_offset; next_dynamic_offset++; } + /* Fill in the dispatch offset for the new function names (and those with + * no dispatch offset). + */ + for ( i = 0 ; function_names[i] != NULL ; i++ ) { if (is_static[i]) { continue; } + /* generate entrypoints for new function names */ if (entry[i] == NULL) { entry[i] = add_function_name( function_names[i] ); if (entry[i] == NULL) { @@ -540,8 +548,12 @@ _glapi_get_proc_address(const char *funcName) if (func) return func; + /* generate entrypoint, dispatch offset must be filled in by the driver */ entry = add_function_name(funcName); - return (entry == NULL) ? NULL : entry->dispatch_stub; + if (entry == NULL) + return NULL; + + return entry->dispatch_stub; } |