Chris Robinson : wgl: GDI support is not advertised with double buffering.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Aug 15 04:34:01 CDT 2007


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

Author: Chris Robinson <chris.kcat at gmail.com>
Date:   Mon Aug 13 18:36:46 2007 -0700

wgl: GDI support is not advertised with double buffering.

---

 dlls/opengl32/tests/opengl.c |   26 ++++++++++++++++++++++++++
 dlls/winex11.drv/opengl.c    |   13 ++++++++++++-
 2 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c
index 6ef1d25..2aca1d6 100644
--- a/dlls/opengl32/tests/opengl.c
+++ b/dlls/opengl32/tests/opengl.c
@@ -35,6 +35,9 @@ static int (WINAPI *pwglReleasePbufferDCARB)(HPBUFFERARB, HDC);
 #define WGL_GREEN_BITS_ARB 0x2017
 #define WGL_BLUE_BITS_ARB  0x2019
 #define WGL_ALPHA_BITS_ARB 0x201B
+#define WGL_SUPPORT_GDI_ARB   0x200F
+#define WGL_DOUBLE_BUFFER_ARB 0x2011
+
 static BOOL (WINAPI *pwglChoosePixelFormatARB)(HDC, const int *, const FLOAT *, UINT, int *, UINT *);
 static BOOL (WINAPI *pwglGetPixelFormatAttribivARB)(HDC, int, int, UINT, const int *, int *);
 
@@ -225,6 +228,28 @@ static void test_colorbits(HDC hdc)
                                        iAttribRet[0], iAttribRet[1]);
 }
 
+static void test_gdi_dbuf(HDC hdc)
+{
+    const int iAttribList[] = { WGL_SUPPORT_GDI_ARB, WGL_DOUBLE_BUFFER_ARB };
+    int iAttribRet[sizeof(iAttribList)/sizeof(iAttribList[0])];
+    unsigned int nFormats;
+    int iPixelFormat;
+    int res;
+
+    nFormats = DescribePixelFormat(hdc, 0, 0, NULL);
+    for(iPixelFormat = 1;iPixelFormat <= nFormats;iPixelFormat++)
+    {
+        res = pwglGetPixelFormatAttribivARB(hdc, iPixelFormat, 0,
+                  sizeof(iAttribList)/sizeof(iAttribList[0]), iAttribList,
+                  iAttribRet);
+        ok(res!=FALSE, "wglGetPixelFormatAttribivARB failed for pixel format %d\n", iPixelFormat);
+        if(res == FALSE)
+            continue;
+
+        ok(!(iAttribRet[0] && iAttribRet[1]), "GDI support and double buffering on pixel format %d\n", iPixelFormat);
+    }
+}
+
 START_TEST(opengl)
 {
     HWND hwnd;
@@ -274,6 +299,7 @@ START_TEST(opengl)
 
         test_setpixelformat();
         test_colorbits(hdc);
+        test_gdi_dbuf(hdc);
 
         wgl_extensions = pwglGetExtensionsStringARB(hdc);
         if(wgl_extensions == NULL) skip("Skipping opengl32 tests because this OpenGL implementation doesn't support WGL extensions!\n");
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 62d7e2d..516de5f 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1301,7 +1301,11 @@ int X11DRV_DescribePixelFormat(X11DRV_PDEVICE *physDev,
   if(value == GLX_SLOW_CONFIG)
       ppfd->dwFlags |= PFD_GENERIC_ACCELERATED;
 
-  pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DOUBLEBUFFER, &value); if (value) ppfd->dwFlags |= PFD_DOUBLEBUFFER;
+  pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DOUBLEBUFFER, &value);
+  if (value) {
+      ppfd->dwFlags |= PFD_DOUBLEBUFFER;
+      ppfd->dwFlags &= ~PFD_SUPPORT_GDI;
+  }
   pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_STEREO, &value); if (value) ppfd->dwFlags |= PFD_STEREO;
 
   /* Pixel type */
@@ -2773,6 +2777,13 @@ static GLboolean WINAPI X11DRV_wglGetPixelFormatAttribivARB(HDC hdc, int iPixelF
                 break;
 
             case WGL_SUPPORT_GDI_ARB:
+                if (!fmt) goto pix_error;
+                hTest = pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DOUBLEBUFFER, &tmp);
+                if (hTest) goto get_error;
+                if(tmp) {
+                    piValues[i] = GL_FALSE;
+                    continue;
+                }
                 curGLXAttr = GLX_X_RENDERABLE;
                 break;
 




More information about the wine-cvs mailing list