summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-12-17 09:40:17 -0800
committerEric Anholt <eric@anholt.net>2013-12-17 14:12:14 -0800
commitc4214a39f4ef941316042d48cabfbd826cc7a07f (patch)
tree9a8be1e2322bf463244c69d159981bbf309a2dc7 /src
parent8dcd1512db65a66d5693bfa802e9323d26e12b2e (diff)
win32: Reset all dispatch tables to re-resolve on any wglMakeCurrent.
Diffstat (limited to 'src')
-rw-r--r--src/dispatch_common.c8
-rw-r--r--src/dispatch_common.h8
-rw-r--r--src/dispatch_wgl.c50
-rwxr-xr-xsrc/gen_dispatch.py6
4 files changed, 63 insertions, 9 deletions
diff --git a/src/dispatch_common.c b/src/dispatch_common.c
index e597c4e..0ac5d23 100644
--- a/src/dispatch_common.c
+++ b/src/dispatch_common.c
@@ -475,14 +475,6 @@ epoxy_print_failure_reasons(const char *name,
}
}
-#ifdef _WIN32
-#define WRAPPER_VISIBILITY PUBLIC
-#define WRAPPER(x) x
-#else
-#define WRAPPER_VISIBILITY static
-#define WRAPPER(x) x ## _wrapped
-#endif
-
WRAPPER_VISIBILITY void
WRAPPER(epoxy_glBegin)(GLenum primtype)
{
diff --git a/src/dispatch_common.h b/src/dispatch_common.h
index 5170239..02599bd 100644
--- a/src/dispatch_common.h
+++ b/src/dispatch_common.h
@@ -66,9 +66,13 @@
#if defined(_WIN32)
#define USING_DISPATCH_TABLE 1
#define UNWRAPPED_PROTO(x) x
+#define WRAPPER_VISIBILITY PUBLIC
+#define WRAPPER(x) x
#else
#define USING_DISPATCH_TABLE 0
#define UNWRAPPED_PROTO(x) (*x)
+#define WRAPPER_VISIBILITY static
+#define WRAPPER(x) x ## _wrapped
#endif
void *epoxy_egl_dlsym(const char *name);
@@ -100,4 +104,8 @@ void gl_init_dispatch_table(void);
void wgl_init_dispatch_table(void);
extern uint32_t gl_tls_index, gl_tls_size;
extern uint32_t wgl_tls_index, wgl_tls_size;
+extern BOOL UNWRAPPED_PROTO(epoxy_wglMakeCurrent_unwrapped)(HDC hdc, HGLRC hglrc);
+extern BOOL UNWRAPPED_PROTO(epoxy_wglMakeContextCurrentARB_unwrapped)(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+extern BOOL UNWRAPPED_PROTO(epoxy_wglMakeContextCurrentEXT_unwrapped)(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+extern BOOL UNWRAPPED_PROTO(epoxy_wglMakeAssociatedContextCurrentAMD_unwrapped)(HGLRC hglrc);
#endif
diff --git a/src/dispatch_wgl.c b/src/dispatch_wgl.c
index 0161ad4..743136e 100644
--- a/src/dispatch_wgl.c
+++ b/src/dispatch_wgl.c
@@ -117,3 +117,53 @@ DllMain(HINSTANCE dll, DWORD reason, LPVOID reserved)
return TRUE;
}
+
+WRAPPER_VISIBILITY BOOL
+WRAPPER(epoxy_wglMakeCurrent)(HDC hdc, HGLRC hglrc)
+{
+ BOOL ret = epoxy_wglMakeCurrent_unwrapped(hdc, hglrc);
+
+ reset_dispatch_table();
+
+ return ret;
+}
+
+
+WRAPPER_VISIBILITY BOOL
+WRAPPER(epoxy_wglMakeContextCurrentARB)(HDC hDrawDC,
+ HDC hReadDC,
+ HGLRC hglrc)
+{
+ BOOL ret = epoxy_wglMakeContextCurrentARB_unwrapped(hDrawDC, hReadDC,
+ hglrc);
+
+ reset_dispatch_table();
+
+ return ret;
+}
+
+
+WRAPPER_VISIBILITY BOOL
+WRAPPER(epoxy_wglMakeContextCurrentEXT)(HDC hDrawDC,
+ HDC hReadDC,
+ HGLRC hglrc)
+{
+ BOOL ret = epoxy_wglMakeContextCurrentEXT_unwrapped(hDrawDC, hReadDC,
+ hglrc);
+
+ reset_dispatch_table();
+
+ return ret;
+}
+
+
+WRAPPER_VISIBILITY BOOL
+WRAPPER(epoxy_wglMakeAssociatedContextCurrentAMD)(HGLRC hglrc)
+{
+ BOOL ret = epoxy_wglMakeAssociatedContextCurrentAMD_unwrapped(hglrc);
+
+ reset_dispatch_table();
+
+ return ret;
+}
+
diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py
index ce3f948..7a2d2df 100755
--- a/src/gen_dispatch.py
+++ b/src/gen_dispatch.py
@@ -65,7 +65,11 @@ class GLFunction(object):
# non-public symbols with a "_unwrapped" suffix.
wrapped_functions = {
'glBegin',
- 'glEnd'
+ 'glEnd',
+ 'wglMakeCurrent',
+ 'wglMakeContextCurrentEXT',
+ 'wglMakeContextCurrentARB',
+ 'wglMakeAssociatedContextCurrentAMD',
}
if name in wrapped_functions: