[v4 PATCH 1/3] wined3d: Manage source texture resolve in texture2d_blt() for colour blits.

Paul Gofman gofmanp at gmail.com
Wed Mar 11 16:57:53 CDT 2020


Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
v4:
    - changed condition in wined3d_texture_is_multisample_location();
    - don't reevaluate 'scale' variable.

 dlls/wined3d/surface.c         | 15 ++++++---------
 dlls/wined3d/wined3d_private.h |  7 +++++++
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 50f0c9c06c..f8d3a88e1f 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,12 @@ 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);
+    src_location = (scale || convert || blit_op != WINED3D_BLIT_OP_COLOR_BLIT)
+            && wined3d_texture_is_multisample_location(context, 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 876c7212a0..df1dba9286 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3808,6 +3808,13 @@ 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_context *context,
+        const struct wined3d_texture *texture, DWORD location)
+{
+    return location == context->d3d_info->multisample_draw_location
+            && 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