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 <brianp@vmware.com>
#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
_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)