Henri Verbeet : wined3d: Pass a texture and sub-resource index to surface_load_sysmem().

Alexandre Julliard julliard at winehq.org
Tue Mar 6 16:48:50 CST 2018


Module: wine
Branch: master
Commit: 3b47e108a91cefc8dc781e771d6dcda4fc286906
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3b47e108a91cefc8dc781e771d6dcda4fc286906

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Mar  6 10:26:28 2018 +0330

wined3d: Pass a texture and sub-resource index to surface_load_sysmem().

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/surface.c         | 16 +++++++---------
 dlls/wined3d/texture.c         |  2 +-
 dlls/wined3d/wined3d_private.h |  5 +++--
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 23d7ae7..24d1f59 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2060,12 +2060,10 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
 }
 
 /* Context activation is done by the caller. */
-BOOL surface_load_sysmem(struct wined3d_surface *surface,
+BOOL texture2d_load_sysmem(struct wined3d_texture *texture, unsigned int sub_resource_idx,
         struct wined3d_context *context, DWORD dst_location)
 {
-    unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
     const struct wined3d_gl_info *gl_info = context->gl_info;
-    struct wined3d_texture *texture = surface->container;
     struct wined3d_texture_sub_resource *sub_resource;
 
     sub_resource = &texture->sub_resources[sub_resource_idx];
@@ -2075,7 +2073,7 @@ BOOL surface_load_sysmem(struct wined3d_surface *surface,
     if (is_multisample_location(texture, WINED3D_LOCATION_TEXTURE_RGB))
     {
         wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_RB_RESOLVED);
-        read_from_framebuffer(surface, context, WINED3D_LOCATION_RB_RESOLVED, dst_location);
+        read_from_framebuffer(sub_resource->u.surface, context, WINED3D_LOCATION_RB_RESOLVED, dst_location);
         return TRUE;
     }
     else
@@ -2083,12 +2081,12 @@ BOOL surface_load_sysmem(struct wined3d_surface *surface,
         if (sub_resource->locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED))
             wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
 
-        /* Download the surface to system memory. */
+        /* Download the sub-resource to system memory. */
         if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
         {
             wined3d_texture_bind_and_dirtify(texture, context,
                     !(sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB));
-            surface_download_data(surface, gl_info, dst_location);
+            surface_download_data(sub_resource->u.surface, gl_info, dst_location);
             ++texture->download_count;
 
             return TRUE;
@@ -2098,12 +2096,12 @@ BOOL surface_load_sysmem(struct wined3d_surface *surface,
     if (!(texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
             && (sub_resource->locations & WINED3D_LOCATION_DRAWABLE))
     {
-        read_from_framebuffer(surface, context, texture->resource.draw_binding, dst_location);
+        read_from_framebuffer(sub_resource->u.surface, context, texture->resource.draw_binding, dst_location);
         return TRUE;
     }
 
-    FIXME("Can't load surface %p with location flags %s into sysmem.\n",
-            surface, wined3d_debug_location(sub_resource->locations));
+    FIXME("Can't load texture %p, %u with location flags %s into sysmem.\n",
+            texture, sub_resource_idx, wined3d_debug_location(sub_resource->locations));
     return FALSE;
 }
 
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 72aee66..0368550 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1803,7 +1803,7 @@ static BOOL texture2d_load_location(struct wined3d_texture *texture, unsigned in
         case WINED3D_LOCATION_USER_MEMORY:
         case WINED3D_LOCATION_SYSMEM:
         case WINED3D_LOCATION_BUFFER:
-            return surface_load_sysmem(surface, context, location);
+            return texture2d_load_sysmem(texture, sub_resource_idx, context, location);
 
         case WINED3D_LOCATION_DRAWABLE:
             return surface_load_drawable(surface, context);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6d2ff8e..f0e7680 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3234,6 +3234,9 @@ static inline unsigned int wined3d_texture_get_level_pow2_height(const struct wi
     return max(1, texture->pow2_height >> level);
 }
 
+BOOL texture2d_load_sysmem(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+        struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
+
 void wined3d_texture_apply_sampler_desc(struct wined3d_texture *texture,
         const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_context *context) DECLSPEC_HIDDEN;
 void wined3d_texture_bind(struct wined3d_texture *texture,
@@ -3343,8 +3346,6 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb,
         struct wined3d_context *context) DECLSPEC_HIDDEN;
 BOOL surface_load_renderbuffer(struct wined3d_surface *surface,
         struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
-BOOL surface_load_sysmem(struct wined3d_surface *surface,
-        struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
 BOOL surface_load_texture(struct wined3d_surface *surface,
         struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
 void wined3d_surface_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,




More information about the wine-cvs mailing list