Henri Verbeet : ddraw: Take surface usage into account when checking format capabilities in CreateSurface ().

Alexandre Julliard julliard at winehq.org
Mon Sep 16 16:57:22 CDT 2013


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon Sep 16 10:57:26 2013 +0200

ddraw: Take surface usage into account when checking format capabilities in CreateSurface().

---

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

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index d3385e0..608804f 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -3005,6 +3005,7 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
     {
         enum wined3d_format_id format = wined3dformat_from_ddrawformat(&desc2.u4.ddpfPixelFormat);
         enum wined3d_resource_type rtype;
+        DWORD usage = 0;
 
         if (desc2.ddsCaps.dwCaps & DDSCAPS_TEXTURE)
             rtype = WINED3D_RTYPE_TEXTURE;
@@ -3013,8 +3014,13 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
         else
             rtype = WINED3D_RTYPE_SURFACE;
 
+        if (desc2.ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
+            usage = WINED3DUSAGE_DEPTHSTENCIL;
+        else if (desc2.ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
+            usage = WINED3DUSAGE_RENDERTARGET;
+
         hr = wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
-                mode.format_id, 0, rtype, format);
+                mode.format_id, usage, rtype, format);
         if (SUCCEEDED(hr))
             desc2.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
         else




More information about the wine-cvs mailing list