[dx42] Debugging aid for d3d

Ann and Jason Edmeades us at the-edmeades.demon.co.uk
Mon May 26 09:31:08 CDT 2003


Although this patch does not actually fix anything, I am fed up with
working with huge debug logs, so this adds an option which can be
compiled in, and allows me to turn tracing on and off at will, or
alternatively turn tracing off for a single frame alone. Note the
control is via existance of a file C:\D3DTRACE, which isnt pretty but
its simple. 

Changelog

Add compilable debugging aid to get trace from the middle of a game. 

Jason
-------------- next part --------------
--- dlls/d3d8/device.dx41	2003-05-24 22:55:20.000000000 +0100
+++ dlls/d3d8/device.c	2003-05-26 16:20:54.000000000 +0100
@@ -41,6 +41,17 @@
 WINE_DECLARE_DEBUG_CHANNEL(d3d_shader);
 
 /* Some #defines for additional diagnostics */
+#if 0
+  /* To avoid having to get gigabytes of trace, the following can be compiled in, and at the start
+     of each frame, a check is made for the existance of C:\D3DTRACE, and if if exists d3d trace
+     is enabled, and if it doesnt exists it is disabled. Adding in the SINGLE_FRAME_DEBUGGING
+     gives a trace of just what makes up a single frame                                           */
+  #define FRAME_DEBUGGING
+  #if 1
+    #define SINGLE_FRAME_DEBUGGING
+  #endif  
+  static BOOL isOn  = FALSE;
+#endif
 
 /* Per-vertex trace: */
 #if 0
@@ -1487,6 +1498,31 @@
     /* Dont call checkGLcall, as glGetError is not applicable here */
     TRACE("glXSwapBuffers called, Starting new frame");
 
+#if defined(FRAME_DEBUGGING)
+{
+    DWORD res = GetFileAttributesA("C:\\D3DTRACE");
+    if (res != INVALID_FILE_ATTRIBUTES) {
+        if (!isOn) {
+            isOn = TRUE;
+            FIXME("Enabling D3D Trace\n");
+            __WINE_SET_DEBUGGING(__WINE_DBCL_TRACE, __wine_dbch_d3d, 1);
+#if defined(SINGLE_FRAME_DEBUGGING)
+        } else {
+            FIXME("Singe Frame trace complete\n");
+            DeleteFileA("C:\\D3DTRACE");
+            __WINE_SET_DEBUGGING(__WINE_DBCL_TRACE, __wine_dbch_d3d, 0);
+#endif
+        }
+    } else {
+        if (isOn) {
+            isOn = FALSE;
+            FIXME("Disabling D3D Trace\n");
+            __WINE_SET_DEBUGGING(__WINE_DBCL_TRACE, __wine_dbch_d3d, 0);
+        }
+    }
+}
+#endif
+
     LEAVE_GL();
 
     return D3D_OK;


More information about the wine-patches mailing list