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

Henri Verbeet hverbeet at codeweavers.com
Tue Mar 6 00:38:29 CST 2018


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/surface.c         | 10 +++++-----
 dlls/wined3d/texture.c         |  2 +-
 dlls/wined3d/wined3d_private.h |  4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 24d1f59..1824a98 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2106,12 +2106,11 @@ BOOL texture2d_load_sysmem(struct wined3d_texture *texture, unsigned int sub_res
 }
 
 /* Context activation is done by the caller. */
-BOOL surface_load_drawable(struct wined3d_surface *surface,
-        struct wined3d_context *context)
+BOOL texture2d_load_drawable(struct wined3d_texture *texture,
+        unsigned int sub_resource_idx, struct wined3d_context *context)
 {
-    unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
-    struct wined3d_texture *texture = surface->container;
     struct wined3d_surface *restore_rt = NULL;
+    struct wined3d_surface *surface;
     struct wined3d_device *device;
     unsigned int level;
     RECT r;
@@ -2127,11 +2126,12 @@ BOOL surface_load_drawable(struct wined3d_surface *surface,
     if (wined3d_settings.offscreen_rendering_mode == ORM_FBO
             && wined3d_resource_is_offscreen(&texture->resource))
     {
-        ERR("Trying to load offscreen surface into WINED3D_LOCATION_DRAWABLE.\n");
+        ERR("Trying to load offscreen texture into WINED3D_LOCATION_DRAWABLE.\n");
         return FALSE;
     }
 
     device = texture->resource.device;
+    surface = texture->sub_resources[sub_resource_idx].u.surface;
     restore_rt = context_get_rt_surface(context);
     if (restore_rt != surface)
         context = context_acquire(device, texture, sub_resource_idx);
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 0368550..9add4a3 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1806,7 +1806,7 @@ static BOOL texture2d_load_location(struct wined3d_texture *texture, unsigned in
             return texture2d_load_sysmem(texture, sub_resource_idx, context, location);
 
         case WINED3D_LOCATION_DRAWABLE:
-            return surface_load_drawable(surface, context);
+            return texture2d_load_drawable(texture, sub_resource_idx, context);
 
         case WINED3D_LOCATION_RB_RESOLVED:
         case WINED3D_LOCATION_RB_MULTISAMPLE:
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d07c81d..44c0ab4 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3233,6 +3233,8 @@ static inline unsigned int wined3d_texture_get_level_pow2_height(const struct wi
     return max(1, texture->pow2_height >> level);
 }
 
+BOOL texture2d_load_drawable(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+        struct wined3d_context *context) DECLSPEC_HIDDEN;
 BOOL texture2d_load_sysmem(struct wined3d_texture *texture, unsigned int sub_resource_idx,
         struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
 
@@ -3339,8 +3341,6 @@ static inline struct wined3d_texture_sub_resource *surface_get_sub_resource(stru
 HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
         struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
         const struct wined3d_blt_fx *blt_fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
-BOOL surface_load_drawable(struct wined3d_surface *surface,
-        struct wined3d_context *context) DECLSPEC_HIDDEN;
 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,
-- 
2.1.4




More information about the wine-devel mailing list