On Wednesday 23 March 2005 22:15, [EMAIL PROTECTED] wrote:
> Sorry to keep bugging you guys about this, but a recent patch broke the
> opengl mode of World of Warcraft again.  It simply fails to start, similar
> to the d3d mode (except for the fact that I know why d3d mode doesn't work
> as of now).  I was scanning through the traces and saw no errors though. 
> Seemed odd to me, but I'm not a wine programmer so I'm not exactly sure
> what to look for anyway.  If anyone wants me to send a any sort of debug
> log (if, for instance, you don't have copy of WoW to test on), let me know
> (include what you'd want to see as well, if you don't mind).
>
> Thanks in advance,
> Darckness

Hi,

can you try with this patch ?

Regards,
Raphael

Index: wgl_ext.c
===================================================================
RCS file: /home/wine/wine/dlls/opengl32/wgl_ext.c,v
retrieving revision 1.4
diff -u -r1.4 wgl_ext.c
--- wgl_ext.c	10 Mar 2005 11:13:33 -0000	1.4
+++ wgl_ext.c	23 Mar 2005 22:35:50 -0000
@@ -31,6 +31,7 @@
 #include "winuser.h"
 #include "winerror.h"
 
+#include "gdi.h"
 #include "wgl.h"
 #include "wgl_ext.h"
 #include "opengl_ext.h"
@@ -133,6 +134,18 @@
   return bTest;
 }
 
+int (*p_glXSwapIntervalSGI)(int);
+BOOL query_function_swap_control(glXGetProcAddressARB_t proc, const char *gl_version, const char *gl_extensions, 
+				 const char* glx_version, const char *glx_extensions,
+				 const char *server_glx_extensions, const char *client_glx_extensions)
+{
+  BOOL bTest = (0 <= strcmp("1.3", glx_version) || NULL != strstr(glx_extensions, "GLX_SGIX_swap_group"));
+  if (bTest) {
+    p_glXSwapIntervalSGI = proc("glXSwapIntervalSGI");
+    bTest = (NULL != p_glXSwapIntervalSGI);
+  }
+  return bTest;
+}
 /***********************************************************************
  *              wglGetExtensionsStringEXT(OPENGL32.@)
  */
@@ -157,18 +170,21 @@
  *              wglSwapIntervalEXT(OPENGL32.@)
  */
 BOOL WINAPI wglSwapIntervalEXT(int interval) {
-    FIXME("(%d),stub!\n", interval);
-
-    swap_interval = interval;
-    return TRUE;
+  TRACE("(%d)\n", interval);
+  swap_interval = interval;
+  if (NULL != p_glXSwapIntervalSGI) {
+    return 0 == p_glXSwapIntervalSGI(interval);
+  }
+  WARN("(): GLX_SGI_swap_control extension seems not supported \n");
+  return TRUE;
 }
 
 /***********************************************************************
  *              wglGetSwapIntervalEXT(OPENGL32.@)
  */
 int WINAPI wglGetSwapIntervalEXT(VOID) {
-    FIXME("(),stub!\n");
-    return swap_interval;
+  TRACE("() returns %d\n", swap_interval);
+  return swap_interval;
 }
 
 typedef struct wine_glpbuffer {
@@ -226,9 +242,9 @@
 #define WGL_STENCIL_BITS_ARB			0x2023
 #define WGL_AUX_BUFFERS_ARB			0x2024
 
-#define WGL_PBUFFER_WIDTH_ARB                0x2034
-#define WGL_PBUFFER_HEIGHT_ARB               0x2035
-#define WGL_PBUFFER_LOST_ARB                 0x2036
+#define WGL_PBUFFER_WIDTH_ARB                   0x2034
+#define WGL_PBUFFER_HEIGHT_ARB                  0x2035
+#define WGL_PBUFFER_LOST_ARB                    0x2036
 
 #if 0 /* not used yet */
 static unsigned ConvertAttribGLXtoWGL(const int* iWGLAttr, int* oGLXAttr) {
@@ -273,6 +289,7 @@
     case WGL_SAMPLES_ARB:
     */
     default:
+      FIXME("unsupported %x WGL Attribute\n", iWGLAttr[cur]);
       break;
     }
     ++cur;
@@ -282,14 +299,108 @@
 
 GLboolean WINAPI wglGetPixelFormatAttribivARB(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues)
 {
-    TRACE("(%p, %d, %d, %d, %p, %p)\n", hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, piValues);
-    return GL_TRUE;
+  Display* display = get_display( hdc );
+  UINT i;
+  GLXFBConfig* cfgs = NULL;
+  GLXFBConfig  curCfg = NULL;
+  int nCfgs = 0;
+  int hTest;
+  int tmp;
+  int curGLXAttr = 0;
+
+  TRACE("(%p, %d, %d, %d, %p, %p)\n", hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, piValues);
+  
+  if (0 < iLayerPlane) {
+    FIXME("unsupported iLayerPlane(%d) > 0, returns FALSE\n", iLayerPlane);
+    return GL_FALSE;
+  }
+
+  cfgs = glXGetFBConfigs(display, DefaultScreen(display), &nCfgs);
+  if (NULL == cfgs) {
+    ERR("no FB Configs found for display(%p)\n", display);
+    return GL_FALSE;
+  }
+
+  for (i = 0; i < nAttributes; ++i) {
+    const int curWGLAttr = piAttributes[i];
+    
+    switch (curWGLAttr) {
+    case WGL_NUMBER_PIXEL_FORMATS_ARB:
+      piValues[i] = nCfgs; 
+      continue ;
+
+    case WGL_SUPPORT_OPENGL_ARB:
+      piValues[i] = GL_TRUE; 
+      continue ;
+
+    case WGL_TRANSPARENT_ARB:
+      curGLXAttr = GLX_TRANSPARENT_TYPE;
+      if (nCfgs < iPixelFormat) goto pix_error;
+      curCfg = cfgs[iPixelFormat];
+      hTest = glXGetFBConfigAttrib(display, curCfg, curGLXAttr, &tmp);
+      if (hTest) goto get_error;
+      piValues[i] = GL_FALSE;
+      if (GLX_NONE != tmp) piValues[i] = GL_TRUE;
+      continue ;
+      
+    case WGL_COLOR_BITS_ARB:
+      curGLXAttr = GLX_BUFFER_SIZE;
+      break;
+    case WGL_ALPHA_BITS_ARB:
+      curGLXAttr = GLX_ALPHA_SIZE;
+      break;
+    case WGL_DEPTH_BITS_ARB:
+      curGLXAttr = GLX_DEPTH_SIZE;
+      break;
+    case WGL_STENCIL_BITS_ARB:
+      curGLXAttr = GLX_STENCIL_SIZE;
+      break;
+    case WGL_DOUBLE_BUFFER_ARB:
+      curGLXAttr = GLX_DOUBLEBUFFER;
+      break;
+    case WGL_STEREO_ARB:
+      curGLXAttr = GLX_STEREO;
+      break;
+    case WGL_AUX_BUFFERS_ARB:
+      curGLXAttr = GLX_AUX_BUFFERS;
+      break;
+
+    case WGL_DRAW_TO_WINDOW_ARB:
+    case WGL_DRAW_TO_BITMAP_ARB:
+    case WGL_SUPPORT_GDI_ARB:
+      curGLXAttr = GLX_X_RENDERABLE;
+      break;
+
+    case WGL_ACCELERATION_ARB:
+    default:
+      FIXME("unsupported %x WGL Attribute\n", curWGLAttr);
+    }
+    
+    if (0 != curGLXAttr) {
+      if (nCfgs < iPixelFormat) goto pix_error;
+      curCfg = cfgs[iPixelFormat];
+      hTest = glXGetFBConfigAttrib(display, curCfg, curGLXAttr, piValues + i);
+      if (hTest) goto get_error;
+    } else { 
+      piValues[i] = GL_FALSE; 
+    }
+  }
+  
+  return GL_TRUE;
+
+get_error:
+  ERR("(%p): unexpected failure on GetFBConfigAttrib(%x) returns FALSE\n", hdc, curGLXAttr);
+  return GL_FALSE;
+
+pix_error:
+  ERR("(%p): unexpected iPixelFormat(%d) > nFormats(%d), returns FALSE\n", hdc, iPixelFormat, nCfgs);
+  return GL_FALSE;
 }
 
 GLboolean WINAPI wglGetPixelFormatAttribfvARB(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues)
 {
-    TRACE("(%p, %d, %d, %d, %p, %p)\n", hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, pfValues);
-    return GL_TRUE;
+    FIXME("(%p, %d, %d, %d, %p, %p): stub\n", hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, pfValues);
+    return GL_FALSE;
 }
 
 GLboolean WINAPI wglChoosePixelFormatARB(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats)
@@ -340,7 +451,10 @@
   PUSH1(attribs, None);
 
   cfgs = glXChooseFBConfig(display, DefaultScreen(display), attribs, &nCfgs);
-  if (nCfgs < iPixelFormat) return NULL; /* unespected error */
+  if (nCfgs < iPixelFormat) {
+    ERR("(%p): unexpected iPixelFormat(%d) > nFormats(%d), returns NULL\n", hdc, iPixelFormat, nCfgs);
+    return NULL; /* unespected error */
+  }
 
   --nAttribs; /** append more to attribs now we have fbConfig */
   PUSH2(attribs, GLX_PBUFFER_WIDTH,  iWidth);
@@ -434,7 +548,8 @@
   { "WGL_ARB_multisample", query_function_multisample },
   { "WGL_ARB_pbuffer", query_function_pbuffer },
   { "WGL_ARB_pixel_format" , query_function_pixel_format },
-  { "WGL_ARB_render_texture", query_function_render_texture }
+  { "WGL_ARB_render_texture", query_function_render_texture },
+  { "WGL_EXT_swap_control", query_function_swap_control }
 };
 
 /* Used to initialize the WGL extension string at DLL loading */

Attachment: pgpIWwvSXKs3c.pgp
Description: PGP signature

Reply via email to