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

Henri Verbeet hverbeet at codeweavers.com
Wed Mar 7 01:26:40 CST 2018


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

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 1824a98..4bcd94a 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2324,17 +2324,18 @@ BOOL surface_load_texture(struct wined3d_surface *surface,
 }
 
 /* Context activation is done by the caller. */
-BOOL surface_load_renderbuffer(struct wined3d_surface *surface,
+BOOL texture2d_load_renderbuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx,
         struct wined3d_context *context, DWORD dst_location)
 {
-    struct wined3d_texture *texture = surface->container;
-    unsigned int level = surface_get_sub_resource_idx(surface) % texture->level_count;
+    unsigned int level = sub_resource_idx % texture->level_count;
     const RECT rect = {0, 0,
             wined3d_texture_get_level_width(texture, level),
             wined3d_texture_get_level_height(texture, level)};
-    DWORD locations = surface_get_sub_resource(surface)->locations;
-    DWORD src_location;
+    struct wined3d_texture_sub_resource *sub_resource;
+    DWORD src_location, locations;
 
+    sub_resource = &texture->sub_resources[sub_resource_idx];
+    locations = sub_resource->locations;
     if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
     {
         FIXME("Unimplemented copy from %s for depth/stencil buffers.\n",
@@ -2351,8 +2352,8 @@ BOOL surface_load_renderbuffer(struct wined3d_surface *surface,
     else /* surface_blt_fbo will load the source location if necessary. */
         src_location = WINED3D_LOCATION_TEXTURE_RGB;
 
-    surface_blt_fbo(texture->resource.device, context, WINED3D_TEXF_POINT,
-            surface, src_location, &rect, surface, dst_location, &rect);
+    surface_blt_fbo(texture->resource.device, context, WINED3D_TEXF_POINT, sub_resource->u.surface,
+            src_location, &rect, sub_resource->u.surface, dst_location, &rect);
 
     return TRUE;
 }
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 9add4a3..eb04a46 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1810,7 +1810,7 @@ static BOOL texture2d_load_location(struct wined3d_texture *texture, unsigned in
 
         case WINED3D_LOCATION_RB_RESOLVED:
         case WINED3D_LOCATION_RB_MULTISAMPLE:
-            return surface_load_renderbuffer(surface, context, location);
+            return texture2d_load_renderbuffer(texture, sub_resource_idx, context, location);
 
         case WINED3D_LOCATION_TEXTURE_RGB:
         case WINED3D_LOCATION_TEXTURE_SRGB:
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d2addfb..5003cc5 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3236,6 +3236,8 @@ static inline unsigned int wined3d_texture_get_level_pow2_height(const struct wi
 
 BOOL texture2d_load_drawable(struct wined3d_texture *texture, unsigned int sub_resource_idx,
         struct wined3d_context *context) DECLSPEC_HIDDEN;
+BOOL texture2d_load_renderbuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+        struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
 BOOL texture2d_load_sysmem(struct wined3d_texture *texture, unsigned int sub_resource_idx,
         struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
 
@@ -3344,8 +3346,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
         const struct wined3d_blt_fx *blt_fx, enum wined3d_texture_filter_type filter) 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,
-        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,
-- 
2.1.4




More information about the wine-devel mailing list