From 798439ba31ee155f88b25f31bcd13f7bcf078698 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 6 Mar 2018 10:08:29 +0330 Subject: [PATCH] wined3d: Pass a texture and sub-resource index to surface_load_drawable(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- 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 24d1f599069..1824a9854ba 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 0368550716d..9add4a3c1ac 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 f0e76801eec..d2addfb5bc7 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3234,6 +3234,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; @@ -3340,8 +3342,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,