From: José Fonseca Date: Wed, 7 Jan 2015 14:27:12 +0000 (+0000) Subject: mesa: Don't use _mesa_generic_nop on Windows. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2b7fd5b11df95869249a1bdc6e1b222747aaa075;p=mesa.git mesa: Don't use _mesa_generic_nop on Windows. It doesn't work on Windows because of STDCALL calling convention -- it's the callee responsibility to pop the arguments, and the number of arguments vary with the prototype --, so the stack pointer ends up getting corrupted. This is just a non-invasive stop-gap fix. A proper fix would be more elaborate, and require either: - a variation of __glapi_noop_table which sets GL_INVALID_OPERATION error - stop using APIENTRY on all internal _mesa_* functions. Tested with piglit gl-1.0-beginend-coverage (it now fails instead of crashing). VMware PR1350505 Reviewed-by: Brian Paul --- diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 400c158a755..4b5b694a7fb 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -908,6 +908,9 @@ nop_glFlush(void) #endif +extern void (*__glapi_noop_table[])(void); + + /** * Allocate and initialize a new dispatch table. All the dispatch * function pointers will point at the _mesa_generic_nop() function @@ -929,7 +932,13 @@ _mesa_alloc_dispatch_table(void) _glapi_proc *entry = (_glapi_proc *) table; GLint i; for (i = 0; i < numEntries; i++) { +#if defined(_WIN32) + /* FIXME: This will not generate an error, but at least it won't + * corrupt the stack like _mesa_generic_nop does. */ + entry[i] = __glapi_noop_table[i]; +#else entry[i] = (_glapi_proc) _mesa_generic_nop; +#endif } #if defined(_WIN32)