diff options
author | marha <marha@users.sourceforge.net> | 2011-06-15 16:50:54 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-06-15 16:50:54 +0200 |
commit | 0e661faf8cf2e3460b5e2389414f99c035ad4d6a (patch) | |
tree | d67bcdbab7099872d8f79906159e0690478c65cd /mesalib/src/mapi/glapi/gen | |
parent | 4d74e36f359d22b50302c82a922b79ac24dd3e23 (diff) | |
download | vcxsrv-0e661faf8cf2e3460b5e2389414f99c035ad4d6a.tar.gz vcxsrv-0e661faf8cf2e3460b5e2389414f99c035ad4d6a.tar.bz2 vcxsrv-0e661faf8cf2e3460b5e2389414f99c035ad4d6a.zip |
mesa xserver git update 15 June 2011
Diffstat (limited to 'mesalib/src/mapi/glapi/gen')
-rw-r--r-- | mesalib/src/mapi/glapi/gen/gl_gentable.py | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/mesalib/src/mapi/glapi/gen/gl_gentable.py b/mesalib/src/mapi/glapi/gen/gl_gentable.py index 73986f272..814238a76 100644 --- a/mesalib/src/mapi/glapi/gen/gl_gentable.py +++ b/mesalib/src/mapi/glapi/gen/gl_gentable.py @@ -34,6 +34,10 @@ import gl_XML, glX_XML import sys, getopt header = """ +#if defined(DEBUG) && !defined(_WIN32_WCE) +#include <execinfo.h> +#endif + #include <dlfcn.h> #include <stdlib.h> #include <stdio.h> @@ -43,6 +47,40 @@ header = """ #include "glapi.h" #include "glapitable.h" +static void +__glapi_gentable_NoOp(void) { +#if defined(DEBUG) && !defined(_WIN32_WCE) + if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) { + const char *fstr = "Unknown"; + void *frames[2]; + + if(backtrace(frames, 2) == 2) { + Dl_info info; + dladdr(frames[1], &info); + if(info.dli_sname) + fstr = info.dli_sname; + } + + fprintf(stderr, "Call to unimplemented API: %s\\n", fstr); + } +#endif +} + +static void +__glapi_gentable_set_remaining_noop(struct _glapi_table *disp) { + GLuint entries = _glapi_get_dispatch_table_size(); + void **dispatch = (void **) disp; + int i; + + /* ISO C is annoying sometimes */ + union {_glapi_proc p; void *v;} p; + p.p = __glapi_gentable_NoOp; + + for(i=0; i < entries; i++) + if(dispatch[i] == NULL) + dispatch[i] = p.v; +} + struct _glapi_table * _glapi_create_table_from_handle(void *handle, const char *symbol_prefix) { struct _glapi_table *disp = calloc(1, sizeof(struct _glapi_table)); @@ -56,15 +94,17 @@ _glapi_create_table_from_handle(void *handle, const char *symbol_prefix) { """ footer = """ + __glapi_gentable_set_remaining_noop(disp); + return disp; } """ body_template = """ if(!disp->%(name)s) { + void ** procp = (void **) &disp->%(name)s; snprintf(symboln, sizeof(symboln), "%%s%(entry_point)s", symbol_prefix); - _glapi_proc *procp = (_glapi_proc *)&disp->%(name)s; - *procp = (_glapi_proc) dlsym(handle, symboln); + *procp = dlsym(handle, symboln); } """ |