summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/context.c
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2015-05-26 11:41:44 -0700
committerIan Romanick <[email protected]>2015-05-26 18:25:41 -0700
commit2b8c51834bcc34a70dec9b470a28c0ef972d6993 (patch)
treeb05724783798eb01762baa631870e74692f6854d /src/mesa/main/context.c
parent8d813d14e1f5c690c6737c6cd6fc01937a7d4246 (diff)
glapi: Encapsulate nop table knowledge in new _mesa_new_nop_table function
Encapsulate the knowledge about how to build the nop table in a new _mesa_new_nop_table function. This makes it easier for dispatch_sanity to keep working now and in the future. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Tested-by: Mark Janes <[email protected]> Cc: 10.6 <[email protected]>
Diffstat (limited to 'src/mesa/main/context.c')
-rw-r--r--src/mesa/main/context.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 02875ba2a06..e4faf3d462a 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -962,12 +962,12 @@ generic_nop(void)
* the __stdcall convention which requires the callee to clean up the
* call stack. That's impossible with one generic no-op function.
*/
-#if !USE_GLAPI_NOP_FEATURES
-static struct _glapi_table *
-new_nop_table(unsigned numEntries)
+struct _glapi_table *
+_mesa_new_nop_table(unsigned numEntries)
{
struct _glapi_table *table;
+#if !USE_GLAPI_NOP_FEATURES
table = malloc(numEntries * sizeof(_glapi_proc));
if (table) {
_glapi_proc *entry = (_glapi_proc *) table;
@@ -976,9 +976,11 @@ new_nop_table(unsigned numEntries)
entry[i] = (_glapi_proc) generic_nop;
}
}
+#else
+ table = _glapi_new_nop_table(numEntries);
+#endif
return table;
}
-#endif
/**
@@ -996,10 +998,7 @@ alloc_dispatch_table(void)
*/
int numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT);
-#if !USE_GLAPI_NOP_FEATURES
- struct _glapi_table *table = new_nop_table(numEntries);
-#else
- struct _glapi_table *table = _glapi_new_nop_table(numEntries);
+ struct _glapi_table *table = _mesa_new_nop_table(numEntries);
#if defined(_WIN32)
if (table) {
@@ -1023,6 +1022,7 @@ alloc_dispatch_table(void)
}
#endif
+#if USE_GLAPI_NOP_FEATURES
_glapi_set_nop_handler(nop_handler);
#endif