[4/4] wined3d: Trigger frontbuffer update in surface_cpu_blt.

Sebastian Lackner sebastian at fds-team.de
Fri Jun 16 09:03:22 CDT 2017


Fixes a regression introduced in ee17d7ba1b72b26baae90c1d5e2ae5b3e4721654.

Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---

In this case I'm not sure about the best way to fix it. Feel free to use
a different approach if preferred (for example calling
swapchain_frontbuffer_updated from context_unmap_bo_address).

 dlls/wined3d/surface.c         |    3 +++
 dlls/wined3d/texture.c         |   22 +++++++++++++++++-----
 dlls/wined3d/wined3d_private.h |    2 ++
 3 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index af8b5b4cb3..88ae765e17 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3343,6 +3343,9 @@ release:
     context_unmap_bo_address(context, &dst_data, GL_PIXEL_UNPACK_BUFFER);
     if (!same_sub_resource)
         context_unmap_bo_address(context, &src_data, GL_PIXEL_UNPACK_BUFFER);
+
+    swapchain_frontbuffer_updated(dst_texture, dst_sub_resource_idx, dst_box);
+
     if (converted_texture)
         wined3d_texture_decref(converted_texture);
     if (context)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 476295cecc..9de8b93c5a 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1979,6 +1979,22 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
     return WINED3D_OK;
 }
 
+void swapchain_frontbuffer_updated(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+        const struct wined3d_box *box)
+{
+    struct wined3d_texture_sub_resource *sub_resource;
+
+    if (!texture->swapchain || texture->swapchain->front_buffer != texture)
+        return;
+    if (!(sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx)))
+        return;
+    if (sub_resource->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_TEXTURE_RGB))
+        return;
+
+    if (box) SetRect(&texture->swapchain->front_buffer_update, box->left, box->top, box->right, box->bottom);
+    texture->swapchain->swapchain_ops->swapchain_frontbuffer_updated(texture->swapchain);
+}
+
 static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
 {
     struct wined3d_texture_sub_resource *sub_resource;
@@ -2010,11 +2026,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso
     if (context)
         context_release(context);
 
-    if (texture->swapchain && texture->swapchain->front_buffer == texture)
-    {
-        if (!(sub_resource->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_TEXTURE_RGB)))
-            texture->swapchain->swapchain_ops->swapchain_frontbuffer_updated(texture->swapchain);
-    }
+    swapchain_frontbuffer_updated(texture, sub_resource_idx, NULL);
 
     --sub_resource->map_count;
     if (!--resource->map_count && texture->update_map_binding)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 1025c98f18..e394931573 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3686,6 +3686,8 @@ void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HI
 HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
 void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
 void swapchain_update_swap_interval(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
+void swapchain_frontbuffer_updated(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+        const struct wined3d_box *box) DECLSPEC_HIDDEN;
 
 /*****************************************************************************
  * Utility function prototypes
-- 
2.13.1



More information about the wine-patches mailing list