Module: wine Branch: master Commit: 33ca17e1e9bf670b950c3f4ee5d0036a0fbc54da URL: http://source.winehq.org/git/wine.git/?a=commit;h=33ca17e1e9bf670b950c3f4ee5...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Jul 16 23:26:50 2012 +0200
winex11: Fill a function table with the standard OpenGL functions and store it in the TEB.
---
dlls/winex11.drv/opengl.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index b32fe95..aae4f4b 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -48,6 +48,7 @@
#include "x11drv.h" #include "winternl.h" +#include "wine/wgl_driver.h" #include "wine/library.h" #include "wine/debug.h"
@@ -210,6 +211,12 @@ static int use_render_texture_emulation = 1; static BOOL has_swap_control; static int swap_interval = 1;
+static struct opengl_funcs opengl_funcs; + +#define USE_GL_FUNC(name) #name, +static const char *opengl_func_names[] = { ALL_WGL_FUNCS }; +#undef USE_GL_FUNC + #define MAX_EXTENSIONS 16 static const WineGLExtension *WineGLExtensionList[MAX_EXTENSIONS]; static int WineGLExtensionListSize; @@ -482,6 +489,7 @@ static BOOL has_opengl(void)
char buffer[200]; int error_base, event_base; + unsigned int i;
if (init_done) return (opengl_handle != NULL); init_done = 1; @@ -496,6 +504,15 @@ static BOOL has_opengl(void) return FALSE; }
+ for (i = 0; i < sizeof(opengl_func_names)/sizeof(opengl_func_names[0]); i++) + { + if (!(((void **)&opengl_funcs.gl)[i] = wine_dlsym( opengl_handle, opengl_func_names[i], NULL, 0 ))) + { + ERR( "%s not found in libGL, disabling OpenGL.\n", opengl_func_names[i] ); + goto failed; + } + } + pglXGetProcAddressARB = wine_dlsym(opengl_handle, "glXGetProcAddressARB", NULL, 0); if (pglXGetProcAddressARB == NULL) { ERR("Could not find glXGetProcAddressARB in libGL, disabling OpenGL.\n"); @@ -1627,6 +1644,7 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx)
if (ret) { + NtCurrentTeb()->glTable = &opengl_funcs; NtCurrentTeb()->glContext = ctx;
ctx->has_been_current = TRUE; @@ -1698,6 +1716,7 @@ static BOOL glxdrv_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct ctx->drawables[0] = escape_draw.gl_drawable; ctx->drawables[1] = escape_read.gl_drawable; ctx->refresh_drawables = FALSE; + NtCurrentTeb()->glTable = &opengl_funcs; NtCurrentTeb()->glContext = ctx; } else