[PATCH 2/5] wined3d: Pass a texture and sub-resource index to wined3d_volume_srgb_transfer().

Henri Verbeet hverbeet at codeweavers.com
Thu Jul 28 06:29:39 CDT 2016


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/volume.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index 72ebd19..2e38aa7 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -141,12 +141,12 @@ static DWORD volume_access_from_location(DWORD location)
 }
 
 /* Context activation is done by the caller. */
-static void wined3d_volume_srgb_transfer(struct wined3d_volume *volume,
+static void texture3d_srgb_transfer(struct wined3d_texture *texture, unsigned int sub_resource_idx,
         struct wined3d_context *context, BOOL dest_is_srgb)
 {
-    unsigned int sub_resource_idx = volume->texture_level;
-    struct wined3d_texture *texture = volume->container;
+    struct wined3d_texture_sub_resource *sub_resource = &texture->sub_resources[sub_resource_idx];
     struct wined3d_bo_address data;
+
     /* Optimizations are possible, but the effort should be put into either
      * implementing EXT_SRGB_DECODE in the driver or finding out why we
      * picked the wrong copy for the original upload and fixing that.
@@ -156,7 +156,7 @@ static void wined3d_volume_srgb_transfer(struct wined3d_volume *volume,
 
     WARN_(d3d_perf)("Performing slow rgb/srgb volume transfer.\n");
     data.buffer_object = 0;
-    if (!(data.addr = HeapAlloc(GetProcessHeap(), 0, texture->sub_resources[sub_resource_idx].size)))
+    if (!(data.addr = HeapAlloc(GetProcessHeap(), 0, sub_resource->size)))
         return;
 
     wined3d_texture_bind_and_dirtify(texture, context, !dest_is_srgb);
@@ -225,11 +225,11 @@ BOOL wined3d_volume_load_location(struct wined3d_volume *volume,
             }
             else if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
             {
-                wined3d_volume_srgb_transfer(volume, context, TRUE);
+                texture3d_srgb_transfer(texture, sub_resource_idx, context, TRUE);
             }
             else if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_SRGB)
             {
-                wined3d_volume_srgb_transfer(volume, context, FALSE);
+                texture3d_srgb_transfer(texture, sub_resource_idx, context, FALSE);
             }
             else
             {
-- 
2.1.4




More information about the wine-patches mailing list