Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/wined3d/surface.c | 48 ----------------------------------------- dlls/wined3d/texture.c | 49 +++++++++++++++++++++++++++++++++++++++++- dlls/wined3d/wined3d_private.h | 2 -- 3 files changed, 48 insertions(+), 51 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 6d3590b3d13..fc8be3827ba 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1423,54 +1423,6 @@ static HRESULT wined3d_texture_blt_special(struct wined3d_texture *dst_texture, }
/* Context activation is done by the caller. */ -BOOL texture2d_load_drawable(struct wined3d_texture *texture, - unsigned int sub_resource_idx, struct wined3d_context *context) -{ - struct wined3d_texture *restore_texture; - struct wined3d_device *device; - unsigned int restore_idx; - unsigned int level; - RECT r; - - if (texture->resource.bind_flags & WINED3D_BIND_DEPTH_STENCIL) - { - DWORD current = texture->sub_resources[sub_resource_idx].locations; - FIXME("Unimplemented copy from %s for depth/stencil buffers.\n", - wined3d_debug_location(current)); - return FALSE; - } - - if (wined3d_settings.offscreen_rendering_mode == ORM_FBO - && wined3d_resource_is_offscreen(&texture->resource)) - { - ERR("Trying to load offscreen texture into WINED3D_LOCATION_DRAWABLE.\n"); - return FALSE; - } - - device = texture->resource.device; - restore_texture = context->current_rt.texture; - restore_idx = context->current_rt.sub_resource_idx; - if (restore_texture != texture || restore_idx != sub_resource_idx) - context = context_acquire(device, texture, sub_resource_idx); - else - restore_texture = NULL; - - level = sub_resource_idx % texture->level_count; - SetRect(&r, 0, 0, wined3d_texture_get_level_width(texture, level), - wined3d_texture_get_level_height(texture, level)); - wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB); - device->blitter->ops->blitter_blit(device->blitter, WINED3D_BLIT_OP_COLOR_BLIT, context, - texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB, &r, - texture, sub_resource_idx, WINED3D_LOCATION_DRAWABLE, &r, - NULL, WINED3D_TEXF_POINT); - - if (restore_texture) - context_restore(context, restore_texture, restore_idx); - - return TRUE; -} - -/* Context activation is done by the caller. */ BOOL texture2d_load_renderbuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD dst_location) { diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index ae3e17914f5..4ae869b4b2a 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -2481,6 +2481,53 @@ static BOOL wined3d_texture_gl_load_sysmem(struct wined3d_texture_gl *texture_gl return FALSE; }
+static BOOL wined3d_texture_load_drawable(struct wined3d_texture *texture, + unsigned int sub_resource_idx, struct wined3d_context *context) +{ + struct wined3d_texture *restore_texture; + struct wined3d_device *device; + unsigned int restore_idx; + unsigned int level; + RECT r; + + if (texture->resource.bind_flags & WINED3D_BIND_DEPTH_STENCIL) + { + DWORD current = texture->sub_resources[sub_resource_idx].locations; + FIXME("Unimplemented copy from %s for depth/stencil buffers.\n", + wined3d_debug_location(current)); + return FALSE; + } + + if (wined3d_settings.offscreen_rendering_mode == ORM_FBO + && wined3d_resource_is_offscreen(&texture->resource)) + { + ERR("Trying to load offscreen texture into WINED3D_LOCATION_DRAWABLE.\n"); + return FALSE; + } + + device = texture->resource.device; + restore_texture = context->current_rt.texture; + restore_idx = context->current_rt.sub_resource_idx; + if (restore_texture != texture || restore_idx != sub_resource_idx) + context = context_acquire(device, texture, sub_resource_idx); + else + restore_texture = NULL; + + level = sub_resource_idx % texture->level_count; + SetRect(&r, 0, 0, wined3d_texture_get_level_width(texture, level), + wined3d_texture_get_level_height(texture, level)); + wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB); + device->blitter->ops->blitter_blit(device->blitter, WINED3D_BLIT_OP_COLOR_BLIT, context, + texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB, &r, + texture, sub_resource_idx, WINED3D_LOCATION_DRAWABLE, &r, + NULL, WINED3D_TEXF_POINT); + + if (restore_texture) + context_restore(context, restore_texture, restore_idx); + + return TRUE; +} + static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx, struct wined3d_context_gl *context_gl, BOOL srgb) { @@ -2651,7 +2698,7 @@ static BOOL wined3d_texture_gl_load_location(struct wined3d_texture *texture, return wined3d_texture_gl_load_sysmem(texture_gl, sub_resource_idx, context_gl, location);
case WINED3D_LOCATION_DRAWABLE: - return texture2d_load_drawable(texture, sub_resource_idx, context); + return wined3d_texture_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 8e23653024b..f796d12446f 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3549,8 +3549,6 @@ void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *co const RECT *dst_rect) DECLSPEC_HIDDEN; void texture2d_get_blt_info(const struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx, const RECT *rect, struct wined3d_blt_info *info) DECLSPEC_HIDDEN; -BOOL texture2d_load_drawable(struct wined3d_texture *texture, unsigned int sub_resource_idx, - struct wined3d_context *context) DECLSPEC_HIDDEN; void texture2d_load_fb_texture(struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx, BOOL srgb, struct wined3d_context *context) DECLSPEC_HIDDEN; BOOL texture2d_load_renderbuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx,