summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/context.c
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2015-01-07 14:27:12 +0000
committerJosé Fonseca <[email protected]>2015-01-07 19:35:35 +0000
commit2b7fd5b11df95869249a1bdc6e1b222747aaa075 (patch)
tree078c3beac8a4e436dc98a47f51ae874cb9bb93c3 /src/mesa/main/context.c
parentfd1f79f7dda3cbe1b677a74ad1b242603646ffd5 (diff)
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 <[email protected]>
Diffstat (limited to 'src/mesa/main/context.c')
-rw-r--r--src/mesa/main/context.c9
1 files changed, 9 insertions, 0 deletions
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)