wined3d: Always report D16 as Windows drivers report it on all cards (likely using...
authorRoderick Colenbrander <thunderbird2k@gmx.net>
Tue, 25 Mar 2008 10:02:20 +0000 (11:02 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 25 Mar 2008 15:14:03 +0000 (16:14 +0100)
dlls/wined3d/directx.c

index 0719ea11a0fed01485ed0fbb4fe9e352d20ad2e0..ef6b6df9d2fb6e8790dd334e53a7f7e452d50c28 100644 (file)
@@ -1656,6 +1656,7 @@ static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(const WineD3D_Pixe
 
 static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(const WineD3D_PixelFormat *cfg, WINED3DFORMAT Format) {
     short depthSize, stencilSize;
+    BOOL lockable = FALSE;
 
     if(!cfg)
         return FALSE;
@@ -1665,7 +1666,13 @@ static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(const WineD3D_Pixel
         return FALSE;
     }
 
-    if(cfg->depthSize != depthSize)
+    if((Format == WINED3DFMT_D16_LOCKABLE) || (Format == WINED3DFMT_D32F_LOCKABLE))
+        lockable = TRUE;
+
+    /* On some modern cards like the Geforce8/9 GLX doesn't offer some dephthstencil formats which D3D9 reports.
+     * We can safely report 'compatible' formats (e.g. D24 can be used for D16) as long as we aren't dealing with
+     * a lockable format. This also helps D3D <= 7 as they expect D16 which isn't offered without this on Geforce8 cards. */
+    if(!(cfg->depthSize == depthSize || (!lockable && cfg->depthSize > depthSize)))
         return FALSE;
 
     if(cfg->stencilSize != stencilSize)