Module: wine Branch: master Commit: 2506677c60d140aff3e27290af7c218e5baf9c9a URL: http://source.winehq.org/git/wine.git/?a=commit;h=2506677c60d140aff3e27290af...
Author: Roderick Colenbrander thunderbird2k@gmx.net Date: Tue Oct 31 18:29:14 2006 +0100
winex11.drv: Route wglMakeContextCurrentARB through gdi32.
---
dlls/gdi32/driver.c | 1 + dlls/gdi32/gdi_private.h | 1 + dlls/gdi32/opengl.c | 40 ++++++++++++++++++++++++++++++++++++- dlls/winex11.drv/opengl.c | 10 ++++---- dlls/winex11.drv/winex11.drv.spec | 1 + 5 files changed, 47 insertions(+), 6 deletions(-)
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index a751c72..16bde65 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -199,6 +199,7 @@ #define GET_FUNC(name) driver->funcs.p## GET_FUNC(wglCreateContext); GET_FUNC(wglDeleteContext); GET_FUNC(wglGetProcAddress); + GET_FUNC(wglMakeContextCurrentARB); GET_FUNC(wglMakeCurrent); GET_FUNC(wglShareLists); GET_FUNC(wglUseFontBitmapsA); diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index d173151..eda9827 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -188,6 +188,7 @@ typedef struct tagDC_FUNCS BOOL (*pwglDeleteContext)(HGLRC); PROC (*pwglGetProcAddress)(LPCSTR); BOOL (*pwglMakeCurrent)(PHYSDEV, HGLRC); + BOOL (*pwglMakeContextCurrentARB)(PHYSDEV, PHYSDEV, HGLRC); BOOL (*pwglShareLists)(HGLRC hglrc1, HGLRC hglrc2); BOOL (*pwglUseFontBitmapsA)(PHYSDEV, DWORD, DWORD, DWORD); BOOL (*pwglUseFontBitmapsW)(PHYSDEV, DWORD, DWORD, DWORD); diff --git a/dlls/gdi32/opengl.c b/dlls/gdi32/opengl.c index 2be485e..03ce10d 100644 --- a/dlls/gdi32/opengl.c +++ b/dlls/gdi32/opengl.c @@ -161,6 +161,36 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLR }
/*********************************************************************** + * 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.@) */ BOOL WINAPI wglShareLists(HGLRC hglrc1, HGLRC hglrc2) @@ -228,7 +258,7 @@ BOOL WINAPI wglUseFontBitmapsW(HDC hdc, PROC WINAPI wglGetProcAddress(LPCSTR func) { PROC ret = NULL; - DC * dc = NULL; + DC *dc;
if(!func) return NULL; @@ -244,5 +274,13 @@ PROC WINAPI wglGetProcAddress(LPCSTR fun
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; } diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 046c57b..92ca29c 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1376,10 +1376,10 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVIC }
/* 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; - TRACE("(%p,%p,%p)\n", hDrawDC, hReadDC, hglrc); + TRACE("(%p,%p,%p)\n", hDrawDev, hReadDev, hglrc);
wine_tsx11_lock(); if (hglrc == NULL) { @@ -1390,11 +1390,11 @@ static BOOL WINAPI X11DRV_wglMakeContext ret = FALSE; } else { Wine_GLContext *ctx = (Wine_GLContext *) hglrc; - Drawable d_draw = get_drawable( hDrawDC ); - Drawable d_read = get_drawable( hReadDC ); + Drawable d_draw = get_glxdrawable(hDrawDev); + Drawable d_read = get_glxdrawable(hReadDev);
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); } ret = pglXMakeContextCurrent(ctx->display, d_draw, d_read, ctx->ctx); diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index 56c2c1a..2c9a07e 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -134,6 +134,7 @@ # OpenGL @ cdecl wglCreateContext(long) X11DRV_wglCreateContext @ cdecl wglDeleteContext(long) X11DRV_wglDeleteContext @ cdecl wglGetProcAddress(ptr) X11DRV_wglGetProcAddress +@ cdecl wglMakeContextCurrentARB(ptr ptr long) X11DRV_wglMakeContextCurrentARB @ cdecl wglMakeCurrent(long long) X11DRV_wglMakeCurrent @ cdecl wglShareLists(long long) X11DRV_wglShareLists @ cdecl wglUseFontBitmapsA(long long long long) X11DRV_wglUseFontBitmapsA