[PATCH 2/5] wined3d: Move validate_location to resource.c.

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


---
 dlls/wined3d/resource.c        |  7 +++++++
 dlls/wined3d/volume.c          | 19 ++++++-------------
 dlls/wined3d/wined3d_private.h |  2 ++
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 6a0a29b..0e362ad 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -428,3 +428,10 @@ GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags)
         return GL_WRITE_ONLY_ARB;
     return GL_READ_WRITE_ARB;
 }
+
+void wined3d_resource_validate_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 3b37293..8d84e79 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);
 }
 
-static void wined3d_volume_validate_location(struct wined3d_volume *volume, DWORD location)
-{
-    TRACE("Volume %p, setting %s.\n", volume, wined3d_debug_location(location));
-    volume->resource.locations |= location;
-    TRACE("new location flags are %s.\n", wined3d_debug_location(volume->resource.locations));
-}
-
 void wined3d_volume_invalidate_location(struct wined3d_volume *volume, DWORD location)
 {
     TRACE("Volume %p, clearing %s.\n", volume, wined3d_debug_location(location));
@@ -356,7 +349,7 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
                 FIXME("Implement texture loading from %s.\n", wined3d_debug_location(volume->resource.locations));
                 return;
             }
-            wined3d_volume_validate_location(volume, location);
+            wined3d_resource_validate_location(&volume->resource, location);
 
             if (wined3d_volume_can_evict(volume))
                 wined3d_volume_evict_sysmem(volume);
@@ -390,7 +383,7 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
                         wined3d_debug_location(volume->resource.locations));
                 return;
             }
-            wined3d_volume_validate_location(volume, WINED3D_LOCATION_SYSMEM);
+            wined3d_resource_validate_location(&volume->resource, WINED3D_LOCATION_SYSMEM);
             break;
 
         case WINED3D_LOCATION_BUFFER:
@@ -419,7 +412,7 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
                         wined3d_debug_location(volume->resource.locations));
                 return;
             }
-            wined3d_volume_validate_location(volume, WINED3D_LOCATION_BUFFER);
+            wined3d_resource_validate_location(&volume->resource, WINED3D_LOCATION_BUFFER);
             break;
 
         default:
@@ -505,7 +498,7 @@ static void volume_unload(struct wined3d_resource *resource)
     else
     {
         ERR("Out of memory when unloading volume %p.\n", volume);
-        wined3d_volume_validate_location(volume, WINED3D_LOCATION_DISCARDED);
+        wined3d_resource_validate_location(&volume->resource, WINED3D_LOCATION_DISCARDED);
         wined3d_volume_invalidate_location(volume, ~WINED3D_LOCATION_DISCARDED);
     }
 
@@ -692,7 +685,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
 
         wined3d_volume_prepare_pbo(volume, context);
         if (flags & WINED3D_MAP_DISCARD)
-            wined3d_volume_validate_location(volume, WINED3D_LOCATION_BUFFER);
+            wined3d_resource_validate_location(&volume->resource, WINED3D_LOCATION_BUFFER);
         else
             wined3d_volume_load_location(volume, context, WINED3D_LOCATION_BUFFER);
 
@@ -727,7 +720,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
 
         if (flags & WINED3D_MAP_DISCARD)
         {
-            wined3d_volume_validate_location(volume, WINED3D_LOCATION_SYSMEM);
+            wined3d_resource_validate_location(&volume->resource, WINED3D_LOCATION_SYSMEM);
         }
         else if (!(volume->resource.locations & WINED3D_LOCATION_SYSMEM))
         {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index bcb2139..54da921 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2035,6 +2035,8 @@ DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resourc
         DWORD flags) DECLSPEC_HIDDEN;
 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;
 
 /* Tests show that the start address of resources is 32 byte aligned */
 #define RESOURCE_ALIGNMENT 16
-- 
1.8.1.5




More information about the wine-patches mailing list