[PATCH 1/5] ddraw: Set WINED3D_SURFACE_PIN_SYSMEM directly in ddraw_surface_create_texture().

Henri Verbeet hverbeet at codeweavers.com
Thu Nov 14 03:47:15 CST 2013


---
 dlls/ddraw/ddraw.c         |   10 ++--------
 dlls/ddraw/ddraw_private.h |    2 +-
 dlls/ddraw/surface.c       |   12 +++++++++---
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index a5422da..87bf33d 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -2868,12 +2868,6 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
     HRESULT hr;
     DDSURFACEDESC2 desc2;
     const DWORD sysvidmem = DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
-    /* Some applications assume surfaces will always be mapped at the same
-     * address. Some of those also assume that this address is valid even when
-     * the surface isn't mapped, and that updates done this way will be
-     * visible on the screen. The game Nox is such an application,
-     * Commandos: Behind Enemy Lines is another. */
-    const DWORD flags = WINED3D_SURFACE_PIN_SYSMEM;
 
     TRACE("ddraw %p, surface_desc %p, surface %p, outer_unknown %p.\n", ddraw, DDSD, surface, UnkOuter);
 
@@ -3116,7 +3110,7 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
         }
     }
 
-    if (FAILED(hr = ddraw_surface_create_texture(ddraw, &desc2, version, flags, &object)))
+    if (FAILED(hr = ddraw_surface_create_texture(ddraw, &desc2, version, &object)))
     {
         WARN("Failed to create texture, hr %#x.\n", hr);
         return hr;
@@ -3143,7 +3137,7 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
         {
             struct ddraw_surface *object2 = NULL;
 
-            if (FAILED(hr = ddraw_surface_create_texture(ddraw, &desc2, version, flags, &object2)))
+            if (FAILED(hr = ddraw_surface_create_texture(ddraw, &desc2, version, &object2)))
             {
                 if (version == 7)
                     IDirectDrawSurface7_Release(&object->IDirectDrawSurface7_iface);
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h
index 8c37a1e..19f1107 100644
--- a/dlls/ddraw/ddraw_private.h
+++ b/dlls/ddraw/ddraw_private.h
@@ -194,7 +194,7 @@ struct ddraw_texture
 };
 
 HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, const DDSURFACEDESC2 *desc,
-        unsigned int version, DWORD surface_flags, struct ddraw_surface **surface) DECLSPEC_HIDDEN;
+        unsigned int version, struct ddraw_surface **surface) DECLSPEC_HIDDEN;
 HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
         DDSURFACEDESC2 *desc, DWORD flags, UINT version) DECLSPEC_HIDDEN;
 ULONG ddraw_surface_release_iface(struct ddraw_surface *This) DECLSPEC_HIDDEN;
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 5b34ec7..2b955df 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -5594,7 +5594,7 @@ static const struct wined3d_parent_ops ddraw_texture_wined3d_parent_ops =
 };
 
 HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, const DDSURFACEDESC2 *desc,
-        unsigned int version, DWORD surface_flags, struct ddraw_surface **surface)
+        unsigned int version, struct ddraw_surface **surface)
 {
     struct ddraw_surface *root, *mip, **attach;
     struct wined3d_resource_desc wined3d_desc;
@@ -5658,17 +5658,23 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, const DDSURFACEDESC2 *
     wined3d_desc.depth = 1;
     wined3d_desc.size = 0;
 
+    /* Some applications assume surfaces will always be mapped at the same
+     * address. Some of those also assume that this address is valid even when
+     * the surface isn't mapped, and that updates done this way will be
+     * visible on the screen. The game Nox is such an application,
+     * Commandos: Behind Enemy Lines is another. We set
+     * WINED3D_SURFACE_PIN_SYSMEM because of this. */
     if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
     {
         wined3d_desc.resource_type = WINED3D_RTYPE_CUBE_TEXTURE;
         hr = wined3d_texture_create_cube(ddraw->wined3d_device, &wined3d_desc, levels,
-                surface_flags, texture, &ddraw_texture_wined3d_parent_ops, &wined3d_texture);
+                WINED3D_SURFACE_PIN_SYSMEM, texture, &ddraw_texture_wined3d_parent_ops, &wined3d_texture);
     }
     else
     {
         wined3d_desc.resource_type = WINED3D_RTYPE_TEXTURE;
         hr = wined3d_texture_create_2d(ddraw->wined3d_device, &wined3d_desc, levels,
-                surface_flags, texture, &ddraw_texture_wined3d_parent_ops, &wined3d_texture);
+                WINED3D_SURFACE_PIN_SYSMEM, texture, &ddraw_texture_wined3d_parent_ops, &wined3d_texture);
     }
 
     if (FAILED(hr))
-- 
1.7.10.4




More information about the wine-patches mailing list