Alexandre Julliard : winex11: Make OpenGL traces more compact and readable.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 18 10:33:30 CST 2015


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Nov 18 23:05:20 2015 +0900

winex11: Make OpenGL traces more compact and readable.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winex11.drv/opengl.c | 51 +++++++++++++++--------------------------------
 1 file changed, 16 insertions(+), 35 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 03a958e..3d0bd24 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -740,16 +740,15 @@ failed:
     return FALSE;
 }
 
-static int describeContext( struct wgl_context *ctx ) {
-    int tmp;
-    int ctx_vis_id;
-    TRACE(" Context %p have (vis:%p):\n", ctx, ctx->vis);
-    pglXGetFBConfigAttrib(gdi_display, ctx->fmt->fbconfig, GLX_FBCONFIG_ID, &tmp);
-    TRACE(" - FBCONFIG_ID 0x%x\n", tmp);
-    pglXGetFBConfigAttrib(gdi_display, ctx->fmt->fbconfig, GLX_VISUAL_ID, &tmp);
-    TRACE(" - VISUAL_ID 0x%x\n", tmp);
-    ctx_vis_id = tmp;
-    return ctx_vis_id;
+static const char *debugstr_fbconfig( GLXFBConfig fbconfig )
+{
+    int id, visual, drawable;
+
+    if (pglXGetFBConfigAttrib( gdi_display, fbconfig, GLX_FBCONFIG_ID, &id ))
+        return "*** invalid fbconfig";
+    pglXGetFBConfigAttrib( gdi_display, fbconfig, GLX_VISUAL_ID, &visual );
+    pglXGetFBConfigAttrib( gdi_display, fbconfig, GLX_DRAWABLE_TYPE, &drawable );
+    return wine_dbg_sprintf( "fbconfig %#x visual id %#x drawable type %#x", id, visual, drawable );
 }
 
 static int ConvertAttribWGLtoGLX(const int* iWGLAttr, int* oGLXAttr, struct wgl_pbuffer* pbuf) {
@@ -1408,7 +1407,8 @@ static BOOL set_win_format( HWND hwnd, const struct wgl_pixel_format *format )
         return FALSE;
     }
 
-    TRACE("created GL drawable %lx for win %p format %x\n", gl->drawable, hwnd, format->fmt_id );
+    TRACE( "created GL drawable %lx for win %p %s\n",
+           gl->drawable, hwnd, debugstr_fbconfig( format->fbconfig ));
 
     XFlush( gdi_display );
 
@@ -1465,22 +1465,6 @@ static BOOL set_pixel_format(HDC hdc, int format, BOOL allow_change)
         }
     }
 
-    if (TRACE_ON(wgl)) {
-        int gl_test = 0;
-
-        gl_test = pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_FBCONFIG_ID, &value);
-        if (gl_test) {
-           ERR("Failed to retrieve FBCONFIG_ID from GLXFBConfig, expect problems.\n");
-        } else {
-            TRACE(" FBConfig have :\n");
-            TRACE(" - FBCONFIG_ID   0x%x\n", value);
-            pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_VISUAL_ID, &value);
-            TRACE(" - VISUAL_ID     0x%x\n", value);
-            pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DRAWABLE_TYPE, &value);
-            TRACE(" - DRAWABLE_TYPE 0x%x\n", value);
-        }
-    }
-
     return set_win_format( hwnd, fmt );
 }
 
@@ -1858,10 +1842,8 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx)
             goto done;
         }
 
-        if (TRACE_ON(wgl)) {
-            describeContext(ctx);
-            TRACE("hdc %p drawable %lx fmt %p ctx %p\n", hdc, gl->drawable, gl->format, ctx->ctx );
-        }
+        TRACE("hdc %p drawable %lx fmt %p ctx %p %s\n", hdc, gl->drawable, gl->format, ctx->ctx,
+              debugstr_fbconfig( gl->format->fbconfig ));
 
         ret = pglXMakeCurrent(gdi_display, gl->drawable, ctx->ctx);
         if (ret)
@@ -1957,13 +1939,12 @@ static BOOL glxdrv_wglShareLists(struct wgl_context *org, struct wgl_context *de
     }
     else
     {
-        describeContext(org);
-        describeContext(dest);
-
         /* Re-create the GLX context and share display lists */
         pglXDestroyContext(gdi_display, dest->ctx);
         dest->ctx = create_glxcontext(gdi_display, dest, org->ctx);
-        TRACE(" re-created an OpenGL context (%p) for Wine context %p sharing lists with OpenGL ctx %p\n", dest->ctx, dest, org->ctx);
+        TRACE(" re-created context (%p) for Wine context %p (%s) sharing lists with ctx %p (%s)\n",
+              dest->ctx, dest, debugstr_fbconfig(dest->fmt->fbconfig),
+              org->ctx, debugstr_fbconfig( org->fmt->fbconfig));
 
         org->sharing = TRUE;
         dest->sharing = TRUE;




More information about the wine-cvs mailing list