[PATCH 1/5] wined3d: Store valid locations in the resource.

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


---
 dlls/wined3d/volume.c          | 46 +++++++++++++++++++++---------------------
 dlls/wined3d/wined3d_private.h |  6 ++++--
 2 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index d61f32f..3b37293 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -187,15 +187,15 @@ void wined3d_volume_upload_data(struct wined3d_volume *volume, const struct wine
 static void wined3d_volume_validate_location(struct wined3d_volume *volume, DWORD location)
 {
     TRACE("Volume %p, setting %s.\n", volume, wined3d_debug_location(location));
-    volume->locations |= location;
-    TRACE("new location flags are %s.\n", wined3d_debug_location(volume->locations));
+    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));
-    volume->locations &= ~location;
-    TRACE("new location flags are %s.\n", wined3d_debug_location(volume->locations));
+    volume->resource.locations &= ~location;
+    TRACE("new location flags are %s.\n", wined3d_debug_location(volume->resource.locations));
 }
 
 /* Context activation is done by the caller. */
@@ -303,9 +303,9 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
     DWORD required_access = volume_access_from_location(location);
 
     TRACE("Volume %p, loading %s, have %s.\n", volume, wined3d_debug_location(location),
-        wined3d_debug_location(volume->locations));
+        wined3d_debug_location(volume->resource.locations));
 
-    if ((volume->locations & location) == location)
+    if ((volume->resource.locations & location) == location)
     {
         TRACE("Location(s) already up to date.\n");
         return;
@@ -328,32 +328,32 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
                     && !(volume->flags & WINED3D_VFLAG_SRGB_ALLOCATED)))
                 ERR("Trying to load (s)RGB texture without prior allocation.\n");
 
-            if (volume->locations & WINED3D_LOCATION_DISCARDED)
+            if (volume->resource.locations & WINED3D_LOCATION_DISCARDED)
             {
                 TRACE("Volume previously discarded, nothing to do.\n");
                 wined3d_volume_invalidate_location(volume, WINED3D_LOCATION_DISCARDED);
             }
-            else if (volume->locations & WINED3D_LOCATION_SYSMEM)
+            else if (volume->resource.locations & WINED3D_LOCATION_SYSMEM)
             {
                 struct wined3d_bo_address data = {0, volume->resource.heap_memory};
                 wined3d_volume_upload_data(volume, context, &data);
             }
-            else if (volume->locations & WINED3D_LOCATION_BUFFER)
+            else if (volume->resource.locations & WINED3D_LOCATION_BUFFER)
             {
                 struct wined3d_bo_address data = {volume->pbo, NULL};
                 wined3d_volume_upload_data(volume, context, &data);
             }
-            else if (volume->locations & WINED3D_LOCATION_TEXTURE_RGB)
+            else if (volume->resource.locations & WINED3D_LOCATION_TEXTURE_RGB)
             {
                 wined3d_volume_srgb_transfer(volume, context, TRUE);
             }
-            else if (volume->locations & WINED3D_LOCATION_TEXTURE_SRGB)
+            else if (volume->resource.locations & WINED3D_LOCATION_TEXTURE_SRGB)
             {
                 wined3d_volume_srgb_transfer(volume, context, FALSE);
             }
             else
             {
-                FIXME("Implement texture loading from %s.\n", wined3d_debug_location(volume->locations));
+                FIXME("Implement texture loading from %s.\n", wined3d_debug_location(volume->resource.locations));
                 return;
             }
             wined3d_volume_validate_location(volume, location);
@@ -367,16 +367,16 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
             if (!volume->resource.heap_memory)
                 ERR("Trying to load WINED3D_LOCATION_SYSMEM without setting it up first.\n");
 
-            if (volume->locations & WINED3D_LOCATION_DISCARDED)
+            if (volume->resource.locations & WINED3D_LOCATION_DISCARDED)
             {
                 TRACE("Volume previously discarded, nothing to do.\n");
                 wined3d_volume_invalidate_location(volume, WINED3D_LOCATION_DISCARDED);
             }
-            else if (volume->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
+            else if (volume->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
             {
                 struct wined3d_bo_address data = {0, volume->resource.heap_memory};
 
-                if (volume->locations & WINED3D_LOCATION_TEXTURE_RGB)
+                if (volume->resource.locations & WINED3D_LOCATION_TEXTURE_RGB)
                     volume_bind_and_dirtify(volume, context, FALSE);
                 else
                     volume_bind_and_dirtify(volume, context, TRUE);
@@ -387,7 +387,7 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
             else
             {
                 FIXME("Implement WINED3D_LOCATION_SYSMEM loading from %s.\n",
-                        wined3d_debug_location(volume->locations));
+                        wined3d_debug_location(volume->resource.locations));
                 return;
             }
             wined3d_volume_validate_location(volume, WINED3D_LOCATION_SYSMEM);
@@ -397,16 +397,16 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
             if (!volume->pbo || !(volume->flags & WINED3D_VFLAG_PBO))
                 ERR("Trying to load WINED3D_LOCATION_BUFFER without setting it up first.\n");
 
-            if (volume->locations & WINED3D_LOCATION_DISCARDED)
+            if (volume->resource.locations & WINED3D_LOCATION_DISCARDED)
             {
                 TRACE("Volume previously discarded, nothing to do.\n");
                 wined3d_volume_invalidate_location(volume, WINED3D_LOCATION_DISCARDED);
             }
-            else if (volume->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
+            else if (volume->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
             {
                 struct wined3d_bo_address data = {volume->pbo, NULL};
 
-                if (volume->locations & WINED3D_LOCATION_TEXTURE_RGB)
+                if (volume->resource.locations & WINED3D_LOCATION_TEXTURE_RGB)
                     volume_bind_and_dirtify(volume, context, FALSE);
                 else
                     volume_bind_and_dirtify(volume, context, TRUE);
@@ -416,7 +416,7 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
             else
             {
                 FIXME("Implement WINED3D_LOCATION_BUFFER loading from %s.\n",
-                        wined3d_debug_location(volume->locations));
+                        wined3d_debug_location(volume->resource.locations));
                 return;
             }
             wined3d_volume_validate_location(volume, WINED3D_LOCATION_BUFFER);
@@ -424,7 +424,7 @@ static void wined3d_volume_load_location(struct wined3d_volume *volume,
 
         default:
             FIXME("Implement %s loading from %s.\n", wined3d_debug_location(location),
-                    wined3d_debug_location(volume->locations));
+                    wined3d_debug_location(volume->resource.locations));
     }
 }
 
@@ -729,7 +729,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
         {
             wined3d_volume_validate_location(volume, WINED3D_LOCATION_SYSMEM);
         }
-        else if (!(volume->locations & WINED3D_LOCATION_SYSMEM))
+        else if (!(volume->resource.locations & WINED3D_LOCATION_SYSMEM))
         {
             context = context_acquire(device, NULL);
             wined3d_volume_load_location(volume, context, WINED3D_LOCATION_SYSMEM);
@@ -870,7 +870,7 @@ static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_device
     }
 
     volume->texture_level = level;
-    volume->locations = WINED3D_LOCATION_DISCARDED;
+    volume->resource.locations = WINED3D_LOCATION_DISCARDED;
 
     if (pool == WINED3D_POOL_DEFAULT && usage & WINED3DUSAGE_DYNAMIC
             && gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 719aa87..bcb2139 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2008,10 +2008,12 @@ struct wined3d_resource
     UINT size;
     DWORD priority;
     BYTE *allocatedMemory; /* Pointer to the real data location */
-    void *heap_memory;
     struct list privateData;
     struct list resource_list_entry;
 
+    DWORD locations;
+    void *heap_memory;
+
     void *parent;
     const struct wined3d_parent_ops *parent_ops;
     const struct wined3d_resource_ops *resource_ops;
@@ -2136,7 +2138,7 @@ struct wined3d_volume
     struct wined3d_resource resource;
     struct wined3d_texture *container;
 
-    DWORD flags, locations;
+    DWORD flags;
     GLint texture_level;
     DWORD download_count;
     GLuint pbo;
-- 
1.8.1.5




More information about the wine-patches mailing list