=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: ddraw: Create a sysmem surface if the format is not supported.

Alexandre Julliard julliard at winehq.org
Fri Sep 6 12:39:52 CDT 2013


Module: wine
Branch: master
Commit: b464067313bff1fd9a25b284b48a252025c4504f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b464067313bff1fd9a25b284b48a252025c4504f

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Fri Sep  6 00:11:10 2013 +0200

ddraw: Create a sysmem surface if the format is not supported.

---

 dlls/ddraw/ddraw.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 15ab187..df4dcd6 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -3000,6 +3000,27 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
         ddrawformat_from_wined3dformat(&desc2.u4.ddpfPixelFormat, mode.format_id);
     }
 
+    if (!(desc2.ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
+            && !(desc2.ddsCaps.dwCaps2 & DDSCAPS2_TEXTUREMANAGE))
+    {
+        enum wined3d_format_id format = wined3dformat_from_ddrawformat(&desc2.u4.ddpfPixelFormat);
+        enum wined3d_resource_type rtype;
+
+        if (desc2.ddsCaps.dwCaps & DDSCAPS_TEXTURE)
+            rtype = WINED3D_RTYPE_TEXTURE;
+        else if (desc2.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
+            rtype = WINED3D_RTYPE_CUBE_TEXTURE;
+        else
+            rtype = WINED3D_RTYPE_SURFACE;
+
+        hr = wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
+                mode.format_id, 0, rtype, format);
+        if (SUCCEEDED(hr))
+            desc2.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
+        else
+            desc2.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
+    }
+
     /* No Width or no Height? Use the original screen size
      */
     if(!(desc2.dwFlags & DDSD_WIDTH) ||




More information about the wine-cvs mailing list