Tomas Carnecky : winex11.drv: Spring cleanup in X11DRV_setup_opengl_visual, and added one new visual config (with aux buffers).

Alexandre Julliard julliard at wine.codeweavers.com
Thu Mar 1 05:59:47 CST 2007


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

Author: Tomas Carnecky <tom at dbservice.com>
Date:   Thu Mar  1 12:06:45 2007 +0100

winex11.drv: Spring cleanup in X11DRV_setup_opengl_visual, and added one new visual config (with aux buffers).

---

 dlls/winex11.drv/opengl.c |   49 +++++++++++++++++++++-----------------------
 1 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index fdb92ae..df8e29e 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -3083,37 +3083,34 @@ BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev)
 XVisualInfo *X11DRV_setup_opengl_visual( Display *display )
 {
     XVisualInfo *visual = NULL;
-    /* In order to support OpenGL or D3D, we require a double-buffered visual and stencil buffer support, */
-    int dblBuf[] = {GLX_RGBA,GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_DOUBLEBUFFER, None};
-    if (!has_opengl()) return NULL;
+    int i;
+
+    /* In order to support OpenGL or D3D, we require a double-buffered visual and stencil buffer support,
+     * D3D and some applications can make use of aux buffers.
+     */
+    int visualProperties[][11] = {
+        { GLX_RGBA, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_AUX_BUFFERS, 1, None },
+        { GLX_RGBA, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, GLX_ALPHA_SIZE, 8, None },
+        { GLX_RGBA, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, 16, GLX_STENCIL_SIZE, 8, None },
+        { GLX_RGBA, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, 16, None },
+    };
+
+    if (!has_opengl())
+        return NULL;
 
     wine_tsx11_lock();
-    visual = pglXChooseVisual(display, DefaultScreen(display), dblBuf);
+    for (i = 0; i < sizeof(visualProperties)/sizeof(visualProperties[0]); ++i) {
+        visual = pglXChooseVisual(display, DefaultScreen(display), visualProperties[i]);
+        if (visual)
+            break;
+    }
     wine_tsx11_unlock();
-    if (visual == NULL) {
-        /* fallback to 16 bits depth, no alpha */
-        int dblBuf2[] = {GLX_RGBA,GLX_DEPTH_SIZE, 16, GLX_STENCIL_SIZE, 8, GLX_DOUBLEBUFFER, None};
-        WARN("Failed to get a visual with at least 24 bits depth\n");
 
-        wine_tsx11_lock();
-        visual = pglXChooseVisual(display, DefaultScreen(display), dblBuf2);
-        wine_tsx11_unlock();
-        if (visual == NULL) {
-            /* fallback to no stencil */
-            int dblBuf2[] = {GLX_RGBA,GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER, None};
-            WARN("Failed to get a visual with at least 8 bits of stencil\n");
+    if (visual)
+        TRACE("Visual ID %lx Chosen\n", visual->visualid);
+    else
+        WARN("No suitable visual found\n");
 
-            wine_tsx11_lock();
-            visual = pglXChooseVisual(display, DefaultScreen(display), dblBuf2);
-            wine_tsx11_unlock();
-            if (visual == NULL) {
-                /* This should only happen if we cannot find a match with a depth size 16 */
-                FIXME("Failed to find a suitable visual\n");
-                return visual;
-            }
-        }
-    }
-    TRACE("Visual ID %lx Chosen\n",visual->visualid);
     return visual;
 }
 




More information about the wine-cvs mailing list