win32: Reset all dispatch tables to re-resolve on any wglMakeCurrent.

macos/v1.5.9
Eric Anholt 11 years ago
parent 8dcd1512db
commit c4214a39f4
  1. 8
      src/dispatch_common.c
  2. 8
      src/dispatch_common.h
  3. 50
      src/dispatch_wgl.c
  4. 6
      src/gen_dispatch.py

@ -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)
{

@ -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

@ -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;
}

@ -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:

Loading…
Cancel
Save