[PATCH 2/5] ddraw: Don't set render target / depth stencil usage on sysmem surfaces.

Henri Verbeet hverbeet at codeweavers.com
Tue Sep 17 02:22:37 CDT 2013


Setting render target usage on a P8 surface for example would fail surface
creation, while such surfaces can't be used for actual rendering anyway. Tests
confirm that surface creation is supposed to succeed for P8 surfaces with both
DDSCAPS_SYSTEMMEMORY and DDSCAPS_3DDEVICE set.
---
 dlls/ddraw/surface.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index d23fc9c..416c13f 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -5740,9 +5740,12 @@ HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
     if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
         desc->ddsCaps.dwCaps |= DDSCAPS_VISIBLE;
 
-    if ((desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) && !(desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER))
+    if (!(desc->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY))
     {
-        usage |= WINED3DUSAGE_RENDERTARGET;
+        if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
+            usage |= WINED3DUSAGE_DEPTHSTENCIL;
+        else if (desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
+            usage |= WINED3DUSAGE_RENDERTARGET;
     }
 
     if (desc->ddsCaps.dwCaps & (DDSCAPS_OVERLAY))
@@ -5750,9 +5753,6 @@ HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
         usage |= WINED3DUSAGE_OVERLAY;
     }
 
-    if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
-        usage |= WINED3DUSAGE_DEPTHSTENCIL;
-
     if (desc->ddsCaps.dwCaps & DDSCAPS_OWNDC)
         usage |= WINED3DUSAGE_OWNDC;
 
-- 
1.7.10.4




More information about the wine-patches mailing list