[PATCH 2/5] wined3d: Move the swapchain cursor texture blit to wined3d_cs_exec_present().

Henri Verbeet hverbeet at codeweavers.com
Tue May 26 11:10:10 CDT 2020


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/cs.c        | 27 ++++++++++++++++++++++++++-
 dlls/wined3d/swapchain.c | 26 --------------------------
 2 files changed, 26 insertions(+), 27 deletions(-)

diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index b5a34a6ab62..ffd00c9b950 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -521,7 +521,7 @@ static void wined3d_cs_exec_nop(struct wined3d_cs *cs, const void *data)
 
 static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
 {
-    struct wined3d_texture *logo_texture, *back_buffer;
+    struct wined3d_texture *logo_texture, *cursor_texture, *back_buffer;
     const struct wined3d_cs_present *op = data;
     struct wined3d_swapchain *swapchain;
     unsigned int i;
@@ -539,6 +539,31 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
                 &rect, WINED3D_BLT_SRC_CKEY, NULL, WINED3D_TEXF_POINT);
     }
 
+    if ((cursor_texture = swapchain->device->cursor_texture)
+            && swapchain->device->bCursorVisible && !swapchain->device->hardwareCursor)
+    {
+        RECT dst_rect =
+        {
+            swapchain->device->xScreenSpace - swapchain->device->xHotSpot,
+            swapchain->device->yScreenSpace - swapchain->device->yHotSpot,
+            swapchain->device->xScreenSpace + swapchain->device->cursorWidth - swapchain->device->xHotSpot,
+            swapchain->device->yScreenSpace + swapchain->device->cursorHeight - swapchain->device->yHotSpot,
+        };
+        RECT src_rect =
+        {
+            0, 0, cursor_texture->resource.width, cursor_texture->resource.height
+        };
+        const RECT clip_rect = {0, 0, back_buffer->resource.width, back_buffer->resource.height};
+
+        TRACE("Rendering the software cursor.\n");
+
+        if (swapchain->state.desc.windowed)
+            MapWindowPoints(NULL, swapchain->win_handle, (POINT *)&dst_rect, 2);
+        if (wined3d_clip_blit(&clip_rect, &dst_rect, &src_rect))
+            wined3d_texture_blt(back_buffer, 0, &dst_rect, cursor_texture, 0,
+                    &src_rect, WINED3D_BLT_ALPHA_TEST, NULL, WINED3D_TEXF_POINT);
+    }
+
     swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->swap_interval, op->flags);
 
     if (TRACE_ON(fps))
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index a48b98aac3f..289013f4e99 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -469,7 +469,6 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
     struct wined3d_texture *back_buffer = swapchain->back_buffers[0];
     const struct wined3d_fb_state *fb = &swapchain->device->cs->state.fb;
     struct wined3d_rendertarget_view *dsv = fb->depth_stencil;
-    struct wined3d_texture *cursor_texture;
     const struct wined3d_gl_info *gl_info;
     struct wined3d_context_gl *context_gl;
     struct wined3d_context *context;
@@ -488,31 +487,6 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
 
     swapchain_gl_set_swap_interval(swapchain, context_gl, swap_interval);
 
-    if ((cursor_texture = swapchain->device->cursor_texture)
-            && swapchain->device->bCursorVisible && !swapchain->device->hardwareCursor)
-    {
-        RECT dst_rect =
-        {
-            swapchain->device->xScreenSpace - swapchain->device->xHotSpot,
-            swapchain->device->yScreenSpace - swapchain->device->yHotSpot,
-            swapchain->device->xScreenSpace + swapchain->device->cursorWidth - swapchain->device->xHotSpot,
-            swapchain->device->yScreenSpace + swapchain->device->cursorHeight - swapchain->device->yHotSpot,
-        };
-        RECT src_rect =
-        {
-            0, 0, cursor_texture->resource.width, cursor_texture->resource.height
-        };
-        const RECT clip_rect = {0, 0, back_buffer->resource.width, back_buffer->resource.height};
-
-        TRACE("Rendering the software cursor.\n");
-
-        if (desc->windowed)
-            MapWindowPoints(NULL, swapchain->win_handle, (POINT *)&dst_rect, 2);
-        if (wined3d_clip_blit(&clip_rect, &dst_rect, &src_rect))
-            wined3d_texture_blt(back_buffer, 0, &dst_rect, cursor_texture, 0,
-                    &src_rect, WINED3D_BLT_ALPHA_TEST, NULL, WINED3D_TEXF_POINT);
-    }
-
     TRACE("Presenting DC %p.\n", context_gl->dc);
 
     if (!(render_to_fbo = swapchain->render_to_fbo)
-- 
2.20.1




More information about the wine-devel mailing list