Roderick Colenbrander : wgl: Get rid of glXQueryDrawable because officially it only works on GLXDrawables .

Alexandre Julliard julliard at winehq.org
Wed Jun 17 10:43:23 CDT 2009


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

Author: Roderick Colenbrander <thunderbird2k at gmail.com>
Date:   Tue Jun 16 23:49:12 2009 +0200

wgl: Get rid of glXQueryDrawable because officially it only works on GLXDrawables.

Nvidia allows it to operate on a standard Window too but Mesa and AMD
don't and this isn't needed according to the GLX specs. This prevents
crashes when creating +wgl logs.

---

 dlls/winex11.drv/opengl.c |   41 ++++++++++++++---------------------------
 1 files changed, 14 insertions(+), 27 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index f207a32..f1557b6 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -146,6 +146,7 @@ static const WineGLExtension *WineGLExtensionList[MAX_EXTENSIONS];
 static int WineGLExtensionListSize;
 
 static void X11DRV_WineGL_LoadExtensions(void);
+static WineGLPixelFormat* ConvertPixelFormatWGLtoGLX(Display *display, int iPixelFormat, BOOL AllowOffscreen, int *fmt_count);
 static BOOL glxRequireVersion(int requiredVersion);
 static BOOL glxRequireExtension(const char *requiredExtension);
 
@@ -582,37 +583,23 @@ static int describeContext(Wine_GLContext* ctx) {
     return ctx_vis_id;
 }
 
-static int describeDrawable(Wine_GLContext* ctx, Drawable drawable) {
+static BOOL describeDrawable(X11DRV_PDEVICE *physDev) {
     int tmp;
-    int nElements;
-    int attribList[3] = { GLX_FBCONFIG_ID, 0, None };
-    GLXFBConfig *fbCfgs;
-
-    if (pglXQueryDrawable == NULL)  {
-        /** glXQueryDrawable not available so returns not supported */
-        return -1;
-    }
-
-    TRACE(" Drawable %p have :\n", (void*) drawable);
-    pglXQueryDrawable(gdi_display, drawable, GLX_WIDTH, (unsigned int*) &tmp);
-    TRACE(" - WIDTH as %d\n", tmp);
-    pglXQueryDrawable(gdi_display, drawable, GLX_HEIGHT, (unsigned int*) &tmp);
-    TRACE(" - HEIGHT as %d\n", tmp);
-    pglXQueryDrawable(gdi_display, drawable, GLX_FBCONFIG_ID, (unsigned int*) &tmp);
-    TRACE(" - FBCONFIG_ID as 0x%x\n", tmp);
+    WineGLPixelFormat *fmt;
+    int fmt_count = 0;
 
-    attribList[1] = tmp;
-    fbCfgs = pglXChooseFBConfig(gdi_display, DefaultScreen(gdi_display), attribList, &nElements);
-    if (fbCfgs == NULL) {
-        return -1;
-    }
+    fmt = ConvertPixelFormatWGLtoGLX(gdi_display, physDev->current_pf, TRUE /* Offscreen */, &fmt_count);
+    if(!fmt) return FALSE;
 
-    pglXGetFBConfigAttrib(gdi_display, fbCfgs[0], GLX_VISUAL_ID, &tmp);
-    TRACE(" - VISUAL_ID as 0x%x\n", tmp);
+    TRACE(" HDC %p has:\n", physDev->hdc);
+    TRACE(" - iPixelFormat %d\n", fmt->iPixelFormat);
+    TRACE(" - Drawable %p\n", (void*) get_glxdrawable(physDev));
+    TRACE(" - FBCONFIG_ID 0x%x\n", fmt->fmt_id);
 
-    XFree(fbCfgs);
+    pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_VISUAL_ID, &tmp);
+    TRACE(" - VISUAL_ID 0x%x\n", tmp);
 
-    return tmp;
+    return TRUE;
 }
 
 static int ConvertAttribWGLtoGLX(const int* iWGLAttr, int* oGLXAttr, Wine_GLPBuffer* pbuf) {
@@ -1842,7 +1829,7 @@ BOOL CDECL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
         if (ctx->ctx == NULL) {
             /* The describe lines below are for debugging purposes only */
             if (TRACE_ON(wgl)) {
-                describeDrawable(ctx, drawable);
+                describeDrawable(physDev);
                 describeContext(ctx);
             }
 




More information about the wine-cvs mailing list