#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
* 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;
#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;
}
* 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
*/
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) {
{
struct _glapi_table *table;
- table = _mesa_alloc_dispatch_table();
+ table = _mesa_alloc_dispatch_table(false);
if (!table)
return NULL;
}
/* 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;
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;
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);
_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);