Alexander Dorofeyev : ddraw: Force surfaces without memory flags to video memory on creation.

Alexandre Julliard julliard at winehq.org
Thu Jul 17 06:37:48 CDT 2008


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

Author: Alexander Dorofeyev <alexd4 at inbox.lv>
Date:   Tue Jul 15 00:58:08 2008 +0300

ddraw: Force surfaces without memory flags to video memory on creation.

Also removes now redundant setting of vidmem flag on rendertargets, prevents 
adding vidmem flag when sysmem flag is present. Fixes missing textures in Forsaken.

---

 dlls/ddraw/ddraw.c   |   14 +++++++-------
 dlls/ddraw/texture.c |    6 ------
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 9a47319..8b0ad9b 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1917,6 +1917,12 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
         }
     }
 
+    if (!(pDDSD->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY)) &&
+        !((pDDSD->ddsCaps.dwCaps & DDSCAPS_TEXTURE) && (pDDSD->ddsCaps.dwCaps2 & DDSCAPS2_TEXTUREMANAGE)) )
+    {
+        /* Tests show surfaces without memory flags get these flags added right after creation. */
+        pDDSD->ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY;
+    }
     /* Get the correct wined3d usage */
     if (pDDSD->ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE |
                                  DDSCAPS_BACKBUFFER     |
@@ -1924,8 +1930,7 @@ IDirectDrawImpl_CreateNewSurface(IDirectDrawImpl *This,
     {
         Usage |= WINED3DUSAGE_RENDERTARGET;
 
-        pDDSD->ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY |
-                                 DDSCAPS_VISIBLE;
+        pDDSD->ddsCaps.dwCaps |= DDSCAPS_VISIBLE;
     }
     if (pDDSD->ddsCaps.dwCaps & (DDSCAPS_OVERLAY))
     {
@@ -2345,11 +2350,6 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
         /* DVIDEO.DLL does forget the DDSD_CAPS flag ... *sigh* */
         DDSD->dwFlags |= DDSD_CAPS;
     }
-    if (DDSD->ddsCaps.dwCaps == 0)
-    {
-        /* This has been checked on real Windows */
-        DDSD->ddsCaps.dwCaps = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY;
-    }
 
     if (DDSD->ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD)
     {
diff --git a/dlls/ddraw/texture.c b/dlls/ddraw/texture.c
index c3be680..046a51e 100644
--- a/dlls/ddraw/texture.c
+++ b/dlls/ddraw/texture.c
@@ -324,12 +324,6 @@ IDirect3DTextureImpl_Load(IDirect3DTexture2 *iface,
 
         TRACE(" copying surface %p to surface %p (mipmap level %d)\n", src_ptr, This, src_ptr->mipmap_level);
 
-        if ( This->surface_desc.ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD )
-            /* If the surface is not allocated and its location is not yet specified,
-              force it to video memory */ 
-            if ( !(This->surface_desc.ddsCaps.dwCaps & (DDSCAPS_SYSTEMMEMORY|DDSCAPS_VIDEOMEMORY)) )
-                This->surface_desc.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
-
         /* Suppress the ALLOCONLOAD flag */
         This->surface_desc.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD;
 




More information about the wine-cvs mailing list