Roderick Colenbrander : wgl: Fix WoW screen flickering.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Nov 6 05:48:31 CST 2006


Module: wine
Branch: master
Commit: 1d4effcaa56cb9a8bf94f240a57392b3060ad0f3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1d4effcaa56cb9a8bf94f240a57392b3060ad0f3

Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date:   Sat Nov  4 22:23:15 2006 +0100

wgl: Fix WoW screen flickering.

---

 dlls/gdi32/driver.c               |    1 +
 dlls/gdi32/gdi_private.h          |    1 +
 dlls/gdi32/opengl.c               |   29 +++++++++++++++++++++++++++++
 dlls/winex11.drv/opengl.c         |   29 +++++++++++++++++++++--------
 dlls/winex11.drv/winex11.drv.spec |    1 +
 5 files changed, 53 insertions(+), 8 deletions(-)

diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index 16bde65..f5ff9af 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(wglGetPbufferDCARB);
         GET_FUNC(wglMakeContextCurrentARB);
         GET_FUNC(wglMakeCurrent);
         GET_FUNC(wglShareLists);
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index eda9827..1dbae75 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -187,6 +187,7 @@ typedef struct tagDC_FUNCS
     HGLRC    (*pwglCreateContext)(PHYSDEV);
     BOOL     (*pwglDeleteContext)(HGLRC);
     PROC     (*pwglGetProcAddress)(LPCSTR);
+    HDC      (*pwglGetPbufferDCARB)(PHYSDEV, void*);
     BOOL     (*pwglMakeCurrent)(PHYSDEV, HGLRC);
     BOOL     (*pwglMakeContextCurrentARB)(PHYSDEV, PHYSDEV, HGLRC);
     BOOL     (*pwglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
diff --git a/dlls/gdi32/opengl.c b/dlls/gdi32/opengl.c
index 03ce10d..d171c3d 100644
--- a/dlls/gdi32/opengl.c
+++ b/dlls/gdi32/opengl.c
@@ -131,6 +131,33 @@ HDC WINAPI wglGetCurrentDC(void)
 }
 
 /***********************************************************************
+ *		wglGetPbufferDCARB
+ */
+static HDC WINAPI wglGetPbufferDCARB(void *pbuffer)
+{
+    HDC ret = 0;
+
+    /* Create a device context to associate with the pbuffer */
+    HDC hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
+    DC *dc = DC_GetDCPtr(hdc);
+
+    TRACE("(%p)\n", pbuffer);
+
+    if (!dc) return FALSE;
+
+    /* The display driver has to do the rest of the work because
+     * we need access to lowlevel datatypes which we can't access here
+     */
+    if (!dc->funcs->pwglGetPbufferDCARB) FIXME(" :stub\n");
+    else ret = dc->funcs->pwglGetPbufferDCARB(dc->physDev, pbuffer);
+
+    TRACE("(%p), hdc=%p\n", pbuffer, ret);
+    
+    GDI_ReleaseObj(hdc);
+    return ret;
+}
+
+/***********************************************************************
  *		wglMakeCurrent (OPENGL32.@)
  */
 BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
@@ -281,6 +308,8 @@ PROC WINAPI wglGetProcAddress(LPCSTR fun
      */
     if(ret && strcmp(func, "wglMakeContextCurrentARB") == 0)
         return wglMakeContextCurrentARB;
+    else if(ret && strcmp(func, "wglGetPbufferDCARB") == 0)
+        return (PROC)wglGetPbufferDCARB;
 
     return ret;
 }
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index feec150..fcb39d4 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1871,23 +1871,26 @@ static GLboolean WINAPI X11DRV_wglDestro
     return GL_TRUE;
 }
 
-/* WGL_ARB_pbuffer: wglGetPbufferDCARB */
-static HDC WINAPI X11DRV_wglGetPbufferDCARB(HPBUFFERARB hPbuffer)
+/* WGL_ARB_pbuffer: wglGetPbufferDCARB
+ * The function wglGetPbufferDCARB returns a device context for a pbuffer.
+ * Gdi32 implements the part of this function which creates a device context.
+ * This part associates the physDev with the X drawable of the pbuffer.
+ */
+HDC X11DRV_wglGetPbufferDCARB(X11DRV_PDEVICE *physDev, HPBUFFERARB hPbuffer)
 {
     Wine_GLPBuffer* object = (Wine_GLPBuffer*) hPbuffer;
-    HDC hDC;
     if (NULL == object) {
         SetLastError(ERROR_INVALID_HANDLE);
         return NULL;
     }
-    hDC = CreateCompatibleDC(object->hdc);
 
     /* The function wglGetPbufferDCARB returns a DC to which the pbuffer can be connected.
      * We only support one onscreen rendering format (the one from the main visual), so use that. */
-    SetPixelFormat(hDC, 1, NULL);
-    set_drawable(hDC, object->drawable); /* works ?? */
-    TRACE("(%p)->(%p)\n", hPbuffer, hDC);
-    return hDC;
+    physDev->current_pf = 1;
+    physDev->drawable = object->drawable;
+
+    TRACE("(%p)->(%p)\n", hPbuffer, physDev->hdc);
+    return physDev->hdc;
 }
 
 /* WGL_ARB_pbuffer: wglQueryPbufferARB */
@@ -2379,6 +2382,9 @@ static GLboolean WINAPI X11DRV_wglBindTe
         SetLastError(ERROR_INVALID_HANDLE);
         return GL_FALSE;
     }
+/* Disable WGL_ARB_render_texture support untill it is implemented properly
+ * using pbuffers or FBOs */
+#if 0
     if (!use_render_texture_ati && 1 == use_render_texture_emulation) {
         int do_init = 0;
         GLint prev_binded_tex;
@@ -2406,6 +2412,7 @@ static GLboolean WINAPI X11DRV_wglBindTe
         object->texture = prev_binded_tex;
         return GL_TRUE;
     }
+#endif
     if (NULL != pglXBindTexImageARB) {
         return pglXBindTexImageARB(object->display, object->drawable, iBuffer);
     }
@@ -2834,6 +2841,12 @@ PROC X11DRV_wglGetProcAddress(LPCSTR lps
     return NULL;
 }
 
+HDC X11DRV_wglGetPbufferDCARB(X11DRV_PDEVICE *hDevice, HPBUFFERARB hPbuffer)
+{
+    ERR_(opengl)("No OpenGL support compiled in.\n");
+    return NULL;
+}
+
 BOOL X11DRV_wglMakeContextCurrentARB(X11DRV_PDEVICE* hDrawDev, X11DRV_PDEVICE* hReadDev, HGLRC hglrc) {
     ERR_(opengl)("No OpenGL support compiled in.\n");
     return FALSE;
diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec
index b5b65b4..7d6214e 100644
--- a/dlls/winex11.drv/winex11.drv.spec
+++ b/dlls/winex11.drv/winex11.drv.spec
@@ -134,6 +134,7 @@ # OpenGL
 @ cdecl wglCreateContext(ptr) X11DRV_wglCreateContext
 @ cdecl wglDeleteContext(long) X11DRV_wglDeleteContext
 @ cdecl wglGetProcAddress(str) X11DRV_wglGetProcAddress
+@ cdecl wglGetPbufferDCARB(ptr ptr) X11DRV_wglGetPbufferDCARB
 @ cdecl wglMakeContextCurrentARB(ptr ptr long) X11DRV_wglMakeContextCurrentARB
 @ cdecl wglMakeCurrent(ptr long) X11DRV_wglMakeCurrent
 @ cdecl wglShareLists(long long) X11DRV_wglShareLists




More information about the wine-cvs mailing list