wined3d: replace #ifdef with if() for DEBUG_SINGLE_MODE

Jan Zerebecki jan.wine at zerebecki.de
Fri Feb 23 02:27:42 CST 2007


If this patch is rejected from inclusion, please tell me why, as
I would have to ask anyway.

From: Jan Zerebecki <jan.wine at zerebecki.de>
Changelog:
wined3d: replace #ifdef with if() for DEBUG_SINGLE_MODE
and set refreshrate to 60 instead of 0.
---

 dlls/wined3d/directx.c |   70 +++++++++++++++++++++++++-----------------------
 1 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 9e5438b..dd934ad 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -23,8 +23,10 @@
 
 /* Compile time diagnostics: */
 
-/* Uncomment this to force only a single display mode to be exposed: */
-/*#define DEBUG_SINGLE_MODE*/
+#ifndef DEBUG_SINGLE_MODE
+/* Set to 1 to force only a single display mode to be exposed: */
+#define DEBUG_SINGLE_MODE 0
+#endif
 
 
 #include "config.h"
@@ -1093,32 +1095,34 @@ static UINT     WINAPI IWineD3DImpl_GetAdapterModeCount(IWineD3D *iface, UINT Ad
     if (Adapter == 0) { /* Display */
         int i = 0;
         int j = 0;
-#if !defined( DEBUG_SINGLE_MODE )
-        DEVMODEW DevModeW;
 
-        while (EnumDisplaySettingsExW(NULL, j, &DevModeW, 0)) {
-            j++;
-            switch (Format)
-            {
-                case WINED3DFMT_UNKNOWN:
-                    if (DevModeW.dmBitsPerPel == 32 ||
-                        DevModeW.dmBitsPerPel == 16) i++;
-                    break;
-                case WINED3DFMT_X8R8G8B8:
-                    if (DevModeW.dmBitsPerPel == 32) i++;
-                    break;
-                case WINED3DFMT_R5G6B5:
-                    if (DevModeW.dmBitsPerPel == 16) i++;
-                    break;
-                default:
-                    /* Skip other modes as they do not match the requested format */
-                    break;
+        if (!DEBUG_SINGLE_MODE) {
+            DEVMODEW DevModeW;
+
+            while (EnumDisplaySettingsExW(NULL, j, &DevModeW, 0)) {
+                j++;
+                switch (Format)
+                {
+                    case WINED3DFMT_UNKNOWN:
+                        if (DevModeW.dmBitsPerPel == 32 ||
+                            DevModeW.dmBitsPerPel == 16) i++;
+                        break;
+                    case WINED3DFMT_X8R8G8B8:
+                        if (DevModeW.dmBitsPerPel == 32) i++;
+                        break;
+                    case WINED3DFMT_R5G6B5:
+                        if (DevModeW.dmBitsPerPel == 16) i++;
+                        break;
+                    default:
+                        /* Skip other modes as they do not match the requested format */
+                        break;
+                }
             }
+        } else {
+            i = 1;
+            j = 1;
         }
-#else
-        i = 1;
-        j = 1;
-#endif
+
         TRACE_(d3d_caps)("(%p}->(Adapter: %d) => %d (out of %d)\n", This, Adapter, i, j);
         return i;
     } else {
@@ -1139,8 +1143,7 @@ static HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapte
         return WINED3DERR_INVALIDCALL;
     }
 
-    if (Adapter == 0) { /* Display */
-#if !defined( DEBUG_SINGLE_MODE )
+    if (Adapter == 0 && !DEBUG_SINGLE_MODE) { /* Display */
         DEVMODEW DevModeW;
         int ModeIdx = 0;
         int i = 0;
@@ -1205,18 +1208,17 @@ static HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapte
             return WINED3DERR_INVALIDCALL;
         }
 
-#else
+        TRACE_(d3d_caps)("W %d H %d rr %d fmt (%x - %s) bpp %u\n", pMode->Width, pMode->Height,
+                pMode->RefreshRate, pMode->Format, debug_d3dformat(pMode->Format),
+                DevModeW.dmBitsPerPel);
+
+    } else if (DEBUG_SINGLE_MODE) {
         /* Return one setting of the format requested */
         if (Mode > 0) return WINED3DERR_INVALIDCALL;
         pMode->Width        = 800;
         pMode->Height       = 600;
-        pMode->RefreshRate  = WINED3DADAPTER_DEFAULT;
+        pMode->RefreshRate  = 60;
         pMode->Format       = (Format == WINED3DFMT_UNKNOWN) ? WINED3DFMT_X8R8G8B8 : Format;
-#endif
-        TRACE_(d3d_caps)("W %d H %d rr %d fmt (%x - %s) bpp %u\n", pMode->Width, pMode->Height,
-                 pMode->RefreshRate, pMode->Format, debug_d3dformat(pMode->Format),
-                 DevModeW.dmBitsPerPel);
-
     } else {
         FIXME_(d3d_caps)("Adapter not primary display\n");
     }



More information about the wine-patches mailing list