Commit 2506677c authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

winex11.drv: Route wglMakeContextCurrentARB through gdi32.

parent d2abcecd
...@@ -199,6 +199,7 @@ static struct graphics_driver *create_driver( HMODULE module ) ...@@ -199,6 +199,7 @@ static struct graphics_driver *create_driver( HMODULE module )
GET_FUNC(wglCreateContext); GET_FUNC(wglCreateContext);
GET_FUNC(wglDeleteContext); GET_FUNC(wglDeleteContext);
GET_FUNC(wglGetProcAddress); GET_FUNC(wglGetProcAddress);
GET_FUNC(wglMakeContextCurrentARB);
GET_FUNC(wglMakeCurrent); GET_FUNC(wglMakeCurrent);
GET_FUNC(wglShareLists); GET_FUNC(wglShareLists);
GET_FUNC(wglUseFontBitmapsA); GET_FUNC(wglUseFontBitmapsA);
......
...@@ -188,6 +188,7 @@ typedef struct tagDC_FUNCS ...@@ -188,6 +188,7 @@ typedef struct tagDC_FUNCS
BOOL (*pwglDeleteContext)(HGLRC); BOOL (*pwglDeleteContext)(HGLRC);
PROC (*pwglGetProcAddress)(LPCSTR); PROC (*pwglGetProcAddress)(LPCSTR);
BOOL (*pwglMakeCurrent)(PHYSDEV, HGLRC); BOOL (*pwglMakeCurrent)(PHYSDEV, HGLRC);
BOOL (*pwglMakeContextCurrentARB)(PHYSDEV, PHYSDEV, HGLRC);
BOOL (*pwglShareLists)(HGLRC hglrc1, HGLRC hglrc2); BOOL (*pwglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
BOOL (*pwglUseFontBitmapsA)(PHYSDEV, DWORD, DWORD, DWORD); BOOL (*pwglUseFontBitmapsA)(PHYSDEV, DWORD, DWORD, DWORD);
BOOL (*pwglUseFontBitmapsW)(PHYSDEV, DWORD, DWORD, DWORD); BOOL (*pwglUseFontBitmapsW)(PHYSDEV, DWORD, DWORD, DWORD);
......
...@@ -161,6 +161,36 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc) ...@@ -161,6 +161,36 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
} }
/*********************************************************************** /***********************************************************************
* wglMakeContextCurrentARB
*/
static BOOL WINAPI wglMakeContextCurrentARB(HDC hDrawDC, HDC hReadDC, HGLRC hglrc)
{
BOOL ret = FALSE;
DC *DrawDC;
DC *ReadDC;
TRACE("hDrawDC: (%p), hReadDC: (%p) hglrc: (%p)\n", hDrawDC, hReadDC, hglrc);
/* Both hDrawDC and hReadDC need to be valid */
DrawDC = DC_GetDCPtr( hDrawDC);
if (!DrawDC) return FALSE;
ReadDC = DC_GetDCPtr( hReadDC);
if (!ReadDC) {
GDI_ReleaseObj(hDrawDC);
return FALSE;
}
if (!DrawDC->funcs->pwglMakeContextCurrentARB) FIXME(" :stub\n");
else ret = DrawDC->funcs->pwglMakeContextCurrentARB(DrawDC->physDev, ReadDC->physDev, hglrc);
GDI_ReleaseObj(hDrawDC);
GDI_ReleaseObj(hReadDC);
return ret;
}
/***********************************************************************
* wglShareLists (OPENGL32.@) * wglShareLists (OPENGL32.@)
*/ */
BOOL WINAPI wglShareLists(HGLRC hglrc1, HGLRC hglrc2) BOOL WINAPI wglShareLists(HGLRC hglrc1, HGLRC hglrc2)
...@@ -228,7 +258,7 @@ BOOL WINAPI wglUseFontBitmapsW(HDC hdc, DWORD first, DWORD count, DWORD listBase ...@@ -228,7 +258,7 @@ BOOL WINAPI wglUseFontBitmapsW(HDC hdc, DWORD first, DWORD count, DWORD listBase
PROC WINAPI wglGetProcAddress(LPCSTR func) PROC WINAPI wglGetProcAddress(LPCSTR func)
{ {
PROC ret = NULL; PROC ret = NULL;
DC * dc = NULL; DC *dc;
if(!func) if(!func)
return NULL; return NULL;
...@@ -244,5 +274,13 @@ PROC WINAPI wglGetProcAddress(LPCSTR func) ...@@ -244,5 +274,13 @@ PROC WINAPI wglGetProcAddress(LPCSTR func)
GDI_ReleaseObj(default_hdc); GDI_ReleaseObj(default_hdc);
/* At the moment we implement one WGL extension which requires a HDC. When we
* are looking up this call and when the Extension is available (that is the case
* when a non-NULL value is returned by wglGetProcAddress), we return the address
* of a wrapper function which will handle the HDC->PhysDev conversion.
*/
if(ret && strcmp(func, "wglMakeContextCurrentARB") == 0)
return wglMakeContextCurrentARB;
return ret; return ret;
} }
...@@ -1376,10 +1376,10 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) { ...@@ -1376,10 +1376,10 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
} }
/* OpenGL32 wglMakeContextCurrentARB */ /* OpenGL32 wglMakeContextCurrentARB */
static BOOL WINAPI X11DRV_wglMakeContextCurrentARB(HDC hDrawDC, HDC hReadDC, HGLRC hglrc) BOOL X11DRV_wglMakeContextCurrentARB(X11DRV_PDEVICE* hDrawDev, X11DRV_PDEVICE* hReadDev, HGLRC hglrc)
{ {
BOOL ret; BOOL ret;
TRACE("(%p,%p,%p)\n", hDrawDC, hReadDC, hglrc); TRACE("(%p,%p,%p)\n", hDrawDev, hReadDev, hglrc);
wine_tsx11_lock(); wine_tsx11_lock();
if (hglrc == NULL) { if (hglrc == NULL) {
...@@ -1390,11 +1390,11 @@ static BOOL WINAPI X11DRV_wglMakeContextCurrentARB(HDC hDrawDC, HDC hReadDC, HGL ...@@ -1390,11 +1390,11 @@ static BOOL WINAPI X11DRV_wglMakeContextCurrentARB(HDC hDrawDC, HDC hReadDC, HGL
ret = FALSE; ret = FALSE;
} else { } else {
Wine_GLContext *ctx = (Wine_GLContext *) hglrc; Wine_GLContext *ctx = (Wine_GLContext *) hglrc;
Drawable d_draw = get_drawable( hDrawDC ); Drawable d_draw = get_glxdrawable(hDrawDev);
Drawable d_read = get_drawable( hReadDC ); Drawable d_read = get_glxdrawable(hReadDev);
if (ctx->ctx == NULL) { if (ctx->ctx == NULL) {
ctx->ctx = pglXCreateContext(ctx->display, ctx->vis, NULL, GetObjectType(hDrawDC) == OBJ_MEMDC ? False : True); ctx->ctx = pglXCreateContext(ctx->display, ctx->vis, NULL, GetObjectType(hDrawDev->hdc) == OBJ_MEMDC ? False : True);
TRACE(" created a delayed OpenGL context (%p)\n", ctx->ctx); TRACE(" created a delayed OpenGL context (%p)\n", ctx->ctx);
} }
ret = pglXMakeContextCurrent(ctx->display, d_draw, d_read, ctx->ctx); ret = pglXMakeContextCurrent(ctx->display, d_draw, d_read, ctx->ctx);
......
...@@ -134,6 +134,7 @@ ...@@ -134,6 +134,7 @@
@ cdecl wglCreateContext(long) X11DRV_wglCreateContext @ cdecl wglCreateContext(long) X11DRV_wglCreateContext
@ cdecl wglDeleteContext(long) X11DRV_wglDeleteContext @ cdecl wglDeleteContext(long) X11DRV_wglDeleteContext
@ cdecl wglGetProcAddress(ptr) X11DRV_wglGetProcAddress @ cdecl wglGetProcAddress(ptr) X11DRV_wglGetProcAddress
@ cdecl wglMakeContextCurrentARB(ptr ptr long) X11DRV_wglMakeContextCurrentARB
@ cdecl wglMakeCurrent(long long) X11DRV_wglMakeCurrent @ cdecl wglMakeCurrent(long long) X11DRV_wglMakeCurrent
@ cdecl wglShareLists(long long) X11DRV_wglShareLists @ cdecl wglShareLists(long long) X11DRV_wglShareLists
@ cdecl wglUseFontBitmapsA(long long long long) X11DRV_wglUseFontBitmapsA @ cdecl wglUseFontBitmapsA(long long long long) X11DRV_wglUseFontBitmapsA
......
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