[PATCH] Ati's latest drivers (8.41.7) don't advertise visualids anymore for GLXFBConfigs. This is likely a bug in their driver as you can get a XVisualInfo properly. Lots of people will be moving over to this driver version and without this change (the change is not really a hack) Wine will work. Without it wine will crash in everything that uses OpenGL or Direct3D.

Roderick Colenbrander thunderbird2k at gmx.net
Wed Sep 12 18:04:30 CDT 2007


---
 dlls/winex11.drv/opengl.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 3dab1b6..4d61666 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -814,9 +814,10 @@ static int get_render_type_from_fbconfig(Display *display, GLXFBConfig fbconfig)
 
 static BOOL init_formats(Display *display, int screen, Visual *visual)
 {
-    int fmt_id, tmp_vis_id, tmp_fmt_id, nCfgs, i;
+    int fmt_id, tmp_fmt_id, nCfgs, i;
     GLXFBConfig* cfgs;
     GLXFBConfig fbconfig = NULL;
+    XVisualInfo *visinfo;
     VisualID visualid = XVisualIDFromVisual(visual);
     int nOffscreenFormats = 0;
 
@@ -833,18 +834,20 @@ static BOOL init_formats(Display *display, int screen, Visual *visual)
 
     /* Count the number of offscreen formats to determine the size for our pixelformat list */
     for(i=0; i<nCfgs; i++) {
-        pglXGetFBConfigAttrib(display, cfgs[i], GLX_VISUAL_ID, &tmp_vis_id);
+        pglXGetFBConfigAttrib(display, cfgs[i], GLX_FBCONFIG_ID, &tmp_fmt_id);
 
-        /* We have found Wine's main visual */
-        if(tmp_vis_id == visualid) {
+        visinfo = pglXGetVisualFromFBConfig(display, cfgs[i]);
+        /* We have found an offscreen rendering format when there is no visualinfo :) */
+        if(visinfo->visualid == visualid) {
             pglXGetFBConfigAttrib(display, cfgs[i], GLX_FBCONFIG_ID, &fmt_id);
             fbconfig = cfgs[i];
         }
 
         /* We have found an offscreen rendering format :) */
-        if(tmp_vis_id == 0) {
+        if(!visinfo) {
             nOffscreenFormats++;
         }
+        XFree(visinfo);
     }
     TRACE("Number of offscreen formats: %d\n", nOffscreenFormats);
 
@@ -860,11 +863,11 @@ static BOOL init_formats(Display *display, int screen, Visual *visual)
 
     /* Fill the list with offscreen formats */
     for(i=0; i<nCfgs; i++) {
-        pglXGetFBConfigAttrib(display, cfgs[i], GLX_VISUAL_ID, &tmp_vis_id);
         pglXGetFBConfigAttrib(display, cfgs[i], GLX_FBCONFIG_ID, &tmp_fmt_id);
 
-        /* We have found an offscreen rendering format :) */
-        if(tmp_vis_id == 0) {
+        visinfo = pglXGetVisualFromFBConfig(display, cfgs[i]);
+        /* We have found an offscreen rendering format when there is no visualinfo :) */
+        if(!visinfo) {
             TRACE("Found offscreen format FBCONFIG_ID 0x%x corresponding to iPixelFormat %d at GLX index %d\n", tmp_fmt_id, WineGLPixelFormatListSize+1, i);
             WineGLPixelFormatList[WineGLPixelFormatListSize].iPixelFormat = WineGLPixelFormatListSize+1; /* The index starts at 1 */
             WineGLPixelFormatList[WineGLPixelFormatListSize].fbconfig = cfgs[i];
@@ -873,6 +876,7 @@ static BOOL init_formats(Display *display, int screen, Visual *visual)
             WineGLPixelFormatList[WineGLPixelFormatListSize].offscreenOnly = TRUE;
             WineGLPixelFormatListSize++;
         }
+        XFree(visinfo);
     }
 
     if(cfgs != NULL) XFree(cfgs);
-- 
1.5.2.4


--========GMX138231189638554199735--



More information about the wine-patches mailing list