diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index e1f22a32f22..dc7b729da46 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -12869,7 +12869,7 @@ - + diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py index 8705b4ea2bb..3dbfa6c19a7 100644 --- a/src/mapi/glapi/gen/gl_marshal.py +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -383,7 +383,7 @@ class PrintCode(gl_XML.gl_print_base): with indent(): out('struct _glapi_table *table;') out('') - out('table = _mesa_alloc_dispatch_table();') + out('table = _mesa_alloc_dispatch_table(true);') out('if (table == NULL)') with indent(): out('return NULL;') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 0b62f088ad2..a6e58b2b9e1 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -916,6 +916,17 @@ generic_nop(void) #endif +static int +glthread_nop(void) +{ + /* This writes the error into the glthread command buffer if glthread is + * enabled. + */ + CALL_InternalSetError(GET_DISPATCH(), (GL_INVALID_OPERATION)); + return 0; +} + + /** * Create a new API dispatch table in which all entries point to the * generic_nop() function. This will not work on Windows because of @@ -923,7 +934,7 @@ generic_nop(void) * call stack. That's impossible with one generic no-op function. */ struct _glapi_table * -_mesa_new_nop_table(unsigned numEntries) +_mesa_new_nop_table(unsigned numEntries, bool glthread) { struct _glapi_table *table; @@ -939,6 +950,13 @@ _mesa_new_nop_table(unsigned numEntries) #else table = _glapi_new_nop_table(numEntries); #endif + + if (glthread) { + _glapi_proc *entry = (_glapi_proc *) table; + for (unsigned i = 0; i < numEntries; i++) + entry[i] = (_glapi_proc)glthread_nop; + } + return table; } @@ -949,7 +967,7 @@ _mesa_new_nop_table(unsigned numEntries) * functions will call nop_handler() above. */ struct _glapi_table * -_mesa_alloc_dispatch_table(void) +_mesa_alloc_dispatch_table(bool glthread) { /* Find the larger of Mesa's dispatch table and libGL's dispatch table. * In practice, this'll be the same for stand-alone Mesa. But for DRI @@ -958,7 +976,7 @@ _mesa_alloc_dispatch_table(void) */ int numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT); - struct _glapi_table *table = _mesa_new_nop_table(numEntries); + struct _glapi_table *table = _mesa_new_nop_table(numEntries, glthread); #if defined(_WIN32) if (table) { @@ -1021,7 +1039,7 @@ create_beginend_table(const struct gl_context *ctx) { struct _glapi_table *table; - table = _mesa_alloc_dispatch_table(); + table = _mesa_alloc_dispatch_table(false); if (!table) return NULL; @@ -1170,7 +1188,7 @@ _mesa_initialize_context(struct gl_context *ctx, } /* setup the API dispatch tables with all nop functions */ - ctx->OutsideBeginEnd = _mesa_alloc_dispatch_table(); + ctx->OutsideBeginEnd = _mesa_alloc_dispatch_table(false); if (!ctx->OutsideBeginEnd) goto fail; ctx->Exec = ctx->OutsideBeginEnd; @@ -1198,7 +1216,7 @@ _mesa_initialize_context(struct gl_context *ctx, switch (ctx->API) { case API_OPENGL_COMPAT: ctx->BeginEnd = create_beginend_table(ctx); - ctx->Save = _mesa_alloc_dispatch_table(); + ctx->Save = _mesa_alloc_dispatch_table(false); if (!ctx->BeginEnd || !ctx->Save) goto fail; diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 0933427f05b..42e4094589f 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -100,7 +100,7 @@ _mesa_initialize_context( struct gl_context *ctx, const struct dd_function_table *driverFunctions); extern struct _glapi_table * -_mesa_alloc_dispatch_table(void); +_mesa_alloc_dispatch_table(bool glthread); extern void _mesa_initialize_exec_table(struct gl_context *ctx); @@ -109,7 +109,7 @@ extern void _mesa_initialize_dispatch_tables(struct gl_context *ctx); extern struct _glapi_table * -_mesa_new_nop_table(unsigned numEntries); +_mesa_new_nop_table(unsigned numEntries, bool glthread); extern void _mesa_free_context_data(struct gl_context *ctx, bool destroy_debug_output);