diff options
author | George Sapountzis <gsapountzis@gmail.com> | 2010-03-09 22:03:24 +0200 |
---|---|---|
committer | George Sapountzis <gsapountzis@gmail.com> | 2010-03-09 22:04:51 +0200 |
commit | 2c8b5ffed9a787e896b540a95be48ef401d5f007 (patch) | |
tree | e42562382efd8a91294d12148fc0b048bf48d8e7 | |
parent | fe14868d96d4820dba73c3a507d191b8a73c6870 (diff) |
glapi: mv table functions to glapi_getproc.c and add local header
-rw-r--r-- | src/mesa/glapi/glapi.c | 44 | ||||
-rw-r--r-- | src/mesa/glapi/glapi.h | 21 | ||||
-rw-r--r-- | src/mesa/glapi/glapi_getproc.c | 56 | ||||
-rw-r--r-- | src/mesa/glapi/glapi_priv.h | 43 |
4 files changed, 98 insertions, 66 deletions
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index 13de594aaf..ce85cf6a87 100644 --- a/src/mesa/glapi/glapi.c +++ b/src/mesa/glapi/glapi.c @@ -59,7 +59,7 @@ #endif #include "glapi/glapi.h" -#include "glapi/glapitable.h" +#include "glapi/glapi_priv.h" extern _glapi_proc __glapi_noop_table[]; @@ -291,45 +291,3 @@ _glapi_get_dispatch(void) return _glapi_Dispatch; #endif } - - - - -/* - * The dispatch table size (number of entries) is the size of the - * _glapi_table struct plus the number of dynamic entries we can add. - * The extra slots can be filled in by DRI drivers that register new extension - * functions. - */ -#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS) - - -/** - * Return size of dispatch table struct as number of functions (or - * slots). - */ -PUBLIC GLuint -_glapi_get_dispatch_table_size(void) -{ - return DISPATCH_TABLE_SIZE; -} - - -/** - * Make sure there are no NULL pointers in the given dispatch table. - * Intended for debugging purposes. - */ -void -_glapi_check_table_not_null(const struct _glapi_table *table) -{ -#if 0 /* enable this for extra DEBUG */ - const GLuint entries = _glapi_get_dispatch_table_size(); - const void **tab = (const void **) table; - GLuint i; - for (i = 1; i < entries; i++) { - assert(tab[i]); - } -#else - (void) table; -#endif -} diff --git a/src/mesa/glapi/glapi.h b/src/mesa/glapi/glapi.h index 1ca2e4beff..7dcf2e8910 100644 --- a/src/mesa/glapi/glapi.h +++ b/src/mesa/glapi/glapi.h @@ -165,29 +165,8 @@ extern _glapi_proc _glapi_get_proc_address(const char *funcName); -/** - * GL API local functions and defines - */ - -extern void -init_glapi_relocs_once(void); - -extern void -_glapi_check_table_not_null(const struct _glapi_table *table); - - -extern void -_glapi_check_table(const struct _glapi_table *table); - - extern const char * _glapi_get_proc_name(unsigned int offset); -/* - * Number of extension functions which we can dynamically add at runtime. - */ -#define MAX_EXTENSION_FUNCS 300 - - #endif diff --git a/src/mesa/glapi/glapi_getproc.c b/src/mesa/glapi/glapi_getproc.c index 2b89a8f4f4..fbf48f1388 100644 --- a/src/mesa/glapi/glapi_getproc.c +++ b/src/mesa/glapi/glapi_getproc.c @@ -39,8 +39,9 @@ #endif #include "glapi/glapi.h" -#include "glapi/glapioffsets.h" +#include "glapi/glapi_priv.h" #include "glapi/glapitable.h" +#include "glapi/glapioffsets.h" #if defined(USE_X64_64_ASM) && defined(GLX_USE_TLS) @@ -378,6 +379,12 @@ struct _glapi_function { }; +/* + * Number of extension functions which we can dynamically add at runtime. + */ +#define MAX_EXTENSION_FUNCS 300 + + static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS]; static GLuint NumExtEntryPoints = 0; @@ -766,6 +773,51 @@ _glapi_get_proc_name(GLuint offset) +/********************************************************************** + * GL API table functions. + */ + + +/* + * The dispatch table size (number of entries) is the size of the + * _glapi_table struct plus the number of dynamic entries we can add. + * The extra slots can be filled in by DRI drivers that register new extension + * functions. + */ +#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS) + + +/** + * Return size of dispatch table struct as number of functions (or + * slots). + */ +PUBLIC GLuint +_glapi_get_dispatch_table_size(void) +{ + return DISPATCH_TABLE_SIZE; +} + + +/** + * Make sure there are no NULL pointers in the given dispatch table. + * Intended for debugging purposes. + */ +void +_glapi_check_table_not_null(const struct _glapi_table *table) +{ +#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */ + const GLuint entries = _glapi_get_dispatch_table_size(); + const void **tab = (const void **) table; + GLuint i; + for (i = 1; i < entries; i++) { + assert(tab[i]); + } +#else + (void) table; +#endif +} + + /** * Do some spot checks to be sure that the dispatch table * slots are assigned correctly. For debugging only. @@ -773,7 +825,7 @@ _glapi_get_proc_name(GLuint offset) void _glapi_check_table(const struct _glapi_table *table) { -#if 0 /* enable this for extra DEBUG */ +#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */ { GLuint BeginOffset = _glapi_get_proc_offset("glBegin"); char *BeginFunc = (char*) &table->Begin; diff --git a/src/mesa/glapi/glapi_priv.h b/src/mesa/glapi/glapi_priv.h new file mode 100644 index 0000000000..05eda99ccf --- /dev/null +++ b/src/mesa/glapi/glapi_priv.h @@ -0,0 +1,43 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef _GLAPI_PRIV_H +#define _GLAPI_PRIV_H + +#include "glthread.h" + +extern void +_glapi_check_table_not_null(const struct _glapi_table *table); + + +extern void +_glapi_check_table(const struct _glapi_table *table); + + +extern void +init_glapi_relocs_once(void); + + +#endif |