summaryrefslogtreecommitdiff
path: root/src/mapi
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2018-01-16 16:26:57 +0000
committerJon Turney <jon.turney@dronecode.org.uk>2018-02-01 15:14:08 +0000
commitd3540b405b975450b9c2f9d8eb273be062cbf73a (patch)
tree7e0032980416f8116872b3e44b5f436846d03e48 /src/mapi
parentb37b7b42dcc33d636c3db0558d032d7d95664c56 (diff)
glx/apple: locate dispatch table functions to wrap by name
Avoid reaching into the dispatch table internals (and thus having to deal with the complexities of remap etc.) by identifying functions to wrap by name. See: https://lists.freedesktop.org/archives/mesa-dev/2015-June/086721.html et seq. https://bugs.freedesktop.org/show_bug.cgi?id=90311 Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Diffstat (limited to 'src/mapi')
-rw-r--r--src/mapi/glapi/gen/gl_gentable.py14
-rw-r--r--src/mapi/glapi/glapi.h3
2 files changed, 17 insertions, 0 deletions
diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py
index 2f54d1d579..50153bbabd 100644
--- a/src/mapi/glapi/gen/gl_gentable.py
+++ b/src/mapi/glapi/gen/gl_gentable.py
@@ -56,6 +56,7 @@ header = """/* GLXEXT is the define used in the xserver when the GLX extension i
#endif
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include "main/glheader.h"
@@ -144,6 +145,19 @@ _glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
return disp;
}
+
+void
+ _glapi_table_patch(struct _glapi_table *table, const char *name, void *wrapper)
+{
+ for (int func_index = 0; func_index < GLAPI_TABLE_COUNT; ++func_index) {
+ if (!strcmp(_glapi_table_func_names[func_index], name)) {
+ ((void **)table)[func_index] = wrapper;
+ return;
+ }
+ }
+ fprintf(stderr, "could not patch %s in dispatch table\\n", name);
+}
+
"""
diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h
index f1ad4c1b5e..d5d4e0a03a 100644
--- a/src/mapi/glapi/glapi.h
+++ b/src/mapi/glapi/glapi.h
@@ -161,6 +161,9 @@ _glapi_get_proc_name(unsigned int offset);
#if defined(GLX_USE_APPLEGL) || defined(GLX_USE_WINDOWSGL)
_GLAPI_EXPORT struct _glapi_table *
_glapi_create_table_from_handle(void *handle, const char *symbol_prefix);
+
+_GLAPI_EXPORT void
+_glapi_table_patch(struct _glapi_table *, const char *name, void *wrapper);
#endif