[v3 PATCH 1/3] wined3d: Manage source texture resolve in texture2d_blt() for colour blits.
Paul Gofman
gofmanp at gmail.com
Tue Mar 10 06:31:00 CDT 2020
Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
v2:
- add patch.
v3:
- introduce wined3d_texture_is_multisample_location();
- move resolve logic to texture2d_blt().
dlls/wined3d/surface.c | 17 ++++++++---------
dlls/wined3d/wined3d_private.h | 10 ++++++++++
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 50f0c9c06c..49ac894db0 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -175,13 +175,6 @@ void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *co
break;
}
- /* Resolve the source surface first if needed. */
- if (wined3d_texture_gl_is_multisample_location(wined3d_texture_gl(src_texture), src_location)
- && (src_texture->resource.format->id != dst_texture->resource.format->id
- || abs(src_rect->bottom - src_rect->top) != abs(dst_rect->bottom - dst_rect->top)
- || abs(src_rect->right - src_rect->left) != abs(dst_rect->right - dst_rect->left)))
- src_location = WINED3D_LOCATION_RB_RESOLVED;
-
/* Make sure the locations are up-to-date. Loading the destination
* surface isn't required if the entire surface is overwritten. (And is
* in fact harmful if we're being called by surface_load_location() with
@@ -2402,7 +2395,7 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_
struct wined3d_device *device = dst_texture->resource.device;
struct wined3d_swapchain *src_swapchain, *dst_swapchain;
const struct wined3d_color_key *colour_key = NULL;
- DWORD dst_location, valid_locations;
+ DWORD src_location, dst_location, valid_locations;
DWORD src_ds_flags, dst_ds_flags;
struct wined3d_context *context;
enum wined3d_blit_op blit_op;
@@ -2629,8 +2622,14 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_
dst_location = dst_texture->resource.map_binding;
context = context_acquire(device, dst_texture, dst_sub_resource_idx);
+ scale = abs(src_box->right - src_box->left) != abs(dst_box->right - dst_box->left)
+ || abs(src_box->bottom - src_box->top) != abs(dst_box->bottom - dst_box->top);
+ src_location = (scale || convert || blit_op != WINED3D_BLIT_OP_COLOR_BLIT)
+ && wined3d_texture_is_multisample_location(src_texture,
+ src_texture->resource.draw_binding) ? WINED3D_LOCATION_RB_RESOLVED
+ : src_texture->resource.draw_binding;
valid_locations = device->blitter->ops->blitter_blit(device->blitter, blit_op, context,
- src_texture, src_sub_resource_idx, src_texture->resource.draw_binding, &src_rect,
+ src_texture, src_sub_resource_idx, src_location, &src_rect,
dst_texture, dst_sub_resource_idx, dst_location, &dst_rect, colour_key, filter);
context_release(context);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 0ab6bcfa83..3410e06bb9 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3808,6 +3808,16 @@ static inline BOOL wined3d_texture_gl_is_multisample_location(const struct wined
return texture_gl->target == GL_TEXTURE_2D_MULTISAMPLE || texture_gl->target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY;
}
+static inline BOOL wined3d_texture_is_multisample_location(const struct wined3d_texture *texture,
+ DWORD location)
+{
+ if (location == WINED3D_LOCATION_RB_MULTISAMPLE)
+ return TRUE;
+ if (location != WINED3D_LOCATION_TEXTURE_RGB && location != WINED3D_LOCATION_TEXTURE_SRGB)
+ return FALSE;
+ return texture->resource.multisample_type != WINED3D_MULTISAMPLE_NONE;
+}
+
void wined3d_texture_gl_apply_sampler_desc(struct wined3d_texture_gl *texture_gl,
const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
--
2.24.1
More information about the wine-devel
mailing list