[PATCH] The previous CheckDeviceFormat in wined3d allowed invalid format/usage combinations. Ddraw used Unknown to check which depthstencil formats were around. Now use a correct resource type and a valid format. This should fix a MAJOR regression which broke more or less all d3d <= 7 apps.

Roderick Colenbrander thunderbird2k at gmx.net
Fri Mar 21 08:53:54 CDT 2008


---
 dlls/ddraw/direct3d.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/ddraw/direct3d.c b/dlls/ddraw/direct3d.c
index a89dcb4..00c9d68 100644
--- a/dlls/ddraw/direct3d.c
+++ b/dlls/ddraw/direct3d.c
@@ -1131,6 +1131,7 @@ IDirect3DImpl_7_EnumZBufferFormats(IDirect3D7 *iface,
     ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
     HRESULT hr;
     int i;
+    WINED3DDISPLAYMODE d3ddm;
 
     /* Order matters. Specifically, BattleZone II (full version) expects the
      * 16-bit depth formats to be listed before the 24 and 32 ones. */
@@ -1145,6 +1146,11 @@ IDirect3DImpl_7_EnumZBufferFormats(IDirect3D7 *iface,
 
     TRACE("(%p)->(%s,%p,%p): Relay\n", iface, debugstr_guid(refiidDevice), Callback, Context);
 
+    if(IWineD3D_GetAdapterDisplayMode(This->wineD3D, WINED3DADAPTER_DEFAULT, &d3ddm ) != WINED3D_OK) {
+        ERR("Unable to retrieve a default display mode for quering the z-buffer formats!\n");
+        return DDERR_INVALIDPARAMS;
+    }
+
     if(!Callback)
         return DDERR_INVALIDPARAMS;
 
@@ -1154,9 +1160,9 @@ IDirect3DImpl_7_EnumZBufferFormats(IDirect3D7 *iface,
         hr = IWineD3D_CheckDeviceFormat(This->wineD3D,
                                         0 /* Adapter */,
                                         0 /* DeviceType */,
-                                        0 /* AdapterFormat */,
+                                        d3ddm.Format /* AdapterFormat */,
                                         WINED3DUSAGE_DEPTHSTENCIL /* Usage */,
-                                        0 /* ResourceType */,
+                                        WINED3DRTYPE_SURFACE /* ResourceType */,
                                         FormatList[i]);
         if(hr == D3D_OK)
         {
-- 
1.5.3.4


--========GMX167581206107443335160--



More information about the wine-patches mailing list