diff options
author | Brian Paul <[email protected]> | 2015-03-13 10:20:29 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2015-03-18 09:01:50 -0600 |
commit | 201e36e77d6ca616f75f14d5f1c31f0062ae4366 (patch) | |
tree | 757c6cfd8dee3d9c6bac6a2c612f2da0c8299a47 /src/mapi/table.c | |
parent | aee26d292f165438577426f5e62a62ec2a1514c9 (diff) |
mapi: add new _glapi_new_nop_table() and _glapi_set_nop_handler()
_glapi_new_nop_table() creates a new dispatch table populated with
pointers to no-op functions.
_glapi_set_nop_handler() is used to register a callback function which
will be called from each of the no-op functions.
Now we always generate a separate no-op function for each GL entrypoint.
This allows us to do proper stack clean-up for Windows __stdcall and
lets us report the actual function name in error messages. Before this
change, for non-Windows release builds we used a single no-op function
for all entrypoints.
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/mapi/table.c')
-rw-r--r-- | src/mapi/table.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/mapi/table.c b/src/mapi/table.c index 0d28666181b..748750197c6 100644 --- a/src/mapi/table.c +++ b/src/mapi/table.c @@ -30,16 +30,29 @@ #include "table.h" +static nop_handler_proc nop_handler = NULL; + +void +table_set_noop_handler(nop_handler_proc func) +{ + nop_handler = func; +} + static void noop_warn(const char *name) { - static int debug = -1; + if (nop_handler) { + nop_handler(name); + } + else { + static int debug = -1; - if (debug < 0) - debug = (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")); + if (debug < 0) + debug = (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")); - if (debug) - fprintf(stderr, "%s is no-op\n", name); + if (debug) + fprintf(stderr, "%s is no-op\n", name); + } } static int |