diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 37f3430c..7b769571 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -333,6 +333,7 @@ patch_enable_all () enable_wined3d_WINED3D_RS_COLORWRITEENABLE="$1" enable_wined3d_WINED3D_TEXF_ANISOTROPIC="$1" enable_wined3d_mesa_texture_download="$1" + enable_wined3d_swapchain_buffers="$1" enable_wined3d_unset_flip_gdi="$1" enable_wined3d_wined3d_guess_gl_vendor="$1" enable_winedbg_Process_Arguments="$1" @@ -1132,6 +1133,9 @@ patch_enable () wined3d-mesa_texture_download) enable_wined3d_mesa_texture_download="$2" ;; + wined3d-swapchain-buffers) + enable_wined3d_swapchain_buffers="$2" + ;; wined3d-unset-flip-gdi) enable_wined3d_unset_flip_gdi="$2" ;; @@ -6897,6 +6901,21 @@ if test "$enable_wined3d_mesa_texture_download" -eq 1; then ) >> "$patchlist" fi +# Patchset wined3d-swapchain-buffers +# | +# | This patchset fixes the following Wine bugs: +# | * [#47479] wined3d: Correctly switch swapchain buffer. +# | +# | Modified files: +# | * dlls/wined3d/surface.c, dlls/wined3d/swapchain.c +# | +if test "$enable_wined3d_swapchain_buffers" -eq 1; then + patch_apply wined3d-swapchain-buffers/0001-wined3d-Correctly-switch-swapchain-buffer.patch + ( + printf '%s\n' '+ { "Henri Verbeet", "wined3d: Correctly switch swapchain buffer.", 1 },'; + ) >> "$patchlist" +fi + # Patchset wined3d-unset-flip-gdi # | # | This patchset fixes the following Wine bugs: diff --git a/patches/wined3d-swapchain-buffers/0001-wined3d-Correctly-switch-swapchain-buffer.patch b/patches/wined3d-swapchain-buffers/0001-wined3d-Correctly-switch-swapchain-buffer.patch new file mode 100644 index 00000000..d4286fd2 --- /dev/null +++ b/patches/wined3d-swapchain-buffers/0001-wined3d-Correctly-switch-swapchain-buffer.patch @@ -0,0 +1,77 @@ +From 568533b56ac447e3c7f4bd9be7a9785fcab79ec6 Mon Sep 17 00:00:00 2001 +From: Henri Verbeet +Date: Mon, 15 Jul 2019 08:54:30 +1000 +Subject: [PATCH] wined3d: Correctly switch swapchain buffer. + +Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47479 +--- + dlls/wined3d/surface.c | 23 +++++++++-------------- + dlls/wined3d/swapchain.c | 2 +- + 2 files changed, 10 insertions(+), 15 deletions(-) + +diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c +index 3668c61fa3..7d7dd257f6 100644 +--- a/dlls/wined3d/surface.c ++++ b/dlls/wined3d/surface.c +@@ -147,9 +147,9 @@ void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *co + const RECT *dst_rect) + { + struct wined3d_texture *required_texture, *restore_texture; +- unsigned int required_idx, restore_idx; + const struct wined3d_gl_info *gl_info; + struct wined3d_context_gl *context_gl; ++ unsigned int restore_idx; + GLenum gl_filter; + GLenum buffer; + RECT s, d; +@@ -192,26 +192,21 @@ void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *co + else + wined3d_texture_prepare_location(dst_texture, dst_sub_resource_idx, context, dst_location); + ++ /* Acquire a context for the front-buffer, even though we may be blitting ++ * to/from a back-buffer. Since context_acquire() doesn't take the ++ * resource location into account, it may consider the back-buffer to be ++ * offscreen. */ + if (src_location == WINED3D_LOCATION_DRAWABLE) +- { +- required_texture = src_texture; +- required_idx = src_sub_resource_idx; +- } ++ required_texture = src_texture->swapchain->front_buffer; + else if (dst_location == WINED3D_LOCATION_DRAWABLE) +- { +- required_texture = dst_texture; +- required_idx = dst_sub_resource_idx; +- } ++ required_texture = dst_texture->swapchain->front_buffer; + else +- { + required_texture = NULL; +- required_idx = 0; +- } + + restore_texture = context->current_rt.texture; + restore_idx = context->current_rt.sub_resource_idx; +- if (restore_texture != required_texture || restore_idx != required_idx) +- context = context_acquire(device, required_texture, required_idx); ++ if (restore_texture != required_texture) ++ context = context_acquire(device, required_texture, 0); + else + restore_texture = NULL; + +diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c +index bf0c308f0d..8603c8de7a 100644 +--- a/dlls/wined3d/swapchain.c ++++ b/dlls/wined3d/swapchain.c +@@ -434,7 +434,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, + struct wined3d_context *context; + BOOL render_to_fbo; + +- context = context_acquire(swapchain->device, back_buffer, 0); ++ context = context_acquire(swapchain->device, swapchain->front_buffer, 0); + context_gl = wined3d_context_gl(context); + if (!context_gl->valid) + { +-- +2.17.1 + diff --git a/patches/wined3d-swapchain-buffers/definition b/patches/wined3d-swapchain-buffers/definition new file mode 100644 index 00000000..3b10ff5d --- /dev/null +++ b/patches/wined3d-swapchain-buffers/definition @@ -0,0 +1 @@ +Fixes: [47479] wined3d: Correctly switch swapchain buffer.