[PATCH 3/5] wined3d: Move invalidate_location to resource.c.

Stefan Dösinger stefan at codeweavers.com
Thu Oct 3 06:08:19 CDT 2013


---
 dlls/wined3d/device.c          |  2 +-
 dlls/wined3d/resource.c        |  7 +++++++
 dlls/wined3d/volume.c          | 23 ++++++++---------------
 dlls/wined3d/wined3d_private.h |  3 ++-
 4 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 6b6234b..ebcfb0f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3598,7 +3598,7 @@ static HRESULT device_update_volume(struct wined3d_device *device,
     data.buffer_object = 0;
     data.addr = src.data;
     wined3d_volume_upload_data(dst_volume, context, &data);
-    wined3d_volume_invalidate_location(dst_volume, ~WINED3D_LOCATION_TEXTURE_RGB);
+    wined3d_resource_invalidate_location(&dst_volume->resource, ~WINED3D_LOCATION_TEXTURE_RGB);
 
     context_release(context);
 
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 0e362ad..e50ac29 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -435,3 +435,10 @@ void wined3d_resource_validate_location(struct wined3d_resource *resource, DWORD
     resource->locations |= location;
     TRACE("new location flags are %s.\n", wined3d_debug_location(resource->locations));
 }
+
+void wined3d_resource_invalidate_location(struct wined3d_resource *resource, DWORD location)
+{
+    TRACE("Resource %p, setting %s.\n", resource, wined3d_debug_location(location));
+    resource->locations &= ~location;
+    TRACE("new location flags are %s.\n", wined3d_debug_location(resource->locations));
+}
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index 8d84e79..c0d0541 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -184,13 +184,6 @@ void wined3d_volume_upload_data(struct wined3d_volume *volume, const struct wine
         HeapFree(GetProcessHeap(), 0, mem);
 }
 
-void wined3d_volume_invalidate_location(struct wined3d_volume *volume, DWORD location)
-{
-    TRACE("Volume %p, clearing %s.\n", volume, wined3d_debug_location(location));
-    volume->resource.locations &= ~location;
-    TRACE("new location flags are %s.\n", wined3d_debug_location(volume->resource.locations));
-}
-
 /* Context activation is done by the caller. */
 static void wined3d_volume_download_data(struct wined3d_volume *volume,
         const struct wined3d_context *context, const struct wined3d_bo_address *data)
@@ -226,7 +219,7 @@ static void wined3d_volume_download_data(struct wined3d_volume *volume,
 static void wined3d_volume_evict_sysmem(struct wined3d_volume *volume)
 {
     wined3d_resource_free_sysmem(&volume->resource);
-    wined3d_volume_invalidate_location(volume, WINED3D_LOCATION_SYSMEM);
+    wined3d_resource_invalidate_location(&volume->resource, WINED3D_LOCATION_SYSMEM);
 }
 
 static DWORD volume_access_from_location(DWORD location)
@@ -324,7 +317,7 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
             if (volume->resource.locations & WINED3D_LOCATION_DISCARDED)
             {
                 TRACE("Volume previously discarded, nothing to do.\n");
-                wined3d_volume_invalidate_location(volume, WINED3D_LOCATION_DISCARDED);
+                wined3d_resource_invalidate_location(&volume->resource, WINED3D_LOCATION_DISCARDED);
             }
             else if (volume->resource.locations & WINED3D_LOCATION_SYSMEM)
             {
@@ -363,7 +356,7 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
             if (volume->resource.locations & WINED3D_LOCATION_DISCARDED)
             {
                 TRACE("Volume previously discarded, nothing to do.\n");
-                wined3d_volume_invalidate_location(volume, WINED3D_LOCATION_DISCARDED);
+                wined3d_resource_invalidate_location(&volume->resource, WINED3D_LOCATION_DISCARDED);
             }
             else if (volume->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
             {
@@ -393,7 +386,7 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
             if (volume->resource.locations & WINED3D_LOCATION_DISCARDED)
             {
                 TRACE("Volume previously discarded, nothing to do.\n");
-                wined3d_volume_invalidate_location(volume, WINED3D_LOCATION_DISCARDED);
+                wined3d_resource_invalidate_location(&volume->resource, WINED3D_LOCATION_DISCARDED);
             }
             else if (volume->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
             {
@@ -493,13 +486,13 @@ static void volume_unload(struct wined3d_resource *resource)
         context = context_acquire(device, NULL);
         wined3d_volume_load_location(volume, context, WINED3D_LOCATION_SYSMEM);
         context_release(context);
-        wined3d_volume_invalidate_location(volume, ~WINED3D_LOCATION_SYSMEM);
+        wined3d_resource_invalidate_location(&volume->resource, ~WINED3D_LOCATION_SYSMEM);
     }
     else
     {
         ERR("Out of memory when unloading volume %p.\n", volume);
         wined3d_resource_validate_location(&volume->resource, WINED3D_LOCATION_DISCARDED);
-        wined3d_volume_invalidate_location(volume, ~WINED3D_LOCATION_DISCARDED);
+        wined3d_resource_invalidate_location(&volume->resource, ~WINED3D_LOCATION_DISCARDED);
     }
 
     if (volume->pbo)
@@ -776,9 +769,9 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
         wined3d_texture_set_dirty(volume->container);
 
         if (volume->flags & WINED3D_VFLAG_PBO)
-            wined3d_volume_invalidate_location(volume, ~WINED3D_LOCATION_BUFFER);
+            wined3d_resource_invalidate_location(&volume->resource, ~WINED3D_LOCATION_BUFFER);
         else
-            wined3d_volume_invalidate_location(volume, ~WINED3D_LOCATION_SYSMEM);
+            wined3d_resource_invalidate_location(&volume->resource, ~WINED3D_LOCATION_SYSMEM);
     }
 
     volume->resource.map_count++;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 54da921..9ae4ea8 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2037,6 +2037,8 @@ GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN;
 GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN;
 void wined3d_resource_validate_location(struct wined3d_resource *resource,
         DWORD location) DECLSPEC_HIDDEN;
+void wined3d_resource_invalidate_location(struct wined3d_resource *resource,
+        DWORD location) DECLSPEC_HIDDEN;
 
 /* Tests show that the start address of resources is 32 byte aligned */
 #define RESOURCE_ALIGNMENT 16
@@ -2153,7 +2155,6 @@ static inline struct wined3d_volume *volume_from_resource(struct wined3d_resourc
 
 void wined3d_volume_load(struct wined3d_volume *volume, struct wined3d_context *context, BOOL srgb_mode) DECLSPEC_HIDDEN;
 void volume_set_container(struct wined3d_volume *volume, struct wined3d_texture *container) DECLSPEC_HIDDEN;
-void wined3d_volume_invalidate_location(struct wined3d_volume *volume, DWORD location) DECLSPEC_HIDDEN;
 void wined3d_volume_upload_data(struct wined3d_volume *volume, const struct wined3d_context *context,
         const struct wined3d_bo_address *data) DECLSPEC_HIDDEN;
 
-- 
1.8.1.5




More information about the wine-patches mailing list