From 82c8df11062f72a7d467e26cedbbd8b322ff7a70 Mon Sep 17 00:00:00 2001 From: marha Date: Sun, 22 Mar 2015 13:30:59 +0100 Subject: randrproto fontconfig libX11 libXdmcp libxcb mesa xkbcomp xserver git update 22 Mar 2015 xserver commit 0a78b599b34cc8b5fe6fe82f90e90234e8ab7a56 libxcb commit a90be9955d2c5a635f791d44db1154633b9d3322 libX11 commit 5a499ca7b064bf7e6a4fcc169f22862dce0c60c5 libXdmcp commit 0c09444d276fbf46a0e8b427a4f6a325d0625742 xkbcomp commit fc3e6ddb2c8e922ea80f2dc5cbc1df2102e30d99 randrproto commit b1ba68df8a5fc113a387123ec2f312195e28e47f fontconfig commit 69ff6b6e260584e383c38b1b7034ddcbb23d214f mesa commit 397b491173f0d2df4deb44d21c170bf16840d507 --- .../src/mapi/glapi/gen/ARB_direct_state_access.xml | 112 +++++++++++++++++++++ mesalib/src/mapi/glapi/gen/gl_enums.py | 6 ++ mesalib/src/mapi/glapi/glapi.h | 11 ++ mesalib/src/mapi/glapi/glapi_getproc.c | 4 + mesalib/src/mapi/glapi/glapi_nop.c | 85 +++++++++------- mesalib/src/mapi/glapi/glapi_priv.h | 3 - 6 files changed, 182 insertions(+), 39 deletions(-) (limited to 'mesalib/src/mapi/glapi') diff --git a/mesalib/src/mapi/glapi/gen/ARB_direct_state_access.xml b/mesalib/src/mapi/glapi/gen/ARB_direct_state_access.xml index 2fe1638fd..641e68f71 100644 --- a/mesalib/src/mapi/glapi/gen/ARB_direct_state_access.xml +++ b/mesalib/src/mapi/glapi/gen/ARB_direct_state_access.xml @@ -7,6 +7,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -21,6 +125,14 @@ + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/gl_enums.py b/mesalib/src/mapi/glapi/gen/gl_enums.py index d61618f4d..f45782df8 100644 --- a/mesalib/src/mapi/glapi/gen/gl_enums.py +++ b/mesalib/src/mapi/glapi/gen/gl_enums.py @@ -157,6 +157,12 @@ _mesa_lookup_prim_by_nr(GLuint nr) string_offsets = {} i = 0; + print '#if defined(__GNUC__)' + print '# define LONGSTRING __extension__' + print '#else' + print '# define LONGSTRING' + print '#endif' + print '' print 'LONGSTRING static const char enum_string_table[] = ' for enum, name in enum_table: print ' "%s\\0"' % (name) diff --git a/mesalib/src/mapi/glapi/glapi.h b/mesalib/src/mapi/glapi/glapi.h index 8d991fb3b..673295bca 100644 --- a/mesalib/src/mapi/glapi/glapi.h +++ b/mesalib/src/mapi/glapi/glapi.h @@ -80,6 +80,9 @@ extern "C" { #endif typedef void (*_glapi_proc)(void); + +typedef void (*_glapi_nop_handler_proc)(const char *name); + struct _glapi_table; @@ -159,6 +162,14 @@ _GLAPI_EXPORT struct _glapi_table * _glapi_create_table_from_handle(void *handle, const char *symbol_prefix); +_GLAPI_EXPORT void +_glapi_set_nop_handler(_glapi_nop_handler_proc func); + +/** Return pointer to new dispatch table filled with no-op functions */ +_GLAPI_EXPORT struct _glapi_table * +_glapi_new_nop_table(unsigned num_entries); + + /** Deprecated function */ _GLAPI_EXPORT unsigned long _glthread_GetID(void); diff --git a/mesalib/src/mapi/glapi/glapi_getproc.c b/mesalib/src/mapi/glapi/glapi_getproc.c index bfde92cf2..524a771ca 100644 --- a/mesalib/src/mapi/glapi/glapi_getproc.c +++ b/mesalib/src/mapi/glapi/glapi_getproc.c @@ -30,6 +30,9 @@ */ +#include +#include +#include #include "glapi/glapi_priv.h" #include "glapi/glapitable.h" @@ -37,6 +40,7 @@ #define FIRST_DYNAMIC_OFFSET (sizeof(struct _glapi_table) / sizeof(void *)) + /********************************************************************** * Static function management. */ diff --git a/mesalib/src/mapi/glapi/glapi_nop.c b/mesalib/src/mapi/glapi/glapi_nop.c index 628276e93..13db310b3 100644 --- a/mesalib/src/mapi/glapi/glapi_nop.c +++ b/mesalib/src/mapi/glapi/glapi_nop.c @@ -30,14 +30,22 @@ * This file defines a special dispatch table which is loaded with no-op * functions. * - * When there's no current rendering context, calling a GL function like - * glBegin() is a no-op. Apps should never normally do this. So as a - * debugging aid, each of the no-op functions will emit a warning to - * stderr if the MESA_DEBUG or LIBGL_DEBUG env var is set. + * Mesa can register a "no-op handler function" which will be called in + * the event that a no-op function is called. + * + * In the past, the dispatch table was loaded with pointers to a single + * no-op function. But that broke on Windows because the GL entrypoints + * use __stdcall convention. __stdcall means the callee cleans up the + * stack. So one no-op function can't properly clean up the stack. This + * would lead to crashes. + * + * Another benefit of unique no-op functions is we can accurately report + * the function's name in an error message. */ - +#include +#include #include "glapi/glapi_priv.h" @@ -51,25 +59,32 @@ _glapi_set_warning_func(_glapi_proc func) { } -/* - * When GLAPIENTRY is __stdcall (i.e. Windows), the stack is popped by the - * callee making the number/type of arguments significant. + +/** + * We'll jump though this function pointer whenever a no-op function + * is called. */ -#if defined(_WIN32) || defined(DEBUG) +static _glapi_nop_handler_proc nop_handler = NULL; + + +/** + * Register the no-op handler call-back function. + */ +void +_glapi_set_nop_handler(_glapi_nop_handler_proc func) +{ + nop_handler = func; +} + /** * Called by each of the no-op GL entrypoints. */ -static int -Warn(const char *func) +static void +nop(const char *func) { -#if defined(DEBUG) - if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) { - fprintf(stderr, "GL User Error: gl%s called without a rendering context\n", - func); - } -#endif - return 0; + if (nop_handler) + nop_handler(func); } @@ -79,7 +94,8 @@ Warn(const char *func) static GLint NoOpUnused(void) { - return Warn(" function"); + nop("unused GL entry point"); + return 0; } /* @@ -89,31 +105,28 @@ NoOpUnused(void) #define KEYWORD1_ALT static #define KEYWORD2 GLAPIENTRY #define NAME(func) NoOp##func -#define DISPATCH(func, args, msg) Warn(#func); -#define RETURN_DISPATCH(func, args, msg) Warn(#func); return 0 +#define DISPATCH(func, args, msg) nop(#func); +#define RETURN_DISPATCH(func, args, msg) nop(#func); return 0 /* * Defines for the table of no-op entry points. */ #define TABLE_ENTRY(name) (_glapi_proc) NoOp##name +#define DISPATCH_TABLE_NAME __glapi_noop_table +#define UNUSED_TABLE_NAME __unused_noop_functions + +#include "glapi/glapitemp.h" -#else -static int -NoOpGeneric(void) +/** Return pointer to new dispatch table filled with no-op functions */ +struct _glapi_table * +_glapi_new_nop_table(unsigned num_entries) { - if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) { - fprintf(stderr, "GL User Error: calling GL function without a rendering context\n"); + struct _glapi_table *table = malloc(num_entries * sizeof(_glapi_proc)); + if (table) { + memcpy(table, __glapi_noop_table, + num_entries * sizeof(_glapi_proc)); } - return 0; + return table; } - -#define TABLE_ENTRY(name) (_glapi_proc) NoOpGeneric - -#endif - -#define DISPATCH_TABLE_NAME __glapi_noop_table -#define UNUSED_TABLE_NAME __unused_noop_functions - -#include "glapi/glapitemp.h" diff --git a/mesalib/src/mapi/glapi/glapi_priv.h b/mesalib/src/mapi/glapi/glapi_priv.h index d3682603d..50f710edc 100644 --- a/mesalib/src/mapi/glapi/glapi_priv.h +++ b/mesalib/src/mapi/glapi/glapi_priv.h @@ -26,9 +26,6 @@ #ifndef _GLAPI_PRIV_H #define _GLAPI_PRIV_H -#include -#include -#include #ifdef HAVE_DIX_CONFIG_H #include -- cgit v1.2.3