[Mesa-dev] [PATCH] mapi/glapi: Never use a generic no-op entry-point on Windows.
From: José Fonseca jfons...@vmware.com When GLAPIENTRY is __stdcall (ie Windows), the stack is popped by the callee making the number/type of arguments significant, therefore using a generic no-op causes stack corruption for many entry-points. --- src/mapi/glapi/glapi_nop.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mapi/glapi/glapi_nop.c b/src/mapi/glapi/glapi_nop.c index 9b09297..69b1ae6 100644 --- a/src/mapi/glapi/glapi_nop.c +++ b/src/mapi/glapi/glapi_nop.c @@ -51,7 +51,11 @@ _glapi_set_warning_func(_glapi_proc func) { } -#ifdef DEBUG +/* + * When GLAPIENTRY is __stdcall (i.e. Windows), the stack is popped by the + * callee making the number/type of arguments significant. + */ +#if defined(_WIN32) || defined(DEBUG) /** * Called by each of the no-op GL entrypoints. @@ -59,7 +63,7 @@ _glapi_set_warning_func(_glapi_proc func) static int Warn(const char *func) { -#if !defined(_WIN32_WCE) +#if defined(DEBUG) !defined(_WIN32_WCE) if (getenv(MESA_DEBUG) || getenv(LIBGL_DEBUG)) { fprintf(stderr, GL User Error: gl%s called without a rendering context\n, func); -- 1.7.7.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mapi/glapi: Never use a generic no-op entry-point on Windows.
On 02/02/2012 03:44 AM, jfons...@vmware.com wrote: From: José Fonsecajfons...@vmware.com When GLAPIENTRY is __stdcall (ie Windows), the stack is popped by the callee making the number/type of arguments significant, therefore using a generic no-op causes stack corruption for many entry-points. --- src/mapi/glapi/glapi_nop.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mapi/glapi/glapi_nop.c b/src/mapi/glapi/glapi_nop.c index 9b09297..69b1ae6 100644 --- a/src/mapi/glapi/glapi_nop.c +++ b/src/mapi/glapi/glapi_nop.c @@ -51,7 +51,11 @@ _glapi_set_warning_func(_glapi_proc func) { } -#ifdef DEBUG +/* + * When GLAPIENTRY is __stdcall (i.e. Windows), the stack is popped by the + * callee making the number/type of arguments significant. + */ +#if defined(_WIN32) || defined(DEBUG) /** * Called by each of the no-op GL entrypoints. @@ -59,7 +63,7 @@ _glapi_set_warning_func(_glapi_proc func) static int Warn(const char *func) { -#if !defined(_WIN32_WCE) +#if defined(DEBUG) !defined(_WIN32_WCE) if (getenv(MESA_DEBUG) || getenv(LIBGL_DEBUG)) { fprintf(stderr, GL User Error: gl%s called without a rendering context\n, func); Reviewed-by: Brian Paul bri...@vmware.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev