Browse Source

fixes a bug of not being able to open a high-res window and failing. now it tries a lower resolution before giving up

Asad M. Zaman 21 years ago
parent
commit
a7521b518e
2 changed files with 22 additions and 2 deletions
  1. 11 1
      panda/src/dxgsg8/wdxGraphicsWindow8.cxx
  2. 11 1
      panda/src/dxgsg9/wdxGraphicsWindow9.cxx

+ 11 - 1
panda/src/dxgsg8/wdxGraphicsWindow8.cxx

@@ -1448,13 +1448,23 @@ search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info) {
             << (bCouldntFindValidZBuf ? "Couldnt find valid zbuffer format to go with FullScreen mode" : "No supported FullScreen modes")
             << " at " << dwRenderWidth << "x" << dwRenderHeight << " for device #" << _wcontext.CardIDNum <<endl;
 
+          // if it failed because of a size constraints (for non-default case), try with default size
+          if (!bUseDefaultSize) {
+            wdxdisplay8_cat.info() << "was not a default: but trying 800x600 size in verbose mode\n";
+            dwRenderWidth=800;
+            dwRenderHeight=600;
+          }
+
           // run it again in verbose mode to get more dbg info to log
           dxpipe->search_for_valid_displaymode(_wcontext,dwRenderWidth, dwRenderHeight,
                                        bNeedZBuffer, bWantStencil,
                                        &_wcontext.SupportedScreenDepthsMask,
                                        &bCouldntFindValidZBuf,
                                        &pixFmt, dx_force_16bpp_zbuffer, true);
-          return false;
+          
+          // if still D3DFMT_UNKNOWN return false
+          if (pixFmt == D3DFMT_UNKNOWN)
+            return false;
         }
       }
     } else {

+ 11 - 1
panda/src/dxgsg9/wdxGraphicsWindow9.cxx

@@ -1435,13 +1435,23 @@ search_for_device(wdxGraphicsPipe9 *dxpipe, DXDeviceInfo *device_info) {
             << (bCouldntFindValidZBuf ? "Couldnt find valid zbuffer format to go with FullScreen mode" : "No supported FullScreen modes")
             << " at " << dwRenderWidth << "x" << dwRenderHeight << " for device #" << _wcontext.CardIDNum <<endl;
 
+          // if it failed because of a size constraints (for non-default case), try with default size
+          if (!bUseDefaultSize) {
+            wdxdisplay9_cat.info() << "was not a default: but trying 800x600 size in verbose mode\n";
+            dwRenderWidth=800;
+            dwRenderHeight=600;
+          }
+
           // run it again in verbose mode to get more dbg info to log
           dxpipe->search_for_valid_displaymode(_wcontext,dwRenderWidth, dwRenderHeight,
                                        bNeedZBuffer, bWantStencil,
                                        &_wcontext.SupportedScreenDepthsMask,
                                        &bCouldntFindValidZBuf,
                                        &pixFmt, dx_force_16bpp_zbuffer, true);
-          return false;
+
+          // if still D3DFMT_UNKNOWN return false
+          if (pixFmt == D3DFMT_UNKNOWN)
+            return false;
         }
       }
     } else {