diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 6cd894e5..117ec261 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -419,6 +419,7 @@ patch_enable_all () enable_wined3d_Revert_Pixel_Center_Offset="$1" enable_wined3d_Silence_FIXMEs="$1" enable_wined3d_WINED3DFMT_R32G32_UINT="$1" + enable_wined3d_buffer_create="$1" enable_wined3d_check_format_support="$1" enable_winedbg_Process_Arguments="$1" enable_winedevice_Fix_Relocation="$1" @@ -1479,6 +1480,9 @@ patch_enable () wined3d-WINED3DFMT_R32G32_UINT) enable_wined3d_WINED3DFMT_R32G32_UINT="$2" ;; + wined3d-buffer_create) + enable_wined3d_buffer_create="$2" + ;; wined3d-check_format_support) enable_wined3d_check_format_support="$2" ;; @@ -8535,6 +8539,18 @@ if test "$enable_wined3d_WINED3DFMT_R32G32_UINT" -eq 1; then ) >> "$patchlist" fi +# Patchset wined3d-buffer_create +# | +# | Modified files: +# | * dlls/wined3d/buffer.c +# | +if test "$enable_wined3d_buffer_create" -eq 1; then + patch_apply wined3d-buffer_create/0001-wined3d-Do-not-pin-large-buffers.patch + ( + printf '%s\n' '+ { "Michael Müller", "wined3d: Do not pin large buffers.", 1 },'; + ) >> "$patchlist" +fi + # Patchset wined3d-check_format_support # | # | Modified files: diff --git a/patches/wined3d-buffer_create/0001-wined3d-Create-buffers-on-default-pool-in-wined3d_bu.patch b/patches/wined3d-buffer_create/0001-wined3d-Create-buffers-on-default-pool-in-wined3d_bu.patch deleted file mode 100644 index 762323b4..00000000 --- a/patches/wined3d-buffer_create/0001-wined3d-Create-buffers-on-default-pool-in-wined3d_bu.patch +++ /dev/null @@ -1,25 +0,0 @@ -From f873a7b1be1f76c5dba0198353ed1256c8eaabd8 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sun, 12 Feb 2017 05:20:04 +0100 -Subject: wined3d: Create buffers on default pool in wined3d_buffer_create. - ---- - dlls/wined3d/buffer.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 386e40c1409..7fbccd7668b 100644 ---- a/dlls/wined3d/buffer.c -+++ b/dlls/wined3d/buffer.c -@@ -1500,7 +1500,7 @@ HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, const struct - FIXME("Ignoring access flags (pool).\n"); - - hr = buffer_init(object, device, desc->byte_width, desc->usage, WINED3DFMT_UNKNOWN, -- WINED3D_POOL_MANAGED, desc->bind_flags, data, parent, parent_ops); -+ WINED3D_POOL_DEFAULT, desc->bind_flags, data, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize buffer, hr %#x.\n", hr); --- -2.11.0 - diff --git a/patches/wined3d-buffer_create/0001-wined3d-Do-not-pin-large-buffers.patch b/patches/wined3d-buffer_create/0001-wined3d-Do-not-pin-large-buffers.patch new file mode 100644 index 00000000..e2de4ec5 --- /dev/null +++ b/patches/wined3d-buffer_create/0001-wined3d-Do-not-pin-large-buffers.patch @@ -0,0 +1,47 @@ +From d9725ddf519112095da4ac55c484681d839d86b0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Mon, 6 Mar 2017 17:40:49 +0100 +Subject: wined3d: Do not pin large buffers. + +--- + dlls/wined3d/buffer.c | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c +index c584147717b..4b53c42dbfe 100644 +--- a/dlls/wined3d/buffer.c ++++ b/dlls/wined3d/buffer.c +@@ -1455,6 +1455,7 @@ HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, const struct + struct wined3d_buffer **buffer) + { + struct wined3d_buffer *object; ++ enum wined3d_pool pool; + HRESULT hr; + + TRACE("device %p, desc %p, data %p, parent %p, parent_ops %p, buffer %p.\n", +@@ -1465,8 +1466,21 @@ HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, const struct + + FIXME("Ignoring access flags (pool).\n"); + ++ /* Some applications map the whole buffer even if they ++ * only update a small portion of it. If we pin such a ++ * buffer into system memory things get very slow as ++ * we upload the whole buffer even though just parts of ++ * it changed. Most drivers can handle this case more ++ * efficient using the OpenGL map functions. Applications ++ * affected by this problem are Banished and Witcher 3. ++ */ ++ if (desc->byte_width > 0x10000) ++ pool = WINED3D_POOL_DEFAULT; ++ else ++ pool = WINED3D_POOL_MANAGED; ++ + if (FAILED(hr = buffer_init(object, device, desc->byte_width, desc->usage, WINED3DFMT_UNKNOWN, +- WINED3D_POOL_MANAGED, desc->bind_flags, data, parent, parent_ops))) ++ pool, desc->bind_flags, data, parent, parent_ops))) + { + WARN("Failed to initialize buffer, hr %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); +-- +2.11.0 + diff --git a/patches/wined3d-buffer_create/definition b/patches/wined3d-buffer_create/definition deleted file mode 100644 index 4d863c41..00000000 --- a/patches/wined3d-buffer_create/definition +++ /dev/null @@ -1,2 +0,0 @@ -# FIXME: Causes performance issues -Disabled: true