Commit 33ca17e1 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Fill a function table with the standard OpenGL functions and store it in the TEB.

parent edb0044e
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "x11drv.h" #include "x11drv.h"
#include "winternl.h" #include "winternl.h"
#include "wine/wgl_driver.h"
#include "wine/library.h" #include "wine/library.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -210,6 +211,12 @@ static int use_render_texture_emulation = 1; ...@@ -210,6 +211,12 @@ static int use_render_texture_emulation = 1;
static BOOL has_swap_control; static BOOL has_swap_control;
static int swap_interval = 1; 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 #define MAX_EXTENSIONS 16
static const WineGLExtension *WineGLExtensionList[MAX_EXTENSIONS]; static const WineGLExtension *WineGLExtensionList[MAX_EXTENSIONS];
static int WineGLExtensionListSize; static int WineGLExtensionListSize;
...@@ -482,6 +489,7 @@ static BOOL has_opengl(void) ...@@ -482,6 +489,7 @@ static BOOL has_opengl(void)
char buffer[200]; char buffer[200];
int error_base, event_base; int error_base, event_base;
unsigned int i;
if (init_done) return (opengl_handle != NULL); if (init_done) return (opengl_handle != NULL);
init_done = 1; init_done = 1;
...@@ -496,6 +504,15 @@ static BOOL has_opengl(void) ...@@ -496,6 +504,15 @@ static BOOL has_opengl(void)
return FALSE; 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); pglXGetProcAddressARB = wine_dlsym(opengl_handle, "glXGetProcAddressARB", NULL, 0);
if (pglXGetProcAddressARB == NULL) { if (pglXGetProcAddressARB == NULL) {
ERR("Could not find glXGetProcAddressARB in libGL, disabling OpenGL.\n"); ERR("Could not find glXGetProcAddressARB in libGL, disabling OpenGL.\n");
...@@ -1627,6 +1644,7 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx) ...@@ -1627,6 +1644,7 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx)
if (ret) if (ret)
{ {
NtCurrentTeb()->glTable = &opengl_funcs;
NtCurrentTeb()->glContext = ctx; NtCurrentTeb()->glContext = ctx;
ctx->has_been_current = TRUE; ctx->has_been_current = TRUE;
...@@ -1698,6 +1716,7 @@ static BOOL glxdrv_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct ...@@ -1698,6 +1716,7 @@ static BOOL glxdrv_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct
ctx->drawables[0] = escape_draw.gl_drawable; ctx->drawables[0] = escape_draw.gl_drawable;
ctx->drawables[1] = escape_read.gl_drawable; ctx->drawables[1] = escape_read.gl_drawable;
ctx->refresh_drawables = FALSE; ctx->refresh_drawables = FALSE;
NtCurrentTeb()->glTable = &opengl_funcs;
NtCurrentTeb()->glContext = ctx; NtCurrentTeb()->glContext = ctx;
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment