From 37b0772439f9e9a27e27a36d4a486fadebcd1140 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Tue, 7 Mar 2017 02:12:41 +0100 Subject: [PATCH] Rebase against 3f50319ec384730360d16dd79d703adafaa953fc. --- ...b-for-GetCurrentPackageFamilyName-an.patch | 34 +- ...d-stub-for-GetCurrentPackageFullName.patch | 60 -- patches/patchinstall.sh | 9 +- ...-Implement-uploading-for-1d-textures.patch | 26 +- ...dd-additional-synchronization-CS-ops.patch | 53 +- ...d-Send-push_constants-through-the-CS.patch | 44 +- ...end-blits-through-the-command-stream.patch | 170 +--- ...der-target-view-clears-through-the-c.patch | 24 +- ...-update_texture-calls-through-the-CS.patch | 26 +- ...ate_sub_resource-calls-through-the-c.patch | 190 ---- ...dc-and-releasedc-through-the-command.patch | 38 +- ...he-swap-interval-through-the-CS-in-r.patch | 22 +- ...fer-update-subresource-requests-thro.patch | 59 -- ...ined3d-Map-vertex-buffers-through-cs.patch | 206 ----- ...introduce-a-multithreaded-command-st.patch | 252 +++-- ...-Introduce-a-separate-priority-queue.patch | 207 ++--- ...-wined3d_cs_emit_update_sub_resource.patch | 97 +- .../wined3d-CSMT_Main/9999-IfDefined.patch | 874 ++++++------------ ...mplement-wined3d_buffer_upload_data-.patch | 58 +- 19 files changed, 723 insertions(+), 1726 deletions(-) delete mode 100644 patches/kernel32-GetCurrentPackageFamilyName/0002-kernel32-add-stub-for-GetCurrentPackageFullName.patch delete mode 100644 patches/wined3d-CSMT_Main/0012-wined3d-Send-update_sub_resource-calls-through-the-c.patch delete mode 100644 patches/wined3d-CSMT_Main/0020-wined3d-Send-buffer-update-subresource-requests-thro.patch delete mode 100644 patches/wined3d-CSMT_Main/0026-wined3d-Map-vertex-buffers-through-cs.patch diff --git a/patches/kernel32-GetCurrentPackageFamilyName/0001-kernel32-Add-stub-for-GetCurrentPackageFamilyName-an.patch b/patches/kernel32-GetCurrentPackageFamilyName/0001-kernel32-Add-stub-for-GetCurrentPackageFamilyName-an.patch index 378d6fc0..8938df4d 100644 --- a/patches/kernel32-GetCurrentPackageFamilyName/0001-kernel32-Add-stub-for-GetCurrentPackageFamilyName-an.patch +++ b/patches/kernel32-GetCurrentPackageFamilyName/0001-kernel32-Add-stub-for-GetCurrentPackageFamilyName-an.patch @@ -1,4 +1,4 @@ -From 1696ec4c67d39495d63673137e25d11878c44c8c Mon Sep 17 00:00:00 2001 +From e2c6e94c6dd1312f467e5528fa2767b7da6eaca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 15 Jan 2016 13:23:02 +0100 Subject: kernel32: Add stub for GetCurrentPackageFamilyName and add related @@ -6,12 +6,12 @@ Subject: kernel32: Add stub for GetCurrentPackageFamilyName and add related --- .../api-ms-win-appmodel-runtime-l1-1-1.spec | 2 +- - dlls/kernel32/kernel32.spec | 35 ++++++++++++++++++++++ + dlls/kernel32/kernel32.spec | 34 ++++++++++++++++++++++ dlls/kernel32/version.c | 9 ++++++ - 3 files changed, 45 insertions(+), 1 deletion(-) + 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/dlls/api-ms-win-appmodel-runtime-l1-1-1/api-ms-win-appmodel-runtime-l1-1-1.spec b/dlls/api-ms-win-appmodel-runtime-l1-1-1/api-ms-win-appmodel-runtime-l1-1-1.spec -index 1eb8327..af7774d 100644 +index 2c5cf9e5bda..50f8594785f 100644 --- a/dlls/api-ms-win-appmodel-runtime-l1-1-1/api-ms-win-appmodel-runtime-l1-1-1.spec +++ b/dlls/api-ms-win-appmodel-runtime-l1-1-1/api-ms-win-appmodel-runtime-l1-1-1.spec @@ -3,7 +3,7 @@ @@ -20,11 +20,11 @@ index 1eb8327..af7774d 100644 @ stub GetCurrentApplicationUserModelId -@ stub GetCurrentPackageFamilyName +@ stdcall GetCurrentPackageFamilyName(ptr ptr) kernel32.GetCurrentPackageFamilyName - @ stub GetCurrentPackageFullName + @ stdcall GetCurrentPackageFullName(ptr ptr) kernel32.GetCurrentPackageFullName @ stdcall GetCurrentPackageId(ptr ptr) kernel32.GetCurrentPackageId @ stub GetCurrentPackageInfo diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec -index 3c25286..3c1cb23 100644 +index 59e39a74917..e01e8605d53 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -225,6 +225,7 @@ @@ -60,7 +60,7 @@ index 3c25286..3c1cb23 100644 @ stdcall GetAtomNameA(long ptr long) @ stdcall GetAtomNameW(long ptr long) @ stdcall GetBinaryType(str ptr) GetBinaryTypeA -@@ -624,11 +629,16 @@ +@@ -624,12 +629,16 @@ # @ stub GetCurrencyFormatEx @ stdcall GetCurrencyFormatW(long long str ptr str long) @ stdcall GetCurrentActCtx(ptr) @@ -70,14 +70,14 @@ index 3c25286..3c1cb23 100644 @ stdcall GetCurrentDirectoryA(long ptr) @ stdcall GetCurrentDirectoryW(long ptr) +@ stdcall GetCurrentPackageFamilyName(ptr ptr) -+@ stub GetCurrentPackageFullName @ stdcall GetCurrentPackageId(ptr ptr) + @ stdcall GetCurrentPackageFullName(ptr ptr) +@ stub GetCurrentPackageInfo +@ stub GetCurrentPackagePath @ stdcall -norelay GetCurrentProcess() @ stdcall -norelay GetCurrentProcessId() @ stdcall GetCurrentProcessorNumber() ntdll.NtGetCurrentProcessorNumber -@@ -759,6 +769,16 @@ +@@ -760,6 +769,16 @@ @ stdcall GetOEMCP() @ stdcall GetOverlappedResult(long ptr ptr long) @ stdcall GetUserPreferredUILanguages(long ptr ptr ptr) @@ -94,7 +94,7 @@ index 3c25286..3c1cb23 100644 @ stdcall GetPhysicallyInstalledSystemMemory(ptr) @ stdcall GetPriorityClass(long) @ stdcall GetPrivateProfileIntA(str str long str) -@@ -805,6 +825,8 @@ +@@ -806,6 +825,8 @@ @ stub -i386 GetSLCallbackTemplate @ stdcall GetShortPathNameA(str ptr long) @ stdcall GetShortPathNameW(wstr ptr long) @@ -103,7 +103,7 @@ index 3c25286..3c1cb23 100644 @ stdcall GetStartupInfoA(ptr) @ stdcall GetStartupInfoW(ptr) @ stdcall GetStdHandle(long) -@@ -1118,6 +1140,8 @@ +@@ -1119,6 +1140,8 @@ @ stdcall OpenJobObjectW(long long wstr) @ stdcall OpenMutexA(long long str) @ stdcall OpenMutexW(long long wstr) @@ -112,7 +112,7 @@ index 3c25286..3c1cb23 100644 # @ stub OpenPrivateNamespaceA # @ stub OpenPrivateNamespaceW @ stdcall OpenProcess(long long long) -@@ -1132,6 +1156,12 @@ +@@ -1133,6 +1156,12 @@ @ stdcall OpenWaitableTimerW(long long wstr) @ stdcall OutputDebugStringA(str) @ stdcall OutputDebugStringW(wstr) @@ -125,7 +125,7 @@ index 3c25286..3c1cb23 100644 @ stdcall PeekConsoleInputA(ptr ptr long ptr) @ stdcall PeekConsoleInputW(ptr ptr long ptr) @ stdcall PeekNamedPipe(long ptr long ptr ptr ptr) -@@ -1548,7 +1578,12 @@ +@@ -1549,7 +1578,12 @@ @ stdcall VerLanguageNameA(long str long) @ stdcall VerLanguageNameW(long wstr long) @ stdcall -ret64 VerSetConditionMask(long long long long) ntdll.VerSetConditionMask @@ -139,11 +139,11 @@ index 3c25286..3c1cb23 100644 @ stdcall VerifyVersionInfoA(long long int64) @ stdcall VerifyVersionInfoW(long long int64) diff --git a/dlls/kernel32/version.c b/dlls/kernel32/version.c -index b9d13e4..53f594e 100644 +index cf783af6195..aabc9bc2c64 100644 --- a/dlls/kernel32/version.c +++ b/dlls/kernel32/version.c -@@ -207,3 +207,12 @@ LONG WINAPI GetCurrentPackageId(UINT32 *len, BYTE *buffer) - FIXME("(%p %p): stub\n", len, buffer); +@@ -216,3 +216,12 @@ LONG WINAPI GetCurrentPackageFullName(UINT32 *length, PWSTR name) + FIXME("(%p %p): stub\n", length, name); return APPMODEL_ERROR_NO_PACKAGE; } + @@ -156,5 +156,5 @@ index b9d13e4..53f594e 100644 + return APPMODEL_ERROR_NO_PACKAGE; +} -- -2.9.0 +2.11.0 diff --git a/patches/kernel32-GetCurrentPackageFamilyName/0002-kernel32-add-stub-for-GetCurrentPackageFullName.patch b/patches/kernel32-GetCurrentPackageFamilyName/0002-kernel32-add-stub-for-GetCurrentPackageFullName.patch deleted file mode 100644 index e2435371..00000000 --- a/patches/kernel32-GetCurrentPackageFamilyName/0002-kernel32-add-stub-for-GetCurrentPackageFullName.patch +++ /dev/null @@ -1,60 +0,0 @@ -From bcbbde0daf2dd0fed6f41a455dae61b2aac6e376 Mon Sep 17 00:00:00 2001 -From: Louis Lenders -Date: Sat, 4 Mar 2017 11:05:52 +0100 -Subject: kernel32: add stub for GetCurrentPackageFullName - -See bug https://bugs.winehq.org/show_bug.cgi?id=42586 - -Signed-off-by: Louis Lenders ---- - .../api-ms-win-appmodel-runtime-l1-1-1.spec | 2 +- - dlls/kernel32/kernel32.spec | 2 +- - dlls/kernel32/version.c | 9 +++++++++ - 3 files changed, 11 insertions(+), 2 deletions(-) - -diff --git a/dlls/api-ms-win-appmodel-runtime-l1-1-1/api-ms-win-appmodel-runtime-l1-1-1.spec b/dlls/api-ms-win-appmodel-runtime-l1-1-1/api-ms-win-appmodel-runtime-l1-1-1.spec -index af7774d3679..50f8594785f 100644 ---- a/dlls/api-ms-win-appmodel-runtime-l1-1-1/api-ms-win-appmodel-runtime-l1-1-1.spec -+++ b/dlls/api-ms-win-appmodel-runtime-l1-1-1/api-ms-win-appmodel-runtime-l1-1-1.spec -@@ -4,7 +4,7 @@ - @ stub GetApplicationUserModelId - @ stub GetCurrentApplicationUserModelId - @ stdcall GetCurrentPackageFamilyName(ptr ptr) kernel32.GetCurrentPackageFamilyName --@ stub GetCurrentPackageFullName -+@ stdcall GetCurrentPackageFullName(ptr ptr) kernel32.GetCurrentPackageFullName - @ stdcall GetCurrentPackageId(ptr ptr) kernel32.GetCurrentPackageId - @ stub GetCurrentPackageInfo - @ stub GetCurrentPackagePath -diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec -index be514a32371..c240d1fb9ea 100644 ---- a/dlls/kernel32/kernel32.spec -+++ b/dlls/kernel32/kernel32.spec -@@ -635,7 +635,7 @@ - @ stdcall GetCurrentDirectoryA(long ptr) - @ stdcall GetCurrentDirectoryW(long ptr) - @ stdcall GetCurrentPackageFamilyName(ptr ptr) --@ stub GetCurrentPackageFullName -+@ stdcall GetCurrentPackageFullName(ptr ptr) - @ stdcall GetCurrentPackageId(ptr ptr) - @ stub GetCurrentPackageInfo - @ stub GetCurrentPackagePath -diff --git a/dlls/kernel32/version.c b/dlls/kernel32/version.c -index 53f594eccab..ddaccacbaa7 100644 ---- a/dlls/kernel32/version.c -+++ b/dlls/kernel32/version.c -@@ -216,3 +216,12 @@ LONG WINAPI GetCurrentPackageFamilyName(UINT32 *length, PWSTR name) - FIXME("(%p %p): stub\n", length, name); - return APPMODEL_ERROR_NO_PACKAGE; - } -+ -+/*********************************************************************** -+ * GetCurrentPackageFullName (KERNEL32.@) -+ */ -+LONG WINAPI GetCurrentPackageFullName(UINT32 *length, PWSTR name) -+{ -+ FIXME("(%p %p): stub\n", length, name); -+ return APPMODEL_ERROR_NO_PACKAGE; -+} --- -2.11.0 - diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 3ea6b659..5ca1ce0b 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "a2460b2424163bbf5b885db6a5423c3d98f883e0" + echo "3f50319ec384730360d16dd79d703adafaa953fc" } # Show version information @@ -2744,10 +2744,8 @@ fi # | if test "$enable_kernel32_GetCurrentPackageFamilyName" -eq 1; then patch_apply kernel32-GetCurrentPackageFamilyName/0001-kernel32-Add-stub-for-GetCurrentPackageFamilyName-an.patch - patch_apply kernel32-GetCurrentPackageFamilyName/0002-kernel32-add-stub-for-GetCurrentPackageFullName.patch ( printf '%s\n' '+ { "Michael Müller", "kernel32: Add stub for GetCurrentPackageFamilyName and add related functions to spec file.", 1 },'; - printf '%s\n' '+ { "Louis Lenders", "kernel32: Add stub for GetCurrentPackageFullName.", 1 },'; ) >> "$patchlist" fi @@ -8436,7 +8434,7 @@ fi # Patchset wined3d-Revert_Buffer_Upload # | # | Modified files: -# | * dlls/wined3d/buffer.c, dlls/wined3d/device.c, dlls/wined3d/wined3d_private.h +# | * dlls/wined3d/buffer.c, dlls/wined3d/cs.c, dlls/wined3d/wined3d_private.h # | if test "$enable_wined3d_Revert_Buffer_Upload" -eq 1; then patch_apply wined3d-Revert_Buffer_Upload/0001-Revert-wined3d-Implement-wined3d_buffer_upload_data-.patch @@ -8593,18 +8591,15 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send render target view clears through the command stream.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Get rid of the end_scene flush and finish.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send update_texture calls through the CS.", 1 },'; - printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send update_sub_resource calls through the command stream.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send getdc and releasedc through the command stream.", 1 },'; printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Send query_poll through the command stream.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Update the swap interval through the CS in reset.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Create initial DCs through the CS.", 1 },'; printf '%s\n' '+ { "Nils Kuhnhenn", "wined3d: Fix context_acquire not being called from the command thread in wined3d_texture_add_dirty_region.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Wrap GL BOs in a structure.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Send buffer update subresource requests through CS.", 1 },'; printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Send buffer copy requests through CS.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Avoid destroying views in color and depth fills.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Add a separate variable to check if queries are started.", 1 },'; - printf '%s\n' '+ { "Michael Müller", "wined3d: Map vertex buffers through cs.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Wait for the cs to finish before destroying the device.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Add swapchain waits.", 1 },'; printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Hackily introduce a multithreaded command stream.", 1 },'; diff --git a/patches/wined3d-1DTextures/0006-wined3d-Implement-uploading-for-1d-textures.patch b/patches/wined3d-1DTextures/0006-wined3d-Implement-uploading-for-1d-textures.patch index f4156982..3a1dae21 100644 --- a/patches/wined3d-1DTextures/0006-wined3d-Implement-uploading-for-1d-textures.patch +++ b/patches/wined3d-1DTextures/0006-wined3d-Implement-uploading-for-1d-textures.patch @@ -1,4 +1,4 @@ -From 736b314e18e7e4d3c7dc7732e2e38c6b8de7ddfd Mon Sep 17 00:00:00 2001 +From 227c20d336bca247834d85e6ddb6002680d3d700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 27 Aug 2016 22:25:20 +0200 Subject: wined3d: Implement uploading for 1d textures. @@ -9,24 +9,24 @@ Subject: wined3d: Implement uploading for 1d textures. 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 150f18f..c87b325 100644 +index bd08c352794..53ada28b11b 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -4140,7 +4140,8 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str - return; +@@ -4055,7 +4055,8 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str + height = 1; + depth = 1; } - -- if (resource->type != WINED3D_RTYPE_TEXTURE_2D && resource->type != WINED3D_RTYPE_TEXTURE_3D) -+ if (resource->type != WINED3D_RTYPE_TEXTURE_1D && -+ resource->type != WINED3D_RTYPE_TEXTURE_2D && resource->type != WINED3D_RTYPE_TEXTURE_3D) +- else if (resource->type == WINED3D_RTYPE_TEXTURE_2D || resource->type == WINED3D_RTYPE_TEXTURE_3D) ++ else if (resource->type == WINED3D_RTYPE_TEXTURE_1D || ++ resource->type == WINED3D_RTYPE_TEXTURE_2D || resource->type == WINED3D_RTYPE_TEXTURE_3D) { - FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(resource->type)); - return; + struct wined3d_texture *texture = texture_from_resource(resource); + unsigned int level; diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 2b66b68..614b4cf 100644 +index 296ca898f81..a3f90773904 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -1456,8 +1456,74 @@ static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int +@@ -1581,8 +1581,74 @@ static void texture1d_upload_data(struct wined3d_texture *texture, unsigned int const struct wined3d_context *context, const struct wined3d_box *box, const struct wined3d_const_bo_address *data, unsigned int row_pitch, unsigned int slice_pitch) { @@ -103,5 +103,5 @@ index 2b66b68..614b4cf 100644 /* Context activation is done by the caller. */ -- -2.9.0 +2.11.0 diff --git a/patches/wined3d-CSMT_Main/0001-wined3d-Add-additional-synchronization-CS-ops.patch b/patches/wined3d-CSMT_Main/0001-wined3d-Add-additional-synchronization-CS-ops.patch index b5206594..0b25b344 100644 --- a/patches/wined3d-CSMT_Main/0001-wined3d-Add-additional-synchronization-CS-ops.patch +++ b/patches/wined3d-CSMT_Main/0001-wined3d-Add-additional-synchronization-CS-ops.patch @@ -1,18 +1,18 @@ -From cc2cafc81cc50bcd93c20b887838dd663c190ef7 Mon Sep 17 00:00:00 2001 +From 94dd5e43f248b35ad24938fbf7422fd455f5185d Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 19 Feb 2017 00:57:12 +0100 Subject: wined3d: Add additional synchronization CS ops. --- - dlls/wined3d/cs.c | 51 ++++++++++++++++++++++++++++++++++++++++-- + dlls/wined3d/cs.c | 53 +++++++++++++++++++++++++++++++++++++++--- dlls/wined3d/device.c | 2 ++ dlls/wined3d/swapchain.c | 2 ++ dlls/wined3d/view.c | 6 +++++ dlls/wined3d/wined3d_private.h | 3 +++ - 5 files changed, 62 insertions(+), 2 deletions(-) + 5 files changed, 63 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 8afa7313a02..b27a083007b 100644 +index 39071faef32..543528ae570 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -26,6 +26,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); @@ -24,8 +24,8 @@ index 8afa7313a02..b27a083007b 100644 WINED3D_CS_OP_PRESENT, WINED3D_CS_OP_CLEAR, WINED3D_CS_OP_DISPATCH, -@@ -65,6 +67,16 @@ enum wined3d_cs_op - WINED3D_CS_OP_UNMAP, +@@ -66,6 +68,16 @@ enum wined3d_cs_op + WINED3D_CS_OP_UPDATE_SUB_RESOURCE, }; +struct wined3d_cs_sync @@ -41,8 +41,8 @@ index 8afa7313a02..b27a083007b 100644 struct wined3d_cs_present { enum wined3d_cs_op opcode; -@@ -344,6 +356,38 @@ struct wined3d_cs_unmap - HRESULT *hr; +@@ -354,6 +366,38 @@ struct wined3d_cs_update_sub_resource + struct wined3d_sub_resource_data data; }; +static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data) @@ -80,7 +80,7 @@ index 8afa7313a02..b27a083007b 100644 static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_present *op = data; -@@ -1618,7 +1662,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, +@@ -1628,7 +1672,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, op->flags = flags; op->hr = &hr; @@ -89,7 +89,7 @@ index 8afa7313a02..b27a083007b 100644 return hr; } -@@ -1642,13 +1686,15 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc +@@ -1652,7 +1696,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc op->sub_resource_idx = sub_resource_idx; op->hr = &hr; @@ -98,6 +98,13 @@ index 8afa7313a02..b27a083007b 100644 return hr; } +@@ -1726,11 +1770,13 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r + + wined3d_resource_acquire(resource); + +- cs->ops->submit(cs); ++ cs->ops->submit_and_wait(cs); + } static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { @@ -106,7 +113,7 @@ index 8afa7313a02..b27a083007b 100644 /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present, /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear, /* WINED3D_CS_OP_DISPATCH */ wined3d_cs_exec_dispatch, -@@ -1779,6 +1825,7 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops = +@@ -1862,6 +1908,7 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops = { wined3d_cs_st_require_space, wined3d_cs_st_submit, @@ -115,7 +122,7 @@ index 8afa7313a02..b27a083007b 100644 }; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index e812567b067..be6d784bddf 100644 +index 0baf7f1b7cc..ea27553e8c8 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1008,6 +1008,7 @@ static void wined3d_device_delete_opengl_contexts_cs(void *object) @@ -155,10 +162,10 @@ index 25deaeb1ae9..bd23999fb1e 100644 if (!swapchain->context[0]) { diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c -index 02964e4a96b..21aa8720e65 100644 +index 3cd20ea8fad..9b9e7eef4c6 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c -@@ -598,6 +598,8 @@ static void wined3d_shader_resource_view_cs_init(void *object) +@@ -594,6 +594,8 @@ static void wined3d_shader_resource_view_cs_init(void *object) debug_d3dformat(resource->format->id), debug_d3dformat(view_format->id)); } } @@ -167,7 +174,7 @@ index 02964e4a96b..21aa8720e65 100644 } static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_view *view, -@@ -614,6 +616,7 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_ +@@ -610,6 +612,7 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_ wined3d_resource_incref(view->resource = resource); @@ -175,7 +182,7 @@ index 02964e4a96b..21aa8720e65 100644 wined3d_cs_init_object(resource->device->cs, wined3d_shader_resource_view_cs_init, view); return WINED3D_OK; -@@ -760,6 +763,8 @@ static void wined3d_unordered_access_view_cs_init(void *object) +@@ -786,6 +789,8 @@ static void wined3d_unordered_access_view_cs_init(void *object) desc, texture, view->format); } } @@ -184,7 +191,7 @@ index 02964e4a96b..21aa8720e65 100644 } static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_access_view *view, -@@ -776,6 +781,7 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces +@@ -805,6 +810,7 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces wined3d_resource_incref(view->resource = resource); @@ -193,10 +200,10 @@ index 02964e4a96b..21aa8720e65 100644 return WINED3D_OK; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index d45e19b0224..d0385a5e90a 100644 +index e8d771ecb32..d2e0052067f 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3193,6 +3193,7 @@ struct wined3d_cs_ops +@@ -3198,6 +3198,7 @@ struct wined3d_cs_ops { void *(*require_space)(struct wined3d_cs *cs, size_t size); void (*submit)(struct wined3d_cs *cs); @@ -204,7 +211,7 @@ index d45e19b0224..d0385a5e90a 100644 void (*push_constants)(struct wined3d_cs *cs, enum wined3d_push_constants p, unsigned int start_idx, unsigned int count, const void *constants); }; -@@ -3219,6 +3220,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, +@@ -3224,6 +3225,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx, unsigned int start_idx, unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN; @@ -212,14 +219,14 @@ index d45e19b0224..d0385a5e90a 100644 void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN; -@@ -3270,6 +3272,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined +@@ -3275,6 +3277,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN; +void wined3d_cs_emit_sync(struct wined3d_cs *cs); void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; - void wined3d_cs_init_object(struct wined3d_cs *cs, - void (*callback)(void *object), void *object) DECLSPEC_HIDDEN; + void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, + unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, -- 2.11.0 diff --git a/patches/wined3d-CSMT_Main/0002-wined3d-Send-push_constants-through-the-CS.patch b/patches/wined3d-CSMT_Main/0002-wined3d-Send-push_constants-through-the-CS.patch index 654da670..ba67736c 100644 --- a/patches/wined3d-CSMT_Main/0002-wined3d-Send-push_constants-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0002-wined3d-Send-push_constants-through-the-CS.patch @@ -1,4 +1,4 @@ -From e565d8dfb0453633c53c6a74f5f204e99231729a Mon Sep 17 00:00:00 2001 +From ec1172f3bd0ba8c66347ed17edf086c850665f24 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 6 Feb 2017 05:50:11 +0100 Subject: wined3d: Send push_constants through the CS. @@ -10,19 +10,19 @@ Subject: wined3d: Send push_constants through the CS. 3 files changed, 77 insertions(+), 58 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 990cb6735d7..4612244ce0c 100644 +index 543528ae570..72c0ace384c 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -63,6 +63,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_UNLOAD_RESOURCE, +@@ -66,6 +66,7 @@ enum wined3d_cs_op WINED3D_CS_OP_MAP, WINED3D_CS_OP_UNMAP, + WINED3D_CS_OP_UPDATE_SUB_RESOURCE, + WINED3D_CS_OP_PUSH_CONSTANTS, }; struct wined3d_cs_sync -@@ -340,6 +341,15 @@ struct wined3d_cs_unmap - HRESULT *hr; +@@ -366,6 +367,15 @@ struct wined3d_cs_update_sub_resource + struct wined3d_sub_resource_data data; }; +struct wined3d_cs_push_constants @@ -37,8 +37,8 @@ index 990cb6735d7..4612244ce0c 100644 static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data) { } -@@ -1579,6 +1589,64 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc - return hr; +@@ -1773,6 +1783,64 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r + cs->ops->submit_and_wait(cs); } +static const struct @@ -102,15 +102,15 @@ index 990cb6735d7..4612244ce0c 100644 static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync, -@@ -1618,6 +1686,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource, +@@ -1815,6 +1883,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map, /* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap, + /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, + /* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants, }; static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) -@@ -1664,55 +1733,11 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs) +@@ -1861,55 +1930,11 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs) HeapFree(GetProcessHeap(), 0, data); } @@ -167,10 +167,10 @@ index 990cb6735d7..4612244ce0c 100644 struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index b449225d2e9..5e17ba185de 100644 +index ea27553e8c8..a06cae6412e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -2347,7 +2347,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, +@@ -2337,7 +2337,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, } else { @@ -179,7 +179,7 @@ index b449225d2e9..5e17ba185de 100644 } return WINED3D_OK; -@@ -2396,7 +2396,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, +@@ -2386,7 +2386,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, } else { @@ -188,7 +188,7 @@ index b449225d2e9..5e17ba185de 100644 } return WINED3D_OK; -@@ -2441,7 +2441,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, +@@ -2431,7 +2431,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, memset(&device->recording->changed.vs_consts_f[start_idx], 1, count * sizeof(*device->recording->changed.vs_consts_f)); else @@ -197,7 +197,7 @@ index b449225d2e9..5e17ba185de 100644 return WINED3D_OK; } -@@ -2580,7 +2580,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, +@@ -2570,7 +2570,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, } else { @@ -206,7 +206,7 @@ index b449225d2e9..5e17ba185de 100644 } return WINED3D_OK; -@@ -2629,7 +2629,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, +@@ -2619,7 +2619,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, } else { @@ -215,7 +215,7 @@ index b449225d2e9..5e17ba185de 100644 } return WINED3D_OK; -@@ -2675,7 +2675,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, +@@ -2665,7 +2665,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, memset(&device->recording->changed.ps_consts_f[start_idx], 1, count * sizeof(*device->recording->changed.ps_consts_f)); else @@ -225,10 +225,10 @@ index b449225d2e9..5e17ba185de 100644 return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 46ca81b4e77..df05dcb8fc8 100644 +index d2e0052067f..2a8f075667a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3169,8 +3169,6 @@ struct wined3d_cs_ops +@@ -3199,8 +3199,6 @@ struct wined3d_cs_ops void *(*require_space)(struct wined3d_cs *cs, size_t size); void (*submit)(struct wined3d_cs *cs); void (*submit_and_wait)(struct wined3d_cs *cs); @@ -237,7 +237,7 @@ index 46ca81b4e77..df05dcb8fc8 100644 }; struct wined3d_cs -@@ -3198,6 +3196,8 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN; +@@ -3229,6 +3227,8 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN; @@ -246,7 +246,7 @@ index 46ca81b4e77..df05dcb8fc8 100644 void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN; void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, -@@ -3253,12 +3253,6 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, +@@ -3289,12 +3289,6 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0008-wined3d-Send-blits-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0008-wined3d-Send-blits-through-the-command-stream.patch index bf7b5e9d..6b5bdace 100644 --- a/patches/wined3d-CSMT_Main/0008-wined3d-Send-blits-through-the-command-stream.patch +++ b/patches/wined3d-CSMT_Main/0008-wined3d-Send-blits-through-the-command-stream.patch @@ -1,4 +1,4 @@ -From c300fbe493da45c4767a7ebe73f9854a9a1101e8 Mon Sep 17 00:00:00 2001 +From a34bdbe6dd81562c6bad79e3c1662dd17333c447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Mon, 29 Apr 2013 18:49:53 +0200 Subject: wined3d: Send blits through the command stream. @@ -6,25 +6,24 @@ Subject: wined3d: Send blits through the command stream. This needs more work. This patch breaks error handling, and the split between surface_blt and surface_blt_ugly isn't particularly nice. --- - dlls/wined3d/cs.c | 52 +++++++++ - dlls/wined3d/device.c | 26 +++++ - dlls/wined3d/surface.c | 240 ++++++++++++++++++++++++----------------- + dlls/wined3d/cs.c | 52 +++++++++++ + dlls/wined3d/surface.c | 208 +++++++++++++++++++++++++---------------- dlls/wined3d/wined3d_private.h | 7 ++ - 4 files changed, 228 insertions(+), 97 deletions(-) + 3 files changed, 188 insertions(+), 79 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index ee3d9a79da0..1517df9da95 100644 +index 1366973c1e6..f2eb87e35b8 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -66,6 +66,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_MAP, +@@ -67,6 +67,7 @@ enum wined3d_cs_op WINED3D_CS_OP_UNMAP, + WINED3D_CS_OP_UPDATE_SUB_RESOURCE, WINED3D_CS_OP_PUSH_CONSTANTS, + WINED3D_CS_OP_BLT, }; struct wined3d_cs_sync -@@ -366,6 +367,18 @@ struct wined3d_cs_push_constants +@@ -376,6 +377,18 @@ struct wined3d_cs_push_constants BYTE constants[1]; }; @@ -43,7 +42,7 @@ index ee3d9a79da0..1517df9da95 100644 static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data) { } -@@ -1776,6 +1789,44 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con +@@ -1857,6 +1870,44 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con cs->ops->submit(cs); } @@ -88,70 +87,19 @@ index ee3d9a79da0..1517df9da95 100644 static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync, -@@ -1818,6 +1869,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map, +@@ -1900,6 +1951,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap, + /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, /* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants, + /* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt, }; static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) -diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 01f7f1b6d84..7644e2aa250 100644 ---- a/dlls/wined3d/device.c -+++ b/dlls/wined3d/device.c -@@ -4027,6 +4027,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev - struct wined3d_texture *dst_texture, *src_texture; - RECT dst_rect, src_rect; - HRESULT hr; -+ struct wined3d_box dst_box; - - TRACE("device %p, dst_resource %p, dst_sub_resource_idx %u, dst_x %u, dst_y %u, dst_z %u, " - "src_resource %p, src_sub_resource_idx %u, src_box %s.\n", -@@ -4114,6 +4115,14 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev - - if (src_box) - { -+ if ((src_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) -+ && !wined3d_texture_check_block_align(src_texture, -+ src_sub_resource_idx % src_texture->level_count, src_box)) -+ { -+ WARN("Source box not block-aligned.\n"); -+ return WINED3DERR_INVALIDCALL; -+ } -+ - SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom); - } - else -@@ -4127,6 +4136,23 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev - SetRect(&dst_rect, dst_x, dst_y, dst_x + (src_rect.right - src_rect.left), - dst_y + (src_rect.bottom - src_rect.top)); - -+ if (dst_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) -+ { -+ dst_box.left = dst_rect.left; -+ dst_box.top = dst_rect.top; -+ dst_box.front = 0; -+ dst_box.right = dst_rect.right; -+ dst_box.bottom = dst_rect.bottom; -+ dst_box.back = 1; -+ -+ if(!wined3d_texture_check_block_align(dst_texture, -+ dst_sub_resource_idx % dst_texture->level_count, &dst_box)) -+ { -+ WARN("Destination box not block-aligned.\n"); -+ return WINED3DERR_INVALIDCALL; -+ } -+ } -+ - if (FAILED(hr = wined3d_texture_blt(dst_texture, dst_sub_resource_idx, &dst_rect, - src_texture, src_sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT))) - WARN("Failed to blit, hr %#x.\n", hr); diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c -index 347a8097484..c0b34e20b83 100644 +index 0dffdfa30f2..47ef3759b3e 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c -@@ -3772,7 +3772,7 @@ const struct blit_shader cpu_blit = { +@@ -3737,7 +3737,7 @@ const struct blit_shader cpu_blit = { cpu_blit_blit_surface, }; @@ -160,19 +108,21 @@ index 347a8097484..c0b34e20b83 100644 struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) { -@@ -3782,9 +3782,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3747,11 +3747,10 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst struct wined3d_texture *dst_texture = dst_surface->container; struct wined3d_device *device = dst_texture->resource.device; struct wined3d_swapchain *src_swapchain, *dst_swapchain; - struct wined3d_texture *src_texture = NULL; -- unsigned int dst_w, dst_h, src_w, src_h; - unsigned int src_sub_resource_idx = 0; + struct wined3d_texture *src_texture; + unsigned int src_sub_resource_idx; DWORD src_ds_flags, dst_ds_flags; BOOL scale, convert; +- HRESULT hr; -@@ -3797,84 +3796,17 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst + static const DWORD simple_blit = WINED3D_BLT_ASYNC + | WINED3D_BLT_COLOR_FILL +@@ -3762,66 +3761,17 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst | WINED3D_BLT_DO_NOT_WAIT | WINED3D_BLT_ALPHA_TEST; @@ -207,30 +157,12 @@ index 347a8097484..c0b34e20b83 100644 - return WINEDDERR_SURFACEBUSY; - } - -- dst_w = wined3d_texture_get_level_width(dst_texture, dst_surface->texture_level); -- dst_h = wined3d_texture_get_level_height(dst_texture, dst_surface->texture_level); -- if (IsRectEmpty(dst_rect) || dst_rect->left > dst_w || dst_rect->left < 0 -- || dst_rect->top > dst_h || dst_rect->top < 0 -- || dst_rect->right > dst_w || dst_rect->right < 0 -- || dst_rect->bottom > dst_h || dst_rect->bottom < 0) -- { -- WARN("The application gave us a bad destination rectangle.\n"); -- return WINEDDERR_INVALIDRECT; -- } +- if (FAILED(hr = wined3d_texture_check_box_dimensions(dst_texture, dst_surface->texture_level, &dst_box))) +- return hr; - -- if (src_texture) -- { -- src_w = wined3d_texture_get_level_width(src_texture, src_surface->texture_level); -- src_h = wined3d_texture_get_level_height(src_texture, src_surface->texture_level); -- if (IsRectEmpty(src_rect) || src_rect->left > src_w || src_rect->left < 0 -- || src_rect->top > src_h || src_rect->top < 0 -- || src_rect->right > src_w || src_rect->right < 0 -- || src_rect->bottom > src_h || src_rect->bottom < 0) -- { -- WARN("The application gave us a bad source rectangle.\n"); -- return WINEDDERR_INVALIDRECT; -- } -- } +- if (src_texture && FAILED(hr = wined3d_texture_check_box_dimensions(src_texture, +- src_surface->texture_level, &src_box))) +- return hr; - - if (!fx || !(fx->fx)) - flags &= ~WINED3D_BLT_FX; @@ -262,7 +194,7 @@ index 347a8097484..c0b34e20b83 100644 } if (!device->d3d_initialized) -@@ -3899,11 +3831,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3846,11 +3796,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; } @@ -274,7 +206,7 @@ index 347a8097484..c0b34e20b83 100644 dst_swapchain = dst_texture->swapchain; /* This isn't strictly needed. FBO blits for example could deal with -@@ -3939,22 +3866,16 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3886,22 +3831,16 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst TRACE("Depth fill.\n"); if (!wined3d_format_convert_color_to_float(dst_texture->resource.format, NULL, fx->fill_color, &color)) @@ -300,7 +232,7 @@ index 347a8097484..c0b34e20b83 100644 } } else -@@ -3990,7 +3911,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3937,7 +3876,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color))) @@ -309,7 +241,7 @@ index 347a8097484..c0b34e20b83 100644 } else { -@@ -4034,7 +3955,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3981,7 +3920,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst context, dst_texture->resource.draw_binding); context_release(context); } @@ -318,7 +250,7 @@ index 347a8097484..c0b34e20b83 100644 } } } -@@ -4058,7 +3979,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4005,7 +3944,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, 0); dst_swapchain->desc.swap_effect = swap_effect; @@ -327,7 +259,7 @@ index 347a8097484..c0b34e20b83 100644 } if (fbo_blit_supported(&device->adapter->gl_info, blit_op, -@@ -4079,7 +4000,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4026,7 +3965,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~dst_texture->resource.draw_binding); @@ -336,7 +268,7 @@ index 347a8097484..c0b34e20b83 100644 } blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op, -@@ -4089,7 +4010,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4036,7 +3975,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst { blitter->blit_surface(device, blit_op, filter, src_surface, src_rect, dst_surface, dst_rect, color_key); @@ -345,7 +277,7 @@ index 347a8097484..c0b34e20b83 100644 } } } -@@ -4097,9 +4018,134 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4044,9 +3983,120 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst fallback: /* Special cases for render targets. */ if (SUCCEEDED(surface_blt_special(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter))) @@ -362,14 +294,17 @@ index 347a8097484..c0b34e20b83 100644 + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, + const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) +{ ++ struct wined3d_box dst_box = {dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, 0, 1}; ++ struct wined3d_box src_box = {src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1}; + struct wined3d_texture *dst_texture = dst_surface->container; ++ struct wined3d_texture *src_texture = NULL; + struct wined3d_device *device = dst_texture->resource.device; + unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface), src_sub_resource_idx; + struct wined3d_texture_sub_resource *dst_sub_resource = + &dst_texture->sub_resources[dst_sub_resource_idx]; + struct wined3d_texture_sub_resource *src_sub_resource = NULL; -+ unsigned int dst_w, dst_h, src_w, src_h; + DWORD src_ds_flags, dst_ds_flags; ++ HRESULT hr; + + TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", + dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), @@ -390,6 +325,7 @@ index 347a8097484..c0b34e20b83 100644 + + if (src_surface) + { ++ src_texture = src_surface->container; + src_sub_resource_idx = surface_get_sub_resource_idx(src_surface); + src_sub_resource = &src_surface->container->sub_resources[src_sub_resource_idx]; + } @@ -404,30 +340,12 @@ index 347a8097484..c0b34e20b83 100644 + } + } + -+ dst_w = wined3d_texture_get_level_width(dst_texture, dst_surface->texture_level); -+ dst_h = wined3d_texture_get_level_height(dst_texture, dst_surface->texture_level); -+ if (IsRectEmpty(dst_rect) || dst_rect->left > dst_w || dst_rect->left < 0 -+ || dst_rect->top > dst_h || dst_rect->top < 0 -+ || dst_rect->right > dst_w || dst_rect->right < 0 -+ || dst_rect->bottom > dst_h || dst_rect->bottom < 0) -+ { -+ WARN("The application gave us a bad destination rectangle.\n"); -+ return WINEDDERR_INVALIDRECT; -+ } ++ if (FAILED(hr = wined3d_texture_check_box_dimensions(dst_texture, dst_surface->texture_level, &dst_box))) ++ return hr; + -+ if (src_surface) -+ { -+ src_w = wined3d_texture_get_level_width(src_surface->container, src_surface->texture_level); -+ src_h = wined3d_texture_get_level_height(src_surface->container, src_surface->texture_level); -+ if (IsRectEmpty(src_rect) || src_rect->left > src_w || src_rect->left < 0 -+ || src_rect->top > src_h || src_rect->top < 0 -+ || src_rect->right > src_w || src_rect->right < 0 -+ || src_rect->bottom > src_h || src_rect->bottom < 0) -+ { -+ WARN("The application gave us a bad source rectangle.\n"); -+ return WINEDDERR_INVALIDRECT; -+ } -+ } ++ if (src_texture && FAILED(hr = wined3d_texture_check_box_dimensions(src_texture, ++ src_surface->texture_level, &src_box))) ++ return hr; + + dst_ds_flags = dst_texture->resource.format_flags + & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL); @@ -483,10 +401,10 @@ index 347a8097484..c0b34e20b83 100644 + return WINED3D_OK; +} diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index c62c64e7d3d..62f9c484287 100644 +index a3716e937a5..1c3ba4644f1 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3048,6 +3048,9 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -3067,6 +3067,9 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, const RECT *src_rect, UINT src_pitch, const POINT *dst_point, BOOL srgb, const struct wined3d_const_bo_address *data) DECLSPEC_HIDDEN; @@ -496,7 +414,7 @@ index c62c64e7d3d..62f9c484287 100644 void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; -@@ -3199,6 +3202,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HID +@@ -3218,6 +3221,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HID void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0009-wined3d-Send-render-target-view-clears-through-the-c.patch b/patches/wined3d-CSMT_Main/0009-wined3d-Send-render-target-view-clears-through-the-c.patch index 06287c7c..92d0f723 100644 --- a/patches/wined3d-CSMT_Main/0009-wined3d-Send-render-target-view-clears-through-the-c.patch +++ b/patches/wined3d-CSMT_Main/0009-wined3d-Send-render-target-view-clears-through-the-c.patch @@ -1,4 +1,4 @@ -From 71236080e419dcf33176b5f8f54bbaf2dbefb630 Mon Sep 17 00:00:00 2001 +From da8e396548580773fb77f92c866163693dd576e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 4 Jul 2013 21:10:16 +0200 Subject: wined3d: Send render target view clears through the command stream @@ -24,18 +24,18 @@ index 8e5be756654..88e0e44c4d3 100644 * supported as offscreen plain surfaces and do not support D3DUSAGE_RENDERTARGET * when created as texture. */ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 1517df9da95..ebc4e4f15e5 100644 +index f2eb87e35b8..c38bbbd2754 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -67,6 +67,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_UNMAP, +@@ -68,6 +68,7 @@ enum wined3d_cs_op + WINED3D_CS_OP_UPDATE_SUB_RESOURCE, WINED3D_CS_OP_PUSH_CONSTANTS, WINED3D_CS_OP_BLT, + WINED3D_CS_OP_CLEAR_RTV, }; struct wined3d_cs_sync -@@ -379,6 +380,18 @@ struct wined3d_cs_blt +@@ -389,6 +390,18 @@ struct wined3d_cs_blt enum wined3d_texture_filter_type filter; }; @@ -54,7 +54,7 @@ index 1517df9da95..ebc4e4f15e5 100644 static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data) { } -@@ -1827,6 +1840,41 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf +@@ -1908,6 +1921,41 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf cs->ops->submit(cs); } @@ -96,8 +96,8 @@ index 1517df9da95..ebc4e4f15e5 100644 static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync, -@@ -1870,6 +1918,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap, +@@ -1952,6 +2000,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, /* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants, /* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt, + /* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv, @@ -105,10 +105,10 @@ index 1517df9da95..ebc4e4f15e5 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 7644e2aa250..35c57ff7b94 100644 +index a06cae6412e..0e491b3b8cd 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -4283,10 +4283,8 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi +@@ -4246,10 +4246,8 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi return WINED3DERR_INVALIDCALL; } @@ -122,10 +122,10 @@ index 7644e2aa250..35c57ff7b94 100644 struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 62f9c484287..334cdf0fb8b 100644 +index 1c3ba4644f1..6fbfa5d9c9c 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3208,6 +3208,9 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf +@@ -3227,6 +3227,9 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0011-wined3d-Send-update_texture-calls-through-the-CS.patch b/patches/wined3d-CSMT_Main/0011-wined3d-Send-update_texture-calls-through-the-CS.patch index 62fd9102..095d4ab3 100644 --- a/patches/wined3d-CSMT_Main/0011-wined3d-Send-update_texture-calls-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0011-wined3d-Send-update_texture-calls-through-the-CS.patch @@ -1,4 +1,4 @@ -From 91f8e688a10e60bf4240ec172bc4a56d6c2f59d9 Mon Sep 17 00:00:00 2001 +From ae3267b2c9b77715d189c233472c870a0f55d41b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 1 Aug 2013 00:33:48 +0200 Subject: wined3d: Send update_texture calls through the CS @@ -11,10 +11,10 @@ FIXME: This logic duplication is ugly. 3 files changed, 141 insertions(+), 75 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index ebc4e4f15e5..461ef30f17a 100644 +index c38bbbd2754..47678602fed 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -68,6 +68,7 @@ enum wined3d_cs_op +@@ -69,6 +69,7 @@ enum wined3d_cs_op WINED3D_CS_OP_PUSH_CONSTANTS, WINED3D_CS_OP_BLT, WINED3D_CS_OP_CLEAR_RTV, @@ -22,7 +22,7 @@ index ebc4e4f15e5..461ef30f17a 100644 }; struct wined3d_cs_sync -@@ -392,6 +393,12 @@ struct wined3d_cs_clear_rtv +@@ -402,6 +403,12 @@ struct wined3d_cs_clear_rtv const struct blit_shader *blitter; }; @@ -35,7 +35,7 @@ index ebc4e4f15e5..461ef30f17a 100644 static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data) { } -@@ -1875,6 +1882,35 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge +@@ -1956,6 +1963,35 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge cs->ops->submit(cs); } @@ -71,7 +71,7 @@ index ebc4e4f15e5..461ef30f17a 100644 static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync, -@@ -1919,6 +1955,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2001,6 +2037,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants, /* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt, /* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv, @@ -80,7 +80,7 @@ index ebc4e4f15e5..461ef30f17a 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 72cf63af27f..8f7640cadc2 100644 +index 2fdfd944b7e..d244091782f 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3627,34 +3627,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device @@ -316,10 +316,10 @@ index 72cf63af27f..8f7640cadc2 100644 HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 334cdf0fb8b..81bcadc927f 100644 +index 6fbfa5d9c9c..5b68475945d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2683,6 +2683,8 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -2702,6 +2702,8 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; @@ -328,10 +328,10 @@ index 334cdf0fb8b..81bcadc927f 100644 static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -3272,6 +3274,8 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, - void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN; - void wined3d_cs_emit_sync(struct wined3d_cs *cs); - void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; +@@ -3294,6 +3296,8 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou + void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, + unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, + unsigned int slice_pitch) DECLSPEC_HIDDEN; +void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_texture *src, + struct wined3d_texture *dst) DECLSPEC_HIDDEN; void wined3d_cs_init_object(struct wined3d_cs *cs, diff --git a/patches/wined3d-CSMT_Main/0012-wined3d-Send-update_sub_resource-calls-through-the-c.patch b/patches/wined3d-CSMT_Main/0012-wined3d-Send-update_sub_resource-calls-through-the-c.patch deleted file mode 100644 index 84e0115d..00000000 --- a/patches/wined3d-CSMT_Main/0012-wined3d-Send-update_sub_resource-calls-through-the-c.patch +++ /dev/null @@ -1,190 +0,0 @@ -From 816ad331869dde6ef0c3326e010ef672e55e8b9a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Stefan=20D=C3=B6singer?= -Date: Fri, 4 Sep 2015 15:22:49 +0200 -Subject: wined3d: Send update_sub_resource calls through the command stream. - ---- - dlls/wined3d/cs.c | 67 ++++++++++++++++++++++++++++++++++++++++++ - dlls/wined3d/device.c | 22 +------------- - dlls/wined3d/texture.c | 2 +- - dlls/wined3d/wined3d_private.h | 5 ++++ - 4 files changed, 74 insertions(+), 22 deletions(-) - -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 6ffdd920403..ac9e09345dd 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -70,6 +70,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_BLT, - WINED3D_CS_OP_CLEAR_RTV, - WINED3D_CS_OP_UPDATE_TEXTURE, -+ WINED3D_CS_OP_UPDATE_SUB_RESOURCE, - }; - - struct wined3d_cs_sync -@@ -405,6 +406,15 @@ struct wined3d_cs_update_texture - struct wined3d_texture *src, *dst; - }; - -+struct wined3d_cs_update_sub_resource -+{ -+ enum wined3d_cs_op opcode; -+ struct wined3d_resource *resource; -+ unsigned int sub_resource_idx, row_pitch, depth_pitch; -+ const struct wined3d_box *box; -+ const void *data; -+}; -+ - static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data) - { - } -@@ -1928,6 +1938,62 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur - cs->ops->submit(cs); - } - -+static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_update_sub_resource *op = data; -+ struct wined3d_const_bo_address addr; -+ struct wined3d_context *context; -+ struct wined3d_texture *texture; -+ unsigned int width, height, depth, level; -+ -+ texture = wined3d_texture_from_resource(op->resource); -+ -+ level = op->sub_resource_idx % texture->level_count; -+ width = wined3d_texture_get_level_width(texture, level); -+ height = wined3d_texture_get_level_height(texture, level); -+ depth = wined3d_texture_get_level_depth(texture, level); -+ -+ addr.buffer_object = 0; -+ addr.addr = op->data; -+ -+ context = context_acquire(texture->resource.device, NULL, 0); -+ -+ /* Only load the sub-resource for partial updates. */ -+ if (!op->box || (!op->box->left && !op->box->top && !op->box->front -+ && op->box->right == width && op->box->bottom == height && op->box->back == depth)) -+ wined3d_texture_prepare_texture(texture, context, FALSE); -+ else -+ wined3d_texture_load_location(texture, op->sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB); -+ wined3d_texture_bind_and_dirtify(texture, context, FALSE); -+ -+ wined3d_texture_upload_data(texture, op->sub_resource_idx, context, op->box, &addr, op->row_pitch, op->depth_pitch); -+ -+ context_release(context); -+ -+ wined3d_texture_validate_location(texture, op->sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); -+ wined3d_texture_invalidate_location(texture, op->sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB); -+} -+ -+void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, -+ unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, -+ unsigned int depth_pitch) -+{ -+ struct wined3d_cs_update_sub_resource *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; -+ op->resource = resource; -+ op->sub_resource_idx = sub_resource_idx; -+ op->box = box; -+ op->data = data; -+ op->row_pitch = row_pitch; -+ op->depth_pitch = depth_pitch; -+ -+ /* The data pointer may go away, need to wait until the data is read. Copying the data may be faster. -+ * Don't forget to copy box as well in this case. */ -+ cs->ops->submit_and_wait(cs); -+} -+ - static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = - { - /* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync, -@@ -1974,6 +2040,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt, - /* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv, - /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, -+ /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, - }; - - static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) -diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 6e7d4f800b3..86b1808463e 100644 ---- a/dlls/wined3d/device.c -+++ b/dlls/wined3d/device.c -@@ -4171,8 +4171,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str - unsigned int depth_pitch) - { - unsigned int width, height, depth, level; -- struct wined3d_const_bo_address addr; -- struct wined3d_context *context; - struct wined3d_texture *texture; - - TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n", -@@ -4222,25 +4220,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str - return; - } - -- addr.buffer_object = 0; -- addr.addr = data; -- -- context = context_acquire(resource->device, NULL, 0); -- -- /* Only load the sub-resource for partial updates. */ -- if (!box || (!box->left && !box->top && !box->front -- && box->right == width && box->bottom == height && box->back == depth)) -- wined3d_texture_prepare_texture(texture, context, FALSE); -- else -- wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB); -- wined3d_texture_bind_and_dirtify(texture, context, FALSE); -- -- wined3d_texture_upload_data(texture, sub_resource_idx, context, box, &addr, row_pitch, depth_pitch); -- -- context_release(context); -- -- wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); -- wined3d_texture_invalidate_location(texture, sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB); -+ wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch); - } - - HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, -diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 74b1ca2c546..5673a93f791 100644 ---- a/dlls/wined3d/texture.c -+++ b/dlls/wined3d/texture.c -@@ -1498,7 +1498,7 @@ void CDECL wined3d_texture_generate_mipmaps(struct wined3d_texture *texture) - FIXME("texture %p stub!\n", texture); - } - --static struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct wined3d_texture *texture, -+struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct wined3d_texture *texture, - unsigned int sub_resource_idx) - { - UINT sub_count = texture->level_count * texture->layer_count; -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 9e2c272eeda..17cb43771d8 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -2919,6 +2919,8 @@ BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture, - GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN; - void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx, - struct wined3d_bo_address *data, DWORD locations) DECLSPEC_HIDDEN; -+struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct wined3d_texture *texture, -+ unsigned int sub_resource_idx) DECLSPEC_HIDDEN; - void wined3d_texture_invalidate_location(struct wined3d_texture *texture, - unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN; - void wined3d_texture_load(struct wined3d_texture *texture, -@@ -3264,6 +3266,9 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, - void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN; - void wined3d_cs_emit_sync(struct wined3d_cs *cs); - void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, -+ unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, -+ unsigned int depth_pitch) DECLSPEC_HIDDEN; - void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_texture *src, - struct wined3d_texture *dst) DECLSPEC_HIDDEN; - void wined3d_cs_init_object(struct wined3d_cs *cs, --- -2.11.0 - diff --git a/patches/wined3d-CSMT_Main/0013-wined3d-Send-getdc-and-releasedc-through-the-command.patch b/patches/wined3d-CSMT_Main/0013-wined3d-Send-getdc-and-releasedc-through-the-command.patch index 1ed9d71a..5cc01482 100644 --- a/patches/wined3d-CSMT_Main/0013-wined3d-Send-getdc-and-releasedc-through-the-command.patch +++ b/patches/wined3d-CSMT_Main/0013-wined3d-Send-getdc-and-releasedc-through-the-command.patch @@ -1,4 +1,4 @@ -From 5cde9b1eaee021e59d3a7b17bfdc69270771003d Mon Sep 17 00:00:00 2001 +From 41decdb7669a8e83c5c6a244b50822d93ad8d1db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 16 Mar 2014 14:13:42 +0100 Subject: wined3d: Send getdc and releasedc through the command stream. @@ -11,20 +11,20 @@ Another hacky patch to avoid using GL outside the worker thread. 3 files changed, 119 insertions(+), 29 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index e2b756eecb9..86ae7eb89c8 100644 +index 47678602fed..735991db6e2 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -70,6 +70,8 @@ enum wined3d_cs_op + WINED3D_CS_OP_BLT, WINED3D_CS_OP_CLEAR_RTV, WINED3D_CS_OP_UPDATE_TEXTURE, - WINED3D_CS_OP_UPDATE_SUB_RESOURCE, + WINED3D_CS_OP_GET_DC, + WINED3D_CS_OP_RELEASE_DC, }; struct wined3d_cs_sync -@@ -409,6 +411,14 @@ struct wined3d_cs_update_sub_resource - const void *data; +@@ -409,6 +411,14 @@ struct wined3d_cs_update_texture + struct wined3d_texture *src, *dst; }; +struct wined3d_cs_get_release_dc @@ -38,8 +38,8 @@ index e2b756eecb9..86ae7eb89c8 100644 static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data) { } -@@ -1977,6 +1987,54 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r - cs->ops->submit_and_wait(cs); +@@ -1992,6 +2002,54 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur + cs->ops->submit(cs); } +static void wined3d_cs_exec_get_dc(struct wined3d_cs *cs, const void *data) @@ -93,20 +93,20 @@ index e2b756eecb9..86ae7eb89c8 100644 static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync, -@@ -2023,6 +2081,8 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2038,6 +2096,8 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt, /* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv, /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, - /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, + /* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc, + /* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc, }; static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 65777aad7be..644637696ea 100644 +index 378ce476ca0..5c9cadef95a 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -3486,13 +3486,41 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct +@@ -3473,13 +3473,41 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct return WINED3D_OK; } @@ -150,7 +150,7 @@ index 65777aad7be..644637696ea 100644 TRACE("texture %p, sub_resource_idx %u, dc %p.\n", texture, sub_resource_idx, dc); -@@ -3517,28 +3545,32 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -3504,28 +3532,32 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i if (texture->resource.map_count && !(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) return WINED3DERR_INVALIDCALL; @@ -200,7 +200,7 @@ index 65777aad7be..644637696ea 100644 } HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc) -@@ -3569,14 +3601,5 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -3556,14 +3588,5 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign return WINED3DERR_INVALIDCALL; } @@ -217,18 +217,18 @@ index 65777aad7be..644637696ea 100644 + return wined3d_cs_emit_release_dc(device->cs, texture, sub_resource_idx); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 9cd5c2e316a..822d951b80f 100644 +index 5b68475945d..0d85fadec75 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2928,6 +2928,7 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, +@@ -2947,6 +2947,7 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; - BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture, + HRESULT wined3d_texture_check_box_dimensions(const struct wined3d_texture *texture, unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN; +HRESULT wined3d_texture_get_dc_cs(struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN; void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_bo_address *data, DWORD locations) DECLSPEC_HIDDEN; -@@ -2945,6 +2946,8 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -2962,6 +2963,8 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; @@ -237,7 +237,7 @@ index 9cd5c2e316a..822d951b80f 100644 void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) DECLSPEC_HIDDEN; void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; -@@ -3220,6 +3223,8 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, +@@ -3237,6 +3240,8 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx, unsigned int start_idx, unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN; @@ -246,7 +246,7 @@ index 9cd5c2e316a..822d951b80f 100644 void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, -@@ -3227,6 +3232,8 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -3244,6 +3249,8 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p, unsigned int start_idx, unsigned int count, const void *constants) DECLSPEC_HIDDEN; void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0016-wined3d-Update-the-swap-interval-through-the-CS-in-r.patch b/patches/wined3d-CSMT_Main/0016-wined3d-Update-the-swap-interval-through-the-CS-in-r.patch index 5c725ed2..1837208f 100644 --- a/patches/wined3d-CSMT_Main/0016-wined3d-Update-the-swap-interval-through-the-CS-in-r.patch +++ b/patches/wined3d-CSMT_Main/0016-wined3d-Update-the-swap-interval-through-the-CS-in-r.patch @@ -1,4 +1,4 @@ -From 207bfb3829ccd61de999f5d1797fabee9cb44e4c Mon Sep 17 00:00:00 2001 +From 6f0d725b9aad64432838ef31d2d4a69336a4839d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 7 May 2016 21:58:06 +0100 Subject: wined3d: Update the swap interval through the CS in reset. @@ -10,11 +10,11 @@ Subject: wined3d: Update the swap interval through the CS in reset. 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index eaa9267e5ba..770760f78c7 100644 +index 07fccb41bfd..53883ff103c 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -73,6 +73,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_UPDATE_SUB_RESOURCE, + WINED3D_CS_OP_UPDATE_TEXTURE, WINED3D_CS_OP_GET_DC, WINED3D_CS_OP_RELEASE_DC, + WINED3D_CS_OP_UPDATE_SWAP_INTERVAL, @@ -34,7 +34,7 @@ index eaa9267e5ba..770760f78c7 100644 static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data) { } -@@ -2067,6 +2074,24 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture +@@ -2083,6 +2090,24 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture return hr; } @@ -59,8 +59,8 @@ index eaa9267e5ba..770760f78c7 100644 static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync, -@@ -2116,6 +2141,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, +@@ -2132,6 +2157,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, /* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc, /* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc, + /* WINED3D_CS_OP_UPDATE_SWAP_INTERVAL */ wined3d_cs_exec_update_swap_interval, @@ -68,10 +68,10 @@ index eaa9267e5ba..770760f78c7 100644 static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 03361548a89..3870ecf3f0d 100644 +index d244091782f..d0af77483e7 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -4850,7 +4850,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4833,7 +4833,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, { if (reset_state) hr = wined3d_device_create_primary_opengl_context(device); @@ -81,13 +81,13 @@ index 03361548a89..3870ecf3f0d 100644 /* All done. There is no need to reload resources or shaders, this will happen automatically on the diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 667b66f8231..6e215b8f2c4 100644 +index 05c1b2d32a3..b8f2ade12dd 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3301,6 +3301,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou +@@ -3304,6 +3304,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, - unsigned int depth_pitch) DECLSPEC_HIDDEN; + unsigned int slice_pitch) DECLSPEC_HIDDEN; +void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_texture *src, struct wined3d_texture *dst) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0020-wined3d-Send-buffer-update-subresource-requests-thro.patch b/patches/wined3d-CSMT_Main/0020-wined3d-Send-buffer-update-subresource-requests-thro.patch deleted file mode 100644 index 4ffe0d32..00000000 --- a/patches/wined3d-CSMT_Main/0020-wined3d-Send-buffer-update-subresource-requests-thro.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 6f933585f6c0fb35a9e3ef65645c86f8ecb6f4da Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Tue, 7 Feb 2017 14:01:52 +0100 -Subject: wined3d: Send buffer update subresource requests through CS. - ---- - dlls/wined3d/cs.c | 11 +++++++++++ - dlls/wined3d/device.c | 7 +------ - 2 files changed, 12 insertions(+), 6 deletions(-) - -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 5b529d000f4..7e032d8ec05 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -2012,6 +2012,17 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi - struct wined3d_texture *texture; - unsigned int width, height, depth, level; - -+ if (op->resource->type == WINED3D_RTYPE_BUFFER) -+ { -+ struct wined3d_buffer *buffer = buffer_from_resource(op->resource); -+ HRESULT hr; -+ -+ if (FAILED(hr = wined3d_buffer_upload_data(buffer, op->box, op->data))) -+ WARN("Failed to update buffer data, hr %#x.\n", hr); -+ -+ return; -+ } -+ - texture = wined3d_texture_from_resource(op->resource); - - level = op->sub_resource_idx % texture->level_count; -diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index bd3a132c496..bf647d5241c 100644 ---- a/dlls/wined3d/device.c -+++ b/dlls/wined3d/device.c -@@ -4178,18 +4178,13 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str - - if (resource->type == WINED3D_RTYPE_BUFFER) - { -- struct wined3d_buffer *buffer = buffer_from_resource(resource); -- HRESULT hr; -- - if (sub_resource_idx > 0) - { - WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx); - return; - } - -- if (FAILED(hr = wined3d_buffer_upload_data(buffer, box, data))) -- WARN("Failed to update buffer data, hr %#x.\n", hr); -- -+ wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch); - return; - } - --- -2.11.0 - diff --git a/patches/wined3d-CSMT_Main/0026-wined3d-Map-vertex-buffers-through-cs.patch b/patches/wined3d-CSMT_Main/0026-wined3d-Map-vertex-buffers-through-cs.patch deleted file mode 100644 index 6a6cf98d..00000000 --- a/patches/wined3d-CSMT_Main/0026-wined3d-Map-vertex-buffers-through-cs.patch +++ /dev/null @@ -1,206 +0,0 @@ -From 24eb775d29ee3563667d35b3319dddcb7830eddf Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Tue, 7 Feb 2017 22:37:58 +0100 -Subject: wined3d: Map vertex buffers through cs. - ---- - dlls/wined3d/cs.c | 71 ++++++++++++++++++++++++++++++++++++++++++ - dlls/wined3d/device.c | 45 +------------------------- - dlls/wined3d/wined3d_private.h | 2 ++ - 3 files changed, 74 insertions(+), 44 deletions(-) - -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 54b81f74f64..b5c7432fec3 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -78,6 +78,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_UPDATE_SWAP_INTERVAL, - WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION, - WINED3D_CS_OP_BUFFER_COPY, -+ WINED3D_CS_OP_MAP_VERTEX_BUFFERS, - }; - - struct wined3d_cs_sync -@@ -468,6 +469,13 @@ struct wined3d_cs_buffer_copy - unsigned int size; - }; - -+struct wined3d_cs_map_vertex_buffers -+{ -+ enum wined3d_cs_op opcode; -+ UINT src_start_idx; -+ struct wined3d_stream_info *stream_info; -+}; -+ - static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data) - { - } -@@ -2243,6 +2251,68 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d - cs->ops->submit(cs); - } - -+static void wined3d_cs_exec_map_vertex_buffers(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_map_vertex_buffers *op = data; -+ struct wined3d_state *state = &cs->device->state; -+ const struct wined3d_gl_info *gl_info; -+ struct wined3d_context *context; -+ struct wined3d_shader *vs; -+ unsigned int i; -+ WORD map; -+ -+ /* Need any context to write to the vbo. */ -+ context = context_acquire(cs->device, NULL, 0); -+ gl_info = context->gl_info; -+ -+ vs = state->shader[WINED3D_SHADER_TYPE_VERTEX]; -+ state->shader[WINED3D_SHADER_TYPE_VERTEX] = NULL; -+ context_stream_info_from_declaration(context, state, op->stream_info); -+ state->shader[WINED3D_SHADER_TYPE_VERTEX] = vs; -+ -+ /* We can't convert FROM a VBO, and vertex buffers used to source into -+ * process_vertices() are unlikely to ever be used for drawing. Release -+ * VBOs in those buffers and fix up the stream_info structure. -+ * -+ * Also apply the start index. */ -+ for (i = 0, map = op->stream_info->use_map; map; map >>= 1, ++i) -+ { -+ struct wined3d_stream_info_element *e; -+ struct wined3d_buffer *buffer; -+ -+ if (!(map & 1)) -+ continue; -+ -+ e = &op->stream_info->elements[i]; -+ buffer = state->streams[e->stream_idx].buffer; -+ e->data.buffer_object = 0; -+ e->data.addr += (ULONG_PTR)wined3d_buffer_load_sysmem(buffer, context); -+ if (buffer->buffer_object) -+ { -+ GL_EXTCALL(glDeleteBuffers(1, &buffer->buffer_object)); -+ buffer->buffer_object = 0; -+ wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_BUFFER); -+ } -+ if (e->data.addr) -+ e->data.addr += e->stride * op->src_start_idx; -+ } -+ -+ context_release(context); -+} -+ -+void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_idx, -+ struct wined3d_stream_info *stream_info) -+{ -+ struct wined3d_cs_map_vertex_buffers *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_MAP_VERTEX_BUFFERS; -+ op->src_start_idx = src_start_idx; -+ op->stream_info = stream_info; -+ -+ cs->ops->submit_and_wait(cs); -+} -+ - static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = - { - /* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync, -@@ -2297,6 +2367,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_UPDATE_SWAP_INTERVAL */ wined3d_cs_exec_update_swap_interval, - /* WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION */ wined3d_cs_exec_texture_add_dirty_region, - /* WINED3D_CS_OP_BUFFER_COPY */ wined3d_cs_exec_buffer_copy, -+ /* WINED3D_CS_OP_MAP_VERTEX_BUFFERS */ wined3d_cs_exec_map_vertex_buffers, - }; - - static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) -diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 32d25cd1d0f..cd0ffbe32f7 100644 ---- a/dlls/wined3d/device.c -+++ b/dlls/wined3d/device.c -@@ -2811,7 +2811,6 @@ void CDECL wined3d_device_set_unordered_access_view(struct wined3d_device *devic - wined3d_device_set_pipeline_unordered_access_view(device, WINED3D_PIPELINE_GRAPHICS, idx, uav); - } - --/* Context activation is done by the caller. */ - #define copy_and_next(dest, src, size) memcpy(dest, src, size); dest += (size) - static HRESULT process_vertices_strided(const struct wined3d_device *device, DWORD dwDestIndex, DWORD dwCount, - const struct wined3d_stream_info *stream_info, struct wined3d_buffer *dest, DWORD flags, -@@ -3087,14 +3086,8 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, - UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer, - const struct wined3d_vertex_declaration *declaration, DWORD flags, DWORD dst_fvf) - { -- struct wined3d_state *state = &device->state; - struct wined3d_stream_info stream_info; -- const struct wined3d_gl_info *gl_info; -- struct wined3d_context *context; -- struct wined3d_shader *vs; -- unsigned int i; - HRESULT hr; -- WORD map; - - TRACE("device %p, src_start_idx %u, dst_idx %u, vertex_count %u, " - "dst_buffer %p, declaration %p, flags %#x, dst_fvf %#x.\n", -@@ -3104,47 +3097,11 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, - if (declaration) - FIXME("Output vertex declaration not implemented yet.\n"); - -- /* Need any context to write to the vbo. */ -- context = context_acquire(device, NULL, 0); -- gl_info = context->gl_info; -- -- vs = state->shader[WINED3D_SHADER_TYPE_VERTEX]; -- state->shader[WINED3D_SHADER_TYPE_VERTEX] = NULL; -- context_stream_info_from_declaration(context, state, &stream_info); -- state->shader[WINED3D_SHADER_TYPE_VERTEX] = vs; -- -- /* We can't convert FROM a VBO, and vertex buffers used to source into -- * process_vertices() are unlikely to ever be used for drawing. Release -- * VBOs in those buffers and fix up the stream_info structure. -- * -- * Also apply the start index. */ -- for (i = 0, map = stream_info.use_map; map; map >>= 1, ++i) -- { -- struct wined3d_stream_info_element *e; -- struct wined3d_buffer *buffer; -- -- if (!(map & 1)) -- continue; -- -- e = &stream_info.elements[i]; -- buffer = state->streams[e->stream_idx].buffer; -- e->data.buffer_object = 0; -- e->data.addr += (ULONG_PTR)wined3d_buffer_load_sysmem(buffer, context); -- if (buffer->buffer_object) -- { -- GL_EXTCALL(glDeleteBuffers(1, &buffer->buffer_object)); -- buffer->buffer_object = 0; -- wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_BUFFER); -- } -- if (e->data.addr) -- e->data.addr += e->stride * src_start_idx; -- } -+ wined3d_cs_emit_map_vertex_buffers(device->cs, src_start_idx, &stream_info); - - hr = process_vertices_strided(device, dst_idx, vertex_count, - &stream_info, dst_buffer, flags, dst_fvf); - -- context_release(context); -- - return hr; - } - -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 9fa4d00c24f..38693a52b29 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -3328,6 +3328,8 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, - struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags) DECLSPEC_HIDDEN; - HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource, - unsigned int sub_resource_idx) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_idx, -+ struct wined3d_stream_info *stream_info) DECLSPEC_HIDDEN; - - /* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other - * fixed function semantics as D3DCOLOR or FLOAT16 */ --- -2.11.0 - diff --git a/patches/wined3d-CSMT_Main/0029-wined3d-Hackily-introduce-a-multithreaded-command-st.patch b/patches/wined3d-CSMT_Main/0029-wined3d-Hackily-introduce-a-multithreaded-command-st.patch index f9c4f94d..0751aa7e 100644 --- a/patches/wined3d-CSMT_Main/0029-wined3d-Hackily-introduce-a-multithreaded-command-st.patch +++ b/patches/wined3d-CSMT_Main/0029-wined3d-Hackily-introduce-a-multithreaded-command-st.patch @@ -1,21 +1,21 @@ -From aaef68da7d9a0734e4827036aa561b0e67c70606 Mon Sep 17 00:00:00 2001 +From 47ebfc4321e0e43a4e182c7b53451e9d474678e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 1 Oct 2013 14:31:56 +0200 Subject: wined3d: Hackily introduce a multithreaded command stream --- dlls/wined3d/context.c | 3 + - dlls/wined3d/cs.c | 443 ++++++++++++++++++++++++++++++++++++----- + dlls/wined3d/cs.c | 436 ++++++++++++++++++++++++++++++++++++----- dlls/wined3d/device.c | 2 +- dlls/wined3d/wined3d_main.c | 10 + - dlls/wined3d/wined3d_private.h | 33 ++- - 5 files changed, 430 insertions(+), 61 deletions(-) + dlls/wined3d/wined3d_private.h | 33 +++- + 5 files changed, 425 insertions(+), 59 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c -index 9e0805e822d..226d655b83a 100644 +index 1e995707608..9358d601bfb 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -3722,6 +3722,9 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, +@@ -3721,6 +3721,9 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, TRACE("device %p, texture %p, sub_resource_idx %u.\n", device, texture, sub_resource_idx); @@ -26,7 +26,7 @@ index 9e0805e822d..226d655b83a 100644 current_context = NULL; diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 93a80f2887e..35f6a5889fb 100644 +index 5b5073f18e5..27737527deb 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -18,6 +18,7 @@ @@ -37,16 +37,16 @@ index 93a80f2887e..35f6a5889fb 100644 #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d); -@@ -77,6 +78,7 @@ enum wined3d_cs_op +@@ -76,6 +77,7 @@ enum wined3d_cs_op + WINED3D_CS_OP_UPDATE_SWAP_INTERVAL, WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION, WINED3D_CS_OP_BUFFER_COPY, - WINED3D_CS_OP_MAP_VERTEX_BUFFERS, + WINED3D_CS_OP_STOP, }; struct wined3d_cs_sync -@@ -462,8 +464,14 @@ struct wined3d_cs_map_vertex_buffers - struct wined3d_stream_info *stream_info; +@@ -454,8 +456,14 @@ struct wined3d_cs_buffer_copy + unsigned int size; }; -static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data) @@ -61,7 +61,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_sync(struct wined3d_cs *cs) -@@ -476,12 +484,14 @@ void wined3d_cs_emit_sync(struct wined3d_cs *cs) +@@ -468,12 +476,14 @@ void wined3d_cs_emit_sync(struct wined3d_cs *cs) cs->ops->submit_and_wait(cs); } @@ -77,7 +77,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) -@@ -494,7 +504,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) +@@ -486,7 +496,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) cs->ops->submit_and_wait(cs); } @@ -86,7 +86,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_present *op = data; struct wined3d_swapchain *swapchain; -@@ -512,6 +522,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +@@ -504,6 +514,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) { wined3d_resource_release(&swapchain->back_buffers[i]->resource); } @@ -95,7 +95,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, -@@ -551,13 +563,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -543,13 +555,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw pending = InterlockedCompareExchange(&cs->pending_presents, 0, 0); } @@ -111,7 +111,7 @@ index 93a80f2887e..35f6a5889fb 100644 device = cs->device; wined3d_get_draw_rect(state, &draw_rect); -@@ -575,6 +588,8 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +@@ -567,6 +580,8 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) } if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) wined3d_resource_release(state->fb->depth_stencil->resource); @@ -120,7 +120,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, -@@ -713,7 +728,7 @@ static void release_unordered_access_resources(const struct wined3d_shader *shad +@@ -705,7 +720,7 @@ static void release_unordered_access_resources(const struct wined3d_shader *shad } } @@ -129,7 +129,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_dispatch *op = data; struct wined3d_state *state = &cs->state; -@@ -724,6 +739,8 @@ static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data) +@@ -716,6 +731,8 @@ static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data) release_shader_resources(state, 1u << WINED3D_SHADER_TYPE_COMPUTE); release_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_COMPUTE], state->unordered_access_view[WINED3D_PIPELINE_COMPUTE]); @@ -138,7 +138,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, -@@ -745,7 +762,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, +@@ -737,7 +754,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, cs->ops->submit(cs); } @@ -147,7 +147,7 @@ index 93a80f2887e..35f6a5889fb 100644 { struct wined3d_state *state = &cs->state; const struct wined3d_cs_draw *op = data; -@@ -790,6 +807,8 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -782,6 +799,8 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) release_shader_resources(state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE)); release_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_PIXEL], state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]); @@ -156,7 +156,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx, unsigned int start_idx, -@@ -835,12 +854,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base +@@ -827,12 +846,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base cs->ops->submit(cs); } @@ -172,7 +172,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value) -@@ -855,12 +876,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query +@@ -847,12 +868,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query cs->ops->submit(cs); } @@ -188,7 +188,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) -@@ -874,12 +897,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -866,12 +889,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi cs->ops->submit(cs); } @@ -204,7 +204,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) -@@ -893,12 +918,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -885,12 +910,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) cs->ops->submit(cs); } @@ -220,7 +220,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, -@@ -914,7 +941,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -906,7 +933,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v cs->ops->submit(cs); } @@ -229,7 +229,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_set_depth_stencil_view *op = data; struct wined3d_device *device = cs->device; -@@ -949,6 +976,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -941,6 +968,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } device_invalidate_state(device, STATE_FRAMEBUFFER); @@ -238,7 +238,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) -@@ -962,12 +991,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -954,12 +983,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 cs->ops->submit(cs); } @@ -254,7 +254,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) -@@ -981,7 +1012,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -973,7 +1004,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 cs->ops->submit(cs); } @@ -263,7 +263,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_set_stream_source *op = data; struct wined3d_stream_state *stream; -@@ -999,6 +1030,8 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void +@@ -991,6 +1022,8 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -272,7 +272,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, -@@ -1016,7 +1049,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -1008,7 +1041,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, cs->ops->submit(cs); } @@ -281,7 +281,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_set_stream_source_freq *op = data; struct wined3d_stream_state *stream; -@@ -1026,6 +1059,8 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const +@@ -1018,6 +1051,8 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const stream->flags = op->flags; device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -290,7 +290,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags) -@@ -1041,7 +1076,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i +@@ -1033,7 +1068,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i cs->ops->submit(cs); } @@ -299,7 +299,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_set_stream_output *op = data; struct wined3d_stream_output *stream; -@@ -1056,6 +1091,8 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void +@@ -1048,6 +1083,8 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void InterlockedIncrement(&op->buffer->resource.bind_count); if (prev) InterlockedDecrement(&prev->resource.bind_count); @@ -308,7 +308,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, -@@ -1072,7 +1109,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -1064,7 +1101,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, cs->ops->submit(cs); } @@ -317,7 +317,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_set_index_buffer *op = data; struct wined3d_buffer *prev; -@@ -1088,6 +1125,8 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * +@@ -1080,6 +1117,8 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_INDEXBUFFER); @@ -326,7 +326,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -@@ -1104,7 +1143,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -1096,7 +1135,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff cs->ops->submit(cs); } @@ -335,7 +335,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_set_constant_buffer *op = data; struct wined3d_buffer *prev; -@@ -1118,6 +1157,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi +@@ -1110,6 +1149,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); @@ -343,7 +343,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1134,7 +1174,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -1126,7 +1166,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha cs->ops->submit(cs); } @@ -352,7 +352,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; -@@ -1211,6 +1251,8 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) +@@ -1203,6 +1243,8 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) if (new_use_color_key) device_invalidate_state(cs->device, STATE_COLOR_KEY); @@ -361,7 +361,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) -@@ -1225,7 +1267,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -1217,7 +1259,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined cs->ops->submit(cs); } @@ -370,7 +370,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_set_shader_resource_view *op = data; struct wined3d_shader_resource_view *prev; -@@ -1242,6 +1284,8 @@ static void wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, cons +@@ -1234,6 +1276,8 @@ static void wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, cons device_invalidate_state(cs->device, STATE_GRAPHICS_SHADER_RESOURCE_BINDING); else device_invalidate_state(cs->device, STATE_COMPUTE_SHADER_RESOURCE_BINDING); @@ -379,7 +379,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1258,7 +1302,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -1250,7 +1294,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 cs->ops->submit(cs); } @@ -388,7 +388,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_set_unordered_access_view *op = data; struct wined3d_unordered_access_view *prev; -@@ -1272,6 +1316,8 @@ static void wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, con +@@ -1264,6 +1308,8 @@ static void wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, con InterlockedDecrement(&prev->resource->bind_count); device_invalidate_state(cs->device, STATE_UNORDERED_ACCESS_VIEW_BINDING(op->pipeline)); @@ -397,7 +397,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined3d_pipeline pipeline, -@@ -1288,7 +1334,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined +@@ -1280,7 +1326,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined cs->ops->submit(cs); } @@ -406,7 +406,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_set_sampler *op = data; -@@ -1297,6 +1343,8 @@ static void wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data) +@@ -1289,6 +1335,8 @@ static void wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data) device_invalidate_state(cs->device, STATE_GRAPHICS_SHADER_RESOURCE_BINDING); else device_invalidate_state(cs->device, STATE_COMPUTE_SHADER_RESOURCE_BINDING); @@ -415,7 +415,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1313,7 +1361,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1305,7 +1353,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type cs->ops->submit(cs); } @@ -424,7 +424,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_set_shader *op = data; -@@ -1323,6 +1371,8 @@ static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) +@@ -1315,6 +1363,8 @@ static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) device_invalidate_state(cs->device, STATE_GRAPHICS_SHADER_RESOURCE_BINDING); else device_invalidate_state(cs->device, STATE_COMPUTE_SHADER_RESOURCE_BINDING); @@ -433,7 +433,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader) -@@ -1337,12 +1387,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1329,12 +1379,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type cs->ops->submit(cs); } @@ -449,7 +449,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, -@@ -1357,12 +1409,14 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -1349,12 +1401,14 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, cs->ops->submit(cs); } @@ -465,7 +465,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value) -@@ -1377,12 +1431,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render +@@ -1369,12 +1423,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render cs->ops->submit(cs); } @@ -481,7 +481,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, -@@ -1399,12 +1455,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1391,12 +1447,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, cs->ops->submit(cs); } @@ -497,7 +497,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -@@ -1421,13 +1479,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1413,13 +1471,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, cs->ops->submit(cs); } @@ -514,7 +514,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, -@@ -1443,12 +1503,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1435,12 +1495,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform cs->ops->submit(cs); } @@ -530,7 +530,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) -@@ -1463,7 +1525,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const +@@ -1455,7 +1517,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const cs->ops->submit(cs); } @@ -539,7 +539,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_set_color_key *op = data; struct wined3d_texture *texture = op->texture; -@@ -1524,6 +1586,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat +@@ -1516,6 +1578,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat break; } } @@ -548,7 +548,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -1546,12 +1610,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1538,12 +1602,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture cs->ops->submit(cs); } @@ -564,7 +564,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) -@@ -1565,7 +1631,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1557,7 +1623,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma cs->ops->submit(cs); } @@ -573,7 +573,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_set_light *op = data; struct wined3d_light_info *light_info; -@@ -1579,7 +1645,7 @@ static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data) +@@ -1571,7 +1637,7 @@ static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data) if (!(light_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*light_info)))) { ERR("Failed to allocate light info.\n"); @@ -582,7 +582,7 @@ index 93a80f2887e..35f6a5889fb 100644 } hash_idx = LIGHTMAP_HASHFUNC(light_idx); -@@ -1600,6 +1666,8 @@ static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data) +@@ -1592,6 +1658,8 @@ static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data) light_info->direction = op->light.direction; light_info->exponent = op->light.exponent; light_info->cutoff = op->light.cutoff; @@ -591,7 +591,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light_info *light) -@@ -1613,7 +1681,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light +@@ -1605,7 +1673,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light cs->ops->submit(cs); } @@ -600,7 +600,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_set_light_enable *op = data; struct wined3d_device *device = cs->device; -@@ -1623,7 +1691,7 @@ static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void * +@@ -1615,7 +1683,7 @@ static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void * if (!(light_info = wined3d_state_get_light(&cs->state, op->idx))) { ERR("Light doesn't exist.\n"); @@ -609,7 +609,7 @@ index 93a80f2887e..35f6a5889fb 100644 } prev_idx = light_info->glIndex; -@@ -1633,6 +1701,8 @@ static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void * +@@ -1625,6 +1693,8 @@ static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void * device_invalidate_state(device, STATE_LIGHT_TYPE); device_invalidate_state(device, STATE_ACTIVELIGHT(op->enable ? light_info->glIndex : prev_idx)); } @@ -618,7 +618,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, BOOL enable) -@@ -1647,7 +1717,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, B +@@ -1639,7 +1709,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, B cs->ops->submit(cs); } @@ -627,7 +627,7 @@ index 93a80f2887e..35f6a5889fb 100644 { struct wined3d_adapter *adapter = cs->device->adapter; -@@ -1655,6 +1725,8 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) +@@ -1647,6 +1717,8 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) memset(&cs->state, 0, sizeof(cs->state)); state_init(&cs->state, &cs->fb, &adapter->gl_info, &adapter->d3d_info, WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT); @@ -636,7 +636,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -@@ -1667,11 +1739,13 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1659,11 +1731,13 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) cs->ops->submit(cs); } @@ -651,7 +651,7 @@ index 93a80f2887e..35f6a5889fb 100644 } static void wined3d_cs_emit_callback(struct wined3d_cs *cs, void (*callback)(void *object), void *object) -@@ -1696,12 +1770,14 @@ void wined3d_cs_init_object(struct wined3d_cs *cs, void (*callback)(void *object +@@ -1688,12 +1762,14 @@ void wined3d_cs_init_object(struct wined3d_cs *cs, void (*callback)(void *object wined3d_cs_emit_callback(cs, callback, object); } @@ -667,7 +667,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) -@@ -1716,12 +1792,14 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu +@@ -1708,12 +1784,14 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu cs->ops->submit(cs); } @@ -683,7 +683,7 @@ index 93a80f2887e..35f6a5889fb 100644 } BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) -@@ -1740,13 +1818,15 @@ BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *que +@@ -1732,13 +1810,15 @@ BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *que return ret; } @@ -700,7 +700,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) -@@ -1762,13 +1842,15 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso +@@ -1754,13 +1834,15 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso cs->ops->submit(cs); } @@ -717,7 +717,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) -@@ -1784,13 +1866,15 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou +@@ -1776,13 +1858,15 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou cs->ops->submit(cs); } @@ -734,7 +734,7 @@ index 93a80f2887e..35f6a5889fb 100644 } HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx, -@@ -1813,12 +1897,14 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, +@@ -1805,12 +1889,14 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, return hr; } @@ -750,7 +750,24 @@ index 93a80f2887e..35f6a5889fb 100644 } HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx) -@@ -1859,10 +1945,11 @@ push_constant_info[] = +@@ -1829,7 +1915,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc + return hr; + } + +-static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data) ++static UINT wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data) + { + const struct wined3d_cs_update_sub_resource *op = data; + const struct wined3d_box *box = &op->box; +@@ -1879,6 +1965,7 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi + + done: + wined3d_resource_release(op->resource); ++ return sizeof(*op); + } + + void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, +@@ -1923,10 +2010,11 @@ push_constant_info[] = {FIELD_OFFSET(struct wined3d_state, ps_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_PS_B}, }; @@ -763,7 +780,7 @@ index 93a80f2887e..35f6a5889fb 100644 unsigned int context_count; unsigned int i; size_t offset; -@@ -1878,6 +1965,8 @@ static void wined3d_cs_exec_push_constants(struct wined3d_cs *cs, const void *da +@@ -1942,6 +2030,8 @@ static void wined3d_cs_exec_push_constants(struct wined3d_cs *cs, const void *da { device->contexts[i]->constant_update_mask |= push_constant_info[op->p].mask; } @@ -772,7 +789,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p, -@@ -1895,7 +1984,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con +@@ -1959,7 +2049,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con cs->ops->submit(cs); } @@ -781,7 +798,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_blt *op = data; -@@ -1906,6 +1995,8 @@ static void wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data) +@@ -1970,6 +2060,8 @@ static void wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data) wined3d_resource_release(&op->dst_surface->container->resource); if (op->src_surface && op->src_surface != op->dst_surface) wined3d_resource_release(&op->src_surface->container->resource); @@ -790,7 +807,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surface, -@@ -1933,7 +2024,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf +@@ -1997,7 +2089,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf cs->ops->submit(cs); } @@ -799,7 +816,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_clear_rtv *op = data; struct wined3d_device *device = cs->device; -@@ -1944,6 +2035,8 @@ static void wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data) +@@ -2008,6 +2100,8 @@ static void wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data) op->blitter->depth_fill(device, op->view, &op->rect, op->flags, op->depth, op->stencil); wined3d_resource_release(op->view->resource); @@ -808,7 +825,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view, -@@ -1968,7 +2061,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge +@@ -2032,7 +2126,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge cs->ops->submit(cs); } @@ -817,7 +834,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_update_texture *op = data; struct wined3d_context *context; -@@ -1979,6 +2072,8 @@ static void wined3d_cs_exec_update_texture(struct wined3d_cs *cs, const void *da +@@ -2043,6 +2137,8 @@ static void wined3d_cs_exec_update_texture(struct wined3d_cs *cs, const void *da wined3d_resource_release(&op->src->resource); wined3d_resource_release(&op->dst->resource); @@ -826,37 +843,10 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_texture *src, -@@ -1997,7 +2092,7 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur +@@ -2061,11 +2157,13 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur cs->ops->submit(cs); } --static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data) -+static UINT wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data) - { - const struct wined3d_cs_update_sub_resource *op = data; - struct wined3d_const_bo_address addr; -@@ -2013,7 +2108,7 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi - if (FAILED(hr = wined3d_buffer_upload_data(buffer, op->box, op->data))) - WARN("Failed to update buffer data, hr %#x.\n", hr); - -- return; -+ return sizeof(*op); - } - - texture = wined3d_texture_from_resource(op->resource); -@@ -2042,6 +2137,8 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi - - wined3d_texture_validate_location(texture, op->sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); - wined3d_texture_invalidate_location(texture, op->sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB); -+ -+ return sizeof(*op); - } - - void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, -@@ -2064,11 +2161,13 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r - cs->ops->submit_and_wait(cs); - } - -static void wined3d_cs_exec_get_dc(struct wined3d_cs *cs, const void *data) +static UINT wined3d_cs_exec_get_dc(struct wined3d_cs *cs, const void *data) { @@ -868,7 +858,7 @@ index 93a80f2887e..35f6a5889fb 100644 } HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -2088,11 +2187,13 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te +@@ -2085,11 +2183,13 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te return hr; } @@ -883,7 +873,7 @@ index 93a80f2887e..35f6a5889fb 100644 } HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -2112,11 +2213,13 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture +@@ -2109,11 +2209,13 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture return hr; } @@ -898,7 +888,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) -@@ -2130,7 +2233,7 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_ +@@ -2127,7 +2229,7 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_ cs->ops->submit_and_wait(cs); } @@ -907,7 +897,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_texture_add_dirty_region *op = data; struct wined3d_texture *texture = op->texture; -@@ -2148,6 +2251,8 @@ static void wined3d_cs_exec_texture_add_dirty_region(struct wined3d_cs *cs, cons +@@ -2145,6 +2247,8 @@ static void wined3d_cs_exec_texture_add_dirty_region(struct wined3d_cs *cs, cons context_release(context); wined3d_resource_release(&texture->resource); @@ -916,7 +906,7 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs, -@@ -2169,7 +2274,7 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs, +@@ -2166,7 +2270,7 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs, cs->ops->submit(cs); } @@ -925,7 +915,7 @@ index 93a80f2887e..35f6a5889fb 100644 { const struct wined3d_cs_buffer_copy *op = data; HRESULT hr; -@@ -2179,6 +2284,8 @@ static void wined3d_cs_exec_buffer_copy(struct wined3d_cs *cs, const void *data) +@@ -2176,6 +2280,8 @@ static void wined3d_cs_exec_buffer_copy(struct wined3d_cs *cs, const void *data) wined3d_resource_release(&op->dst_buffer->resource); wined3d_resource_release(&op->src_buffer->resource); @@ -934,34 +924,16 @@ index 93a80f2887e..35f6a5889fb 100644 } void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *dst_buffer, -@@ -2201,7 +2308,7 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d +@@ -2198,7 +2304,7 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d cs->ops->submit(cs); } --static void wined3d_cs_exec_map_vertex_buffers(struct wined3d_cs *cs, const void *data) -+static UINT wined3d_cs_exec_map_vertex_buffers(struct wined3d_cs *cs, const void *data) - { - const struct wined3d_cs_map_vertex_buffers *op = data; - struct wined3d_state *state = &cs->device->state; -@@ -2248,6 +2355,8 @@ static void wined3d_cs_exec_map_vertex_buffers(struct wined3d_cs *cs, const void - } - - context_release(context); -+ -+ return sizeof(*op); - } - - void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_idx, -@@ -2263,7 +2372,7 @@ void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_id - cs->ops->submit_and_wait(cs); - } - -static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = +static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync, /* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish, -@@ -2369,6 +2478,201 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops = +@@ -2303,6 +2409,201 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops = wined3d_cs_st_submit, }; @@ -1163,7 +1135,7 @@ index 93a80f2887e..35f6a5889fb 100644 struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; -@@ -2398,12 +2702,41 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -2332,12 +2633,41 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) return NULL; } @@ -1206,7 +1178,7 @@ index 93a80f2887e..35f6a5889fb 100644 HeapFree(GetProcessHeap(), 0, cs->data); HeapFree(GetProcessHeap(), 0, cs); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 7df7ba41888..2c691796426 100644 +index f359d332aae..c1a5f54f9c1 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1289,7 +1289,7 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device @@ -1249,10 +1221,10 @@ index 1ce5937f173..4ef747ca89a 100644 if (hkey) RegCloseKey( hkey ); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 0c46eba6200..3e14ae56508 100644 +index 3d6aaf923b3..2b64485e82e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -307,6 +307,7 @@ struct wined3d_settings +@@ -391,6 +391,7 @@ struct wined3d_settings unsigned int max_sm_ps; unsigned int max_sm_cs; BOOL no_3d; @@ -1260,7 +1232,7 @@ index 0c46eba6200..3e14ae56508 100644 }; extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN; -@@ -2787,11 +2788,6 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource) +@@ -2792,11 +2793,6 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource) InterlockedDecrement(&resource->access_count); } @@ -1272,7 +1244,7 @@ index 0c46eba6200..3e14ae56508 100644 void resource_cleanup(struct wined3d_resource *resource) DECLSPEC_HIDDEN; HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device, enum wined3d_resource_type type, const struct wined3d_format *format, -@@ -3212,6 +3208,21 @@ enum wined3d_push_constants +@@ -3215,6 +3211,21 @@ enum wined3d_push_constants WINED3D_PUSH_CONSTANTS_PS_B, }; @@ -1294,7 +1266,7 @@ index 0c46eba6200..3e14ae56508 100644 struct wined3d_cs_ops { void *(*require_space)(struct wined3d_cs *cs, size_t size); -@@ -3229,9 +3240,21 @@ struct wined3d_cs +@@ -3232,9 +3243,21 @@ struct wined3d_cs size_t data_size, start, end; void *data; diff --git a/patches/wined3d-CSMT_Main/0031-wined3d-Introduce-a-separate-priority-queue.patch b/patches/wined3d-CSMT_Main/0031-wined3d-Introduce-a-separate-priority-queue.patch index eb7ec5ef..2372701a 100644 --- a/patches/wined3d-CSMT_Main/0031-wined3d-Introduce-a-separate-priority-queue.patch +++ b/patches/wined3d-CSMT_Main/0031-wined3d-Introduce-a-separate-priority-queue.patch @@ -1,18 +1,18 @@ -From ec468210c7846be779fe5e81d6340a2862870574 Mon Sep 17 00:00:00 2001 +From 6d4b64128fef7fd8d9e186eaf18b45d0108a6780 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 8 Feb 2017 00:12:31 +0100 Subject: wined3d: Introduce a separate priority queue. --- - dlls/wined3d/cs.c | 129 ++++++++++++++++++++++------------------- + dlls/wined3d/cs.c | 127 ++++++++++++++++++++++------------------- dlls/wined3d/wined3d_private.h | 4 +- - 2 files changed, 72 insertions(+), 61 deletions(-) + 2 files changed, 71 insertions(+), 60 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 53a09a8cf8c..7b5c99b9e21 100644 +index c6c6b49f5fc..271b38de6c4 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -478,7 +478,7 @@ void wined3d_cs_emit_sync(struct wined3d_cs *cs) +@@ -470,7 +470,7 @@ void wined3d_cs_emit_sync(struct wined3d_cs *cs) { struct wined3d_cs_sync *op; @@ -21,7 +21,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SYNC; cs->ops->submit_and_wait(cs); -@@ -498,7 +498,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) +@@ -490,7 +490,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) { struct wined3d_cs_glfinish *op; @@ -30,7 +30,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_GLFINISH; cs->ops->submit_and_wait(cs); -@@ -533,7 +533,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -525,7 +525,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw unsigned int i; LONG pending; @@ -39,7 +39,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_PRESENT; op->dst_window_override = dst_window_override; op->swapchain = swapchain; -@@ -599,7 +599,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -591,7 +591,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * struct wined3d_cs_clear *op; unsigned int i; @@ -48,7 +48,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_CLEAR; op->flags = flags; op->color = *color; -@@ -749,7 +749,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, +@@ -741,7 +741,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, const struct wined3d_state *state = &cs->device->state; struct wined3d_cs_dispatch *op; @@ -57,7 +57,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_DISPATCH; op->group_count_x = group_count_x; op->group_count_y = group_count_y; -@@ -818,7 +818,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base +@@ -810,7 +810,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base struct wined3d_cs_draw *op; unsigned int i; @@ -66,7 +66,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_DRAW; op->primitive_type = primitive_type; op->base_vertex_idx = base_vertex_idx; -@@ -868,7 +868,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query +@@ -860,7 +860,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query { struct wined3d_cs_set_predication *op; @@ -75,7 +75,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_PREDICATION; op->predicate = predicate; op->value = value; -@@ -890,7 +890,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi +@@ -882,7 +882,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi { struct wined3d_cs_set_viewport *op; @@ -84,7 +84,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_VIEWPORT; op->viewport = *viewport; -@@ -911,7 +911,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) +@@ -903,7 +903,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) { struct wined3d_cs_set_scissor_rect *op; @@ -93,7 +93,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT; op->rect = *rect; -@@ -933,7 +933,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -925,7 +925,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v { struct wined3d_cs_set_rendertarget_view *op; @@ -102,7 +102,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_RENDERTARGET_VIEW; op->view_idx = view_idx; op->view = view; -@@ -984,7 +984,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 +@@ -976,7 +976,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3 { struct wined3d_cs_set_depth_stencil_view *op; @@ -111,7 +111,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; op->view = view; -@@ -1005,7 +1005,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 +@@ -997,7 +997,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3 { struct wined3d_cs_set_vertex_declaration *op; @@ -120,7 +120,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; op->declaration = declaration; -@@ -1039,7 +1039,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -1031,7 +1031,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, { struct wined3d_cs_set_stream_source *op; @@ -129,7 +129,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE; op->stream_idx = stream_idx; op->buffer = buffer; -@@ -1067,7 +1067,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i +@@ -1059,7 +1059,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i { struct wined3d_cs_set_stream_source_freq *op; @@ -138,7 +138,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ; op->stream_idx = stream_idx; op->frequency = frequency; -@@ -1100,7 +1100,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -1092,7 +1092,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, { struct wined3d_cs_set_stream_output *op; @@ -147,7 +147,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_STREAM_OUTPUT; op->stream_idx = stream_idx; op->buffer = buffer; -@@ -1134,7 +1134,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -1126,7 +1126,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff { struct wined3d_cs_set_index_buffer *op; @@ -156,7 +156,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_INDEX_BUFFER; op->buffer = buffer; op->format_id = format_id; -@@ -1165,7 +1165,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -1157,7 +1157,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha { struct wined3d_cs_set_constant_buffer *op; @@ -165,7 +165,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_CONSTANT_BUFFER; op->type = type; op->cb_idx = cb_idx; -@@ -1259,7 +1259,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined +@@ -1251,7 +1251,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined { struct wined3d_cs_set_texture *op; @@ -174,7 +174,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_TEXTURE; op->stage = stage; op->texture = texture; -@@ -1293,7 +1293,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -1285,7 +1285,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 { struct wined3d_cs_set_shader_resource_view *op; @@ -183,7 +183,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEW; op->type = type; op->view_idx = view_idx; -@@ -1325,7 +1325,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined +@@ -1317,7 +1317,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined { struct wined3d_cs_set_unordered_access_view *op; @@ -192,7 +192,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_UNORDERED_ACCESS_VIEW; op->pipeline = pipeline; op->view_idx = view_idx; -@@ -1352,7 +1352,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1344,7 +1344,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type { struct wined3d_cs_set_sampler *op; @@ -201,7 +201,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_SAMPLER; op->type = type; op->sampler_idx = sampler_idx; -@@ -1379,7 +1379,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1371,7 +1371,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type { struct wined3d_cs_set_shader *op; @@ -210,7 +210,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_SHADER; op->type = type; op->shader = shader; -@@ -1402,7 +1402,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -1394,7 +1394,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, { struct wined3d_cs_set_rasterizer_state *op; @@ -219,7 +219,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE; op->state = rasterizer_state; -@@ -1423,7 +1423,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render +@@ -1415,7 +1415,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render { struct wined3d_cs_set_render_state *op; @@ -228,7 +228,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_RENDER_STATE; op->state = state; op->value = value; -@@ -1446,7 +1446,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1438,7 +1438,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, { struct wined3d_cs_set_texture_state *op; @@ -237,7 +237,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_TEXTURE_STATE; op->stage = stage; op->state = state; -@@ -1470,7 +1470,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1462,7 +1462,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, { struct wined3d_cs_set_sampler_state *op; @@ -246,7 +246,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_SAMPLER_STATE; op->sampler_idx = sampler_idx; op->state = state; -@@ -1495,7 +1495,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1487,7 +1487,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform { struct wined3d_cs_set_transform *op; @@ -255,7 +255,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_TRANSFORM; op->state = state; op->matrix = *matrix; -@@ -1517,7 +1517,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const +@@ -1509,7 +1509,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const { struct wined3d_cs_set_clip_plane *op; @@ -264,7 +264,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_CLIP_PLANE; op->plane_idx = plane_idx; op->plane = *plane; -@@ -1595,7 +1595,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1587,7 +1587,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture { struct wined3d_cs_set_color_key *op; @@ -273,7 +273,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_COLOR_KEY; op->texture = texture; op->flags = flags; -@@ -1624,7 +1624,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma +@@ -1616,7 +1616,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma { struct wined3d_cs_set_material *op; @@ -282,7 +282,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_MATERIAL; op->material = *material; -@@ -1674,7 +1674,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light +@@ -1666,7 +1666,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light { struct wined3d_cs_set_light *op; @@ -291,7 +291,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_LIGHT; op->light = *light; -@@ -1709,7 +1709,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, B +@@ -1701,7 +1701,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, B { struct wined3d_cs_set_light_enable *op; @@ -300,7 +300,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_SET_LIGHT_ENABLE; op->idx = idx; op->enable = enable; -@@ -1733,7 +1733,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1725,7 +1725,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) { struct wined3d_cs_reset_state *op; @@ -309,7 +309,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_RESET_STATE; cs->ops->submit(cs); -@@ -1752,7 +1752,7 @@ static void wined3d_cs_emit_callback(struct wined3d_cs *cs, void (*callback)(voi +@@ -1744,7 +1744,7 @@ static void wined3d_cs_emit_callback(struct wined3d_cs *cs, void (*callback)(voi { struct wined3d_cs_callback *op; @@ -318,7 +318,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_CALLBACK; op->callback = callback; op->object = object; -@@ -1784,7 +1784,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu +@@ -1776,7 +1776,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu { struct wined3d_cs_query_issue *op; @@ -327,7 +327,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_QUERY_ISSUE; op->query = query; op->flags = flags; -@@ -1807,7 +1807,7 @@ BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *que +@@ -1799,7 +1799,7 @@ BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *que struct wined3d_cs_query_poll *op; BOOL ret; @@ -336,7 +336,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_QUERY_POLL; op->query = query; op->flags = flags; -@@ -1833,7 +1833,7 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso +@@ -1825,7 +1825,7 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso { struct wined3d_cs_preload_resource *op; @@ -345,7 +345,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_PRELOAD_RESOURCE; op->resource = resource; -@@ -1857,7 +1857,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou +@@ -1849,7 +1849,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou { struct wined3d_cs_unload_resource *op; @@ -354,7 +354,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_UNLOAD_RESOURCE; op->resource = resource; -@@ -1883,7 +1883,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, +@@ -1875,7 +1875,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, struct wined3d_cs_map *op; HRESULT hr; @@ -363,7 +363,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_MAP; op->resource = resource; op->sub_resource_idx = sub_resource_idx; -@@ -1912,7 +1912,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc +@@ -1904,7 +1904,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc struct wined3d_cs_unmap *op; HRESULT hr; @@ -372,43 +372,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_UNMAP; op->resource = resource; op->sub_resource_idx = sub_resource_idx; -@@ -1974,7 +1974,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con - { - struct wined3d_cs_push_constants *op; - -- op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_push_constants, constants[count * push_constant_info[p].size])); -+ op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_push_constants, constants[count * push_constant_info[p].size]), 0); - op->opcode = WINED3D_CS_OP_PUSH_CONSTANTS; - op->p = p; - op->start_idx = start_idx; -@@ -2006,7 +2006,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf - { - struct wined3d_cs_blt *op; - -- op = cs->ops->require_space(cs, sizeof(*op)); -+ op = cs->ops->require_space(cs, sizeof(*op), 0); - op->opcode = WINED3D_CS_OP_BLT; - op->dst_surface = dst_surface; - op->dst_rect = *dst_rect; -@@ -2045,7 +2045,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge - { - struct wined3d_cs_clear_rtv *op; - -- op = cs->ops->require_space(cs, sizeof(*op)); -+ op = cs->ops->require_space(cs, sizeof(*op), 0); - op->opcode = WINED3D_CS_OP_CLEAR_RTV; - op->view = view; - op->rect = *rect; -@@ -2081,7 +2081,7 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur - { - struct wined3d_cs_update_texture *op; - -- op = cs->ops->require_space(cs, sizeof(*op)); -+ op = cs->ops->require_space(cs, sizeof(*op), 0); - op->opcode = WINED3D_CS_OP_UPDATE_TEXTURE; - op->src = src; - op->dst = dst; -@@ -2147,7 +2147,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r +@@ -1974,7 +1974,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r { struct wined3d_cs_update_sub_resource *op; @@ -417,7 +381,43 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; op->resource = resource; op->sub_resource_idx = sub_resource_idx; -@@ -2176,7 +2176,7 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te +@@ -2039,7 +2039,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con + { + struct wined3d_cs_push_constants *op; + +- op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_push_constants, constants[count * push_constant_info[p].size])); ++ op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_push_constants, constants[count * push_constant_info[p].size]), 0); + op->opcode = WINED3D_CS_OP_PUSH_CONSTANTS; + op->p = p; + op->start_idx = start_idx; +@@ -2071,7 +2071,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf + { + struct wined3d_cs_blt *op; + +- op = cs->ops->require_space(cs, sizeof(*op)); ++ op = cs->ops->require_space(cs, sizeof(*op), 0); + op->opcode = WINED3D_CS_OP_BLT; + op->dst_surface = dst_surface; + op->dst_rect = *dst_rect; +@@ -2110,7 +2110,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge + { + struct wined3d_cs_clear_rtv *op; + +- op = cs->ops->require_space(cs, sizeof(*op)); ++ op = cs->ops->require_space(cs, sizeof(*op), 0); + op->opcode = WINED3D_CS_OP_CLEAR_RTV; + op->view = view; + op->rect = *rect; +@@ -2146,7 +2146,7 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur + { + struct wined3d_cs_update_texture *op; + +- op = cs->ops->require_space(cs, sizeof(*op)); ++ op = cs->ops->require_space(cs, sizeof(*op), 0); + op->opcode = WINED3D_CS_OP_UPDATE_TEXTURE; + op->src = src; + op->dst = dst; +@@ -2172,7 +2172,7 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te struct wined3d_cs_get_release_dc *op; HRESULT hr; @@ -426,7 +426,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_GET_DC; op->texture = texture; op->sub_resource_idx = sub_resource_idx; -@@ -2202,7 +2202,7 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture +@@ -2198,7 +2198,7 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture struct wined3d_cs_get_release_dc *op; HRESULT hr; @@ -435,7 +435,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_RELEASE_DC; op->texture = texture; op->sub_resource_idx = sub_resource_idx; -@@ -2226,7 +2226,7 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_ +@@ -2222,7 +2222,7 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_ { struct wined3d_cs_update_swap_interval *op; @@ -444,7 +444,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_UPDATE_SWAP_INTERVAL; op->swapchain = swapchain; -@@ -2264,7 +2264,7 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs, +@@ -2260,7 +2260,7 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs, if (dirty_region) WARN("Ignoring dirty_region %s.\n", debug_box(dirty_region)); @@ -453,7 +453,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION; op->texture = texture; op->sub_resource_idx = sub_resource_idx; -@@ -2294,7 +2294,7 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d +@@ -2290,7 +2290,7 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d { struct wined3d_cs_buffer_copy *op; @@ -462,17 +462,8 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_BUFFER_COPY; op->dst_buffer = dst_buffer; op->dst_offset = dst_offset; -@@ -2364,7 +2364,7 @@ void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_id - { - struct wined3d_cs_map_vertex_buffers *op; - -- op = cs->ops->require_space(cs, sizeof(*op)); -+ op = cs->ops->require_space(cs, sizeof(*op), 0); - op->opcode = WINED3D_CS_OP_MAP_VERTEX_BUFFERS; - op->src_start_idx = src_start_idx; - op->stream_info = stream_info; -@@ -2427,7 +2427,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_MAP_VERTEX_BUFFERS */ wined3d_cs_exec_map_vertex_buffers, +@@ -2358,7 +2358,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_BUFFER_COPY */ wined3d_cs_exec_buffer_copy, }; -static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) @@ -480,7 +471,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 { if (size > (cs->data_size - cs->end)) { -@@ -2511,6 +2511,8 @@ static struct wined3d_cs_block *wined3d_cs_dequeue_command(struct wined3d_cs *cs +@@ -2442,6 +2442,8 @@ static struct wined3d_cs_block *wined3d_cs_dequeue_command(struct wined3d_cs *cs /* FIXME: Use an event to wait after a couple of spins. */ for (;;) { @@ -489,7 +480,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 if ((block = wined3d_cs_list_dequeue(&cs->exec_list))) return block; } -@@ -2538,7 +2540,7 @@ static void wined3d_cs_list_cleanup(struct wined3d_cs_list *list) +@@ -2469,7 +2471,7 @@ static void wined3d_cs_list_cleanup(struct wined3d_cs_list *list) DeleteCriticalSection(&list->lock); } @@ -498,7 +489,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 { struct wined3d_cs_block *block; -@@ -2552,26 +2554,28 @@ static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs) +@@ -2483,26 +2485,28 @@ static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs) } block->pos = 0; @@ -531,7 +522,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 cs->current_block = block; } -@@ -2583,10 +2587,13 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size) +@@ -2514,10 +2518,13 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size) static void wined3d_cs_mt_submit(struct wined3d_cs *cs) { @@ -546,7 +537,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 cs->current_block = NULL; } -@@ -2600,7 +2607,7 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs) +@@ -2531,7 +2538,7 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs) block = cs->current_block; block->fence = &fence; @@ -555,7 +546,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 cs->current_block = NULL; /* A busy wait should be fine, we're not supposed to have to wait very -@@ -2622,7 +2629,7 @@ static void wined3d_cs_mt_emit_stop(struct wined3d_cs *cs) +@@ -2553,7 +2560,7 @@ static void wined3d_cs_mt_emit_stop(struct wined3d_cs *cs) assert(cs->thread_id != GetCurrentThreadId()); assert(cs->ops == &wined3d_cs_mt_ops); @@ -564,7 +555,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 op->opcode = WINED3D_CS_OP_STOP; cs->ops->submit(cs); -@@ -2708,6 +2715,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -2639,6 +2646,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) wined3d_cs_list_init(&cs->free_list); wined3d_cs_list_init(&cs->exec_list); @@ -572,7 +563,7 @@ index 53a09a8cf8c..7b5c99b9e21 100644 if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, &cs->thread_id))) { -@@ -2733,6 +2741,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) +@@ -2664,6 +2672,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) WaitForSingleObject(cs->thread, INFINITE); CloseHandle(cs->thread); @@ -581,10 +572,10 @@ index 53a09a8cf8c..7b5c99b9e21 100644 wined3d_cs_list_cleanup(&cs->free_list); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 3e14ae56508..b6f84e1a36b 100644 +index 2b64485e82e..2662342cbba 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3219,13 +3219,14 @@ struct wined3d_cs_block +@@ -3222,13 +3222,14 @@ struct wined3d_cs_block { struct list entry; UINT pos; @@ -600,7 +591,7 @@ index 3e14ae56508..b6f84e1a36b 100644 void (*submit)(struct wined3d_cs *cs); void (*submit_and_wait)(struct wined3d_cs *cs); }; -@@ -3245,6 +3246,7 @@ struct wined3d_cs +@@ -3248,6 +3249,7 @@ struct wined3d_cs struct wined3d_cs_block *current_block; struct wined3d_cs_list free_list; struct wined3d_cs_list exec_list; diff --git a/patches/wined3d-CSMT_Main/0045-wined3d-Improve-wined3d_cs_emit_update_sub_resource.patch b/patches/wined3d-CSMT_Main/0045-wined3d-Improve-wined3d_cs_emit_update_sub_resource.patch index 9378484b..a24f63d2 100644 --- a/patches/wined3d-CSMT_Main/0045-wined3d-Improve-wined3d_cs_emit_update_sub_resource.patch +++ b/patches/wined3d-CSMT_Main/0045-wined3d-Improve-wined3d_cs_emit_update_sub_resource.patch @@ -1,96 +1,62 @@ -From 65c46cb888fd621f85b2ea35f011bbdb5042ba22 Mon Sep 17 00:00:00 2001 +From 399b96f2a004f607fe917225e390a6efff7169b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 20 Feb 2017 00:27:25 +0100 Subject: wined3d: Improve wined3d_cs_emit_update_sub_resource. --- - dlls/wined3d/cs.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++--- + dlls/wined3d/cs.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- dlls/wined3d/device.c | 2 -- - 2 files changed, 78 insertions(+), 6 deletions(-) + 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 67d6b736dab..b43130b0ab0 100644 +index d3bcc49e6ee..94f46d289a6 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -427,10 +427,13 @@ struct wined3d_cs_update_texture +@@ -380,10 +380,12 @@ struct wined3d_cs_unmap struct wined3d_cs_update_sub_resource { enum wined3d_cs_op opcode; + unsigned int size; struct wined3d_resource *resource; - unsigned int sub_resource_idx, row_pitch, depth_pitch; - const struct wined3d_box *box; - const void *data; -+ struct wined3d_box copy_box; + unsigned int sub_resource_idx; + struct wined3d_box box; + struct wined3d_sub_resource_data data; + BYTE copy_data[1]; }; - struct wined3d_cs_get_release_dc -@@ -2146,7 +2149,9 @@ static UINT wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi - if (FAILED(hr = wined3d_buffer_upload_data(buffer, op->box, op->data))) - WARN("Failed to update buffer data, hr %#x.\n", hr); - -- return sizeof(*op); -+ wined3d_resource_release(op->resource); -+ -+ return op->size; - } - - texture = wined3d_texture_from_resource(op->resource); -@@ -2176,7 +2181,9 @@ static UINT wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi - wined3d_texture_validate_location(texture, op->sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); - wined3d_texture_invalidate_location(texture, op->sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB); + struct wined3d_cs_push_constants +@@ -1973,7 +1975,7 @@ static UINT wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi + done: + wined3d_resource_release(op->resource); - return sizeof(*op); -+ wined3d_resource_release(op->resource); -+ + return op->size; } void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, -@@ -2184,9 +2191,76 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r - unsigned int depth_pitch) +@@ -1981,9 +1983,54 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r + unsigned int slice_pitch) { struct wined3d_cs_update_sub_resource *op; -+ unsigned int update_w, update_h, update_d; + size_t data_size, size; + + if (resource->type != WINED3D_RTYPE_BUFFER && resource->format_flags & WINED3DFMT_FLAG_BLOCKS) + goto no_async; + -+ if (box) -+ { -+ update_w = box->right - box->left; -+ update_h = box->bottom - box->top; -+ update_d = box->back - box->front; -+ } -+ else if (resource->type != WINED3D_RTYPE_BUFFER) -+ { -+ struct wined3d_texture *texture = wined3d_texture_from_resource(resource); -+ unsigned int level = sub_resource_idx % texture->level_count; -+ update_w = wined3d_texture_get_level_width(texture, level); -+ update_h = wined3d_texture_get_level_height(texture, level); -+ update_d = wined3d_texture_get_level_depth(texture, level); -+ } -+ else -+ { -+ update_w = resource->size; -+ } -+ + data_size = 0; + switch (resource->type) + { + case WINED3D_RTYPE_TEXTURE_3D: -+ data_size += max(update_d - 1, 0) * depth_pitch; ++ data_size += (box->back - box->front - 1) * slice_pitch; + /* fall-through */ + case WINED3D_RTYPE_TEXTURE_2D: -+ data_size += max(update_h - 1, 0) * row_pitch; ++ data_size += (box->bottom - box->top - 1) * row_pitch; + /* fall-through */ + case WINED3D_RTYPE_TEXTURE_1D: -+ data_size += update_w * resource->format->byte_count; ++ data_size += (box->right - box->left) * resource->format->byte_count; + break; + case WINED3D_RTYPE_BUFFER: -+ data_size = update_w; ++ data_size = box->right - box->left; + break; + } + @@ -103,12 +69,10 @@ index 67d6b736dab..b43130b0ab0 100644 + op->size = size; + op->resource = resource; + op->sub_resource_idx = sub_resource_idx; -+ op->box = box ? &op->copy_box : NULL; -+ op->data = op->copy_data; -+ op->row_pitch = row_pitch; -+ op->depth_pitch = depth_pitch; -+ -+ if (box) op->copy_box = *box; ++ op->box = *box; ++ op->data.row_pitch = row_pitch; ++ op->data.slice_pitch = slice_pitch; ++ op->data.data = op->copy_data; + memcpy(op->copy_data, data, data_size); + + wined3d_resource_acquire(resource); @@ -124,23 +88,12 @@ index 67d6b736dab..b43130b0ab0 100644 + op->size = sizeof(*op); op->resource = resource; op->sub_resource_idx = sub_resource_idx; - op->box = box; -@@ -2194,8 +2268,8 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r - op->row_pitch = row_pitch; - op->depth_pitch = depth_pitch; - -- /* The data pointer may go away, need to wait until the data is read. Copying the data may be faster. -- * Don't forget to copy box as well in this case. */ -+ wined3d_resource_acquire(resource); -+ - cs->ops->submit_and_wait(cs); - } - + op->box = *box; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index c32d967df88..1b77fa7d09d 100644 +index b413de95858..0efd687b747 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -4112,8 +4112,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str +@@ -4163,8 +4163,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n", device, resource, sub_resource_idx, debug_box(box), data, row_pitch, depth_pitch); diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 2b921b0c..17c286bb 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -54,7 +54,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -3725,6 +3725,11 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, +@@ -3721,6 +3721,11 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, TRACE("device %p, texture %p, sub_resource_idx %u.\n", device, texture, sub_resource_idx); @@ -90,7 +90,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c WINED3D_CS_OP_PRESENT, WINED3D_CS_OP_CLEAR, WINED3D_CS_OP_DISPATCH, -@@ -59,10 +66,37 @@ enum wined3d_cs_op +@@ -59,11 +66,36 @@ enum wined3d_cs_op WINED3D_CS_OP_RESET_STATE, WINED3D_CS_OP_CALLBACK, WINED3D_CS_OP_QUERY_ISSUE, @@ -101,18 +101,17 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c WINED3D_CS_OP_UNLOAD_RESOURCE, WINED3D_CS_OP_MAP, WINED3D_CS_OP_UNMAP, + WINED3D_CS_OP_UPDATE_SUB_RESOURCE, +#if defined(STAGING_CSMT) + WINED3D_CS_OP_PUSH_CONSTANTS, + WINED3D_CS_OP_BLT, + WINED3D_CS_OP_CLEAR_RTV, + WINED3D_CS_OP_UPDATE_TEXTURE, -+ WINED3D_CS_OP_UPDATE_SUB_RESOURCE, + WINED3D_CS_OP_GET_DC, + WINED3D_CS_OP_RELEASE_DC, + WINED3D_CS_OP_UPDATE_SWAP_INTERVAL, + WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION, + WINED3D_CS_OP_BUFFER_COPY, -+ WINED3D_CS_OP_MAP_VERTEX_BUFFERS, + WINED3D_CS_OP_STOP, +}; + @@ -128,7 +127,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c }; struct wined3d_cs_present -@@ -313,6 +347,16 @@ struct wined3d_cs_query_issue +@@ -314,6 +346,16 @@ struct wined3d_cs_query_issue DWORD flags; }; @@ -145,13 +144,25 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c struct wined3d_cs_preload_resource { enum wined3d_cs_op opcode; -@@ -344,7 +388,140 @@ struct wined3d_cs_unmap - HRESULT *hr; +@@ -348,13 +390,133 @@ struct wined3d_cs_unmap + struct wined3d_cs_update_sub_resource + { + enum wined3d_cs_op opcode; ++#if defined(STAGING_CSMT) ++ unsigned int size; ++#endif /* STAGING_CSMT */ + struct wined3d_resource *resource; + unsigned int sub_resource_idx; + struct wined3d_box box; + struct wined3d_sub_resource_data data; ++#if !defined(STAGING_CSMT) }; -+#if !defined(STAGING_CSMT) static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +#else /* STAGING_CSMT */ ++ BYTE copy_data[1]; ++}; ++ +struct wined3d_cs_push_constants +{ + enum wined3d_cs_op opcode; @@ -191,18 +202,6 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + struct wined3d_texture *src, *dst; +}; + -+struct wined3d_cs_update_sub_resource -+{ -+ enum wined3d_cs_op opcode; -+ unsigned int size; -+ struct wined3d_resource *resource; -+ unsigned int sub_resource_idx, row_pitch, depth_pitch; -+ const struct wined3d_box *box; -+ const void *data; -+ struct wined3d_box copy_box; -+ BYTE copy_data[1]; -+}; -+ +struct wined3d_cs_get_release_dc +{ + enum wined3d_cs_op opcode; @@ -234,13 +233,6 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + unsigned int size; +}; + -+struct wined3d_cs_map_vertex_buffers -+{ -+ enum wined3d_cs_op opcode; -+ UINT src_start_idx; -+ struct wined3d_stream_info *stream_info; -+}; -+ +struct wined3d_cs_stop +{ + enum wined3d_cs_op opcode; @@ -286,7 +278,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_present *op = data; struct wined3d_swapchain *swapchain; -@@ -355,11 +532,19 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) +@@ -365,11 +527,19 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags); @@ -306,7 +298,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, -@@ -367,8 +552,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -377,8 +547,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw { struct wined3d_cs_present *op; unsigned int i; @@ -321,7 +313,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_PRESENT; op->dst_window_override = dst_window_override; op->swapchain = swapchain; -@@ -382,16 +573,39 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw +@@ -392,16 +568,39 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw wined3d_resource_acquire(&swapchain->back_buffers[i]->resource); } @@ -361,7 +353,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c device = cs->device; wined3d_get_draw_rect(state, &draw_rect); -@@ -409,6 +623,10 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) +@@ -419,6 +618,10 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) } if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) wined3d_resource_release(state->fb->depth_stencil->resource); @@ -372,7 +364,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, -@@ -418,7 +636,11 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * +@@ -428,7 +631,11 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * struct wined3d_cs_clear *op; unsigned int i; @@ -384,7 +376,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_CLEAR; op->flags = flags; op->color = *color; -@@ -547,7 +769,11 @@ static void release_unordered_access_resources(const struct wined3d_shader *shad +@@ -557,7 +764,11 @@ static void release_unordered_access_resources(const struct wined3d_shader *shad } } @@ -396,7 +388,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_dispatch *op = data; struct wined3d_state *state = &cs->state; -@@ -558,6 +784,10 @@ static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data) +@@ -568,6 +779,10 @@ static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data) release_shader_resources(state, 1u << WINED3D_SHADER_TYPE_COMPUTE); release_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_COMPUTE], state->unordered_access_view[WINED3D_PIPELINE_COMPUTE]); @@ -407,7 +399,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, -@@ -566,7 +796,11 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, +@@ -576,7 +791,11 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, const struct wined3d_state *state = &cs->device->state; struct wined3d_cs_dispatch *op; @@ -419,7 +411,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_DISPATCH; op->group_count_x = group_count_x; op->group_count_y = group_count_y; -@@ -579,7 +813,11 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, +@@ -589,7 +808,11 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs, cs->ops->submit(cs); } @@ -431,7 +423,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { struct wined3d_state *state = &cs->state; const struct wined3d_cs_draw *op = data; -@@ -624,6 +862,10 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) +@@ -634,6 +857,10 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) release_shader_resources(state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE)); release_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_PIXEL], state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]); @@ -442,7 +434,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx, unsigned int start_idx, -@@ -633,7 +875,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base +@@ -643,7 +870,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base struct wined3d_cs_draw *op; unsigned int i; @@ -454,7 +446,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_DRAW; op->primitive_type = primitive_type; op->base_vertex_idx = base_vertex_idx; -@@ -669,70 +915,123 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base +@@ -679,70 +910,123 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base cs->ops->submit(cs); } @@ -578,7 +570,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, -@@ -740,15 +1039,26 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v +@@ -750,15 +1034,26 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v { struct wined3d_cs_set_rendertarget_view *op; @@ -605,7 +597,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_depth_stencil_view *op = data; struct wined3d_device *device = cs->device; -@@ -783,39 +1093,69 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const +@@ -793,39 +1088,69 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const } device_invalidate_state(device, STATE_FRAMEBUFFER); @@ -675,7 +667,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_source *op = data; struct wined3d_stream_state *stream; -@@ -833,6 +1173,10 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void +@@ -843,6 +1168,10 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -686,7 +678,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, -@@ -840,17 +1184,28 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, +@@ -850,17 +1179,28 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, { struct wined3d_cs_set_stream_source *op; @@ -715,7 +707,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_source_freq *op = data; struct wined3d_stream_state *stream; -@@ -860,22 +1215,37 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const +@@ -870,22 +1210,37 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const stream->flags = op->flags; device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -753,7 +745,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_output *op = data; struct wined3d_stream_output *stream; -@@ -890,6 +1260,10 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void +@@ -900,6 +1255,10 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void InterlockedIncrement(&op->buffer->resource.bind_count); if (prev) InterlockedDecrement(&prev->resource.bind_count); @@ -764,7 +756,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, -@@ -897,16 +1271,27 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, +@@ -907,16 +1266,27 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, { struct wined3d_cs_set_stream_output *op; @@ -792,7 +784,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_index_buffer *op = data; struct wined3d_buffer *prev; -@@ -922,6 +1307,10 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * +@@ -932,6 +1302,10 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void * InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_INDEXBUFFER); @@ -803,7 +795,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -@@ -929,16 +1318,27 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff +@@ -939,16 +1313,27 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff { struct wined3d_cs_set_index_buffer *op; @@ -831,7 +823,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_constant_buffer *op = data; struct wined3d_buffer *prev; -@@ -952,6 +1352,9 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi +@@ -962,6 +1347,9 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); @@ -841,7 +833,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -959,16 +1362,27 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha +@@ -969,16 +1357,27 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha { struct wined3d_cs_set_constant_buffer *op; @@ -869,7 +861,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; -@@ -1045,21 +1459,36 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) +@@ -1055,21 +1454,36 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) if (new_use_color_key) device_invalidate_state(cs->device, STATE_COLOR_KEY); @@ -906,7 +898,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_shader_resource_view *op = data; struct wined3d_shader_resource_view *prev; -@@ -1076,6 +1505,10 @@ static void wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, cons +@@ -1086,6 +1500,10 @@ static void wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, cons device_invalidate_state(cs->device, STATE_GRAPHICS_SHADER_RESOURCE_BINDING); else device_invalidate_state(cs->device, STATE_COMPUTE_SHADER_RESOURCE_BINDING); @@ -917,7 +909,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1083,16 +1516,27 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 +@@ -1093,16 +1511,27 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3 { struct wined3d_cs_set_shader_resource_view *op; @@ -945,7 +937,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_unordered_access_view *op = data; struct wined3d_unordered_access_view *prev; -@@ -1106,6 +1550,10 @@ static void wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, con +@@ -1116,6 +1545,10 @@ static void wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, con InterlockedDecrement(&prev->resource->bind_count); device_invalidate_state(cs->device, STATE_UNORDERED_ACCESS_VIEW_BINDING(op->pipeline)); @@ -956,7 +948,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined3d_pipeline pipeline, -@@ -1113,16 +1561,27 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined +@@ -1123,16 +1556,27 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined { struct wined3d_cs_set_unordered_access_view *op; @@ -984,7 +976,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_sampler *op = data; -@@ -1131,6 +1590,10 @@ static void wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data) +@@ -1141,6 +1585,10 @@ static void wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data) device_invalidate_state(cs->device, STATE_GRAPHICS_SHADER_RESOURCE_BINDING); else device_invalidate_state(cs->device, STATE_COMPUTE_SHADER_RESOURCE_BINDING); @@ -995,7 +987,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1138,16 +1601,27 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type +@@ -1148,16 +1596,27 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type { struct wined3d_cs_set_sampler *op; @@ -1023,7 +1015,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_shader *op = data; -@@ -1157,26 +1631,45 @@ static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) +@@ -1167,26 +1626,45 @@ static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data) device_invalidate_state(cs->device, STATE_GRAPHICS_SHADER_RESOURCE_BINDING); else device_invalidate_state(cs->device, STATE_COMPUTE_SHADER_RESOURCE_BINDING); @@ -1069,7 +1061,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, -@@ -1184,39 +1677,69 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, +@@ -1194,39 +1672,69 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs, { struct wined3d_cs_set_rasterizer_state *op; @@ -1139,7 +1131,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, -@@ -1224,21 +1747,36 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, +@@ -1234,21 +1742,36 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, { struct wined3d_cs_set_texture_state *op; @@ -1176,7 +1168,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -@@ -1246,22 +1784,37 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, +@@ -1256,22 +1779,37 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, { struct wined3d_cs_set_sampler_state *op; @@ -1214,7 +1206,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, -@@ -1269,35 +1822,61 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform +@@ -1279,35 +1817,61 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform { struct wined3d_cs_set_transform *op; @@ -1276,7 +1268,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_color_key *op = data; struct wined3d_texture *texture = op->texture; -@@ -1358,6 +1937,10 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat +@@ -1368,6 +1932,10 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat break; } } @@ -1287,7 +1279,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -1365,7 +1948,11 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1375,7 +1943,11 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture { struct wined3d_cs_set_color_key *op; @@ -1299,7 +1291,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_SET_COLOR_KEY; op->texture = texture; op->flags = flags; -@@ -1377,29 +1964,51 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture +@@ -1387,29 +1959,51 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture else op->set = 0; @@ -1351,7 +1343,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_light *op = data; struct wined3d_light_info *light_info; -@@ -1413,7 +2022,11 @@ static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data) +@@ -1423,7 +2017,11 @@ static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data) if (!(light_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*light_info)))) { ERR("Failed to allocate light info.\n"); @@ -1363,7 +1355,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } hash_idx = LIGHTMAP_HASHFUNC(light_idx); -@@ -1434,20 +2047,35 @@ static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data) +@@ -1444,20 +2042,35 @@ static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data) light_info->direction = op->light.direction; light_info->exponent = op->light.exponent; light_info->cutoff = op->light.cutoff; @@ -1399,7 +1391,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_light_enable *op = data; struct wined3d_device *device = cs->device; -@@ -1457,7 +2085,11 @@ static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void * +@@ -1467,7 +2080,11 @@ static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void * if (!(light_info = wined3d_state_get_light(&cs->state, op->idx))) { ERR("Light doesn't exist.\n"); @@ -1411,7 +1403,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } prev_idx = light_info->glIndex; -@@ -1467,21 +2099,36 @@ static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void * +@@ -1477,21 +2094,36 @@ static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void * device_invalidate_state(device, STATE_LIGHT_TYPE); device_invalidate_state(device, STATE_ACTIVELIGHT(op->enable ? light_info->glIndex : prev_idx)); } @@ -1448,7 +1440,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { struct wined3d_adapter *adapter = cs->device->adapter; -@@ -1489,12 +2136,17 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) +@@ -1499,12 +2131,17 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data) memset(&cs->state, 0, sizeof(cs->state)); state_init(&cs->state, &cs->fb, &adapter->gl_info, &adapter->d3d_info, WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT); @@ -1466,7 +1458,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_RESET_STATE; -@@ -1502,17 +2154,34 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) +@@ -1512,17 +2149,34 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) } static void wined3d_cs_exec_callback(struct wined3d_cs *cs, const void *data) @@ -1501,7 +1493,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_CALLBACK; op->callback = callback; op->object = object; -@@ -1530,40 +2199,103 @@ void wined3d_cs_init_object(struct wined3d_cs *cs, void (*callback)(void *object +@@ -1540,40 +2194,103 @@ void wined3d_cs_init_object(struct wined3d_cs *cs, void (*callback)(void *object wined3d_cs_emit_callback(cs, callback, object); } @@ -1514,12 +1506,12 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c const struct wined3d_cs_query_issue *op = data; struct wined3d_query *query = op->query; +#if !defined(STAGING_CSMT) - - query->query_ops->query_issue(query, op->flags); -+#else /* STAGING_CSMT */ -+ struct wined3d_context *context; + + query->query_ops->query_issue(query, op->flags); ++#else /* STAGING_CSMT */ ++ struct wined3d_context *context; + + query->query_ops->query_issue(query, op->flags); + + InterlockedDecrement(&query->pending); + @@ -1605,7 +1597,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_PRELOAD_RESOURCE; op->resource = resource; -@@ -1572,20 +2304,32 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso +@@ -1582,20 +2299,32 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso cs->ops->submit(cs); } @@ -1638,7 +1630,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_UNLOAD_RESOURCE; op->resource = resource; -@@ -1594,13 +2338,21 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou +@@ -1604,13 +2333,21 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou cs->ops->submit(cs); } @@ -1660,7 +1652,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx, -@@ -1609,7 +2361,11 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, +@@ -1619,7 +2356,11 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, struct wined3d_cs_map *op; HRESULT hr; @@ -1672,7 +1664,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_MAP; op->resource = resource; op->sub_resource_idx = sub_resource_idx; -@@ -1618,17 +2374,29 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, +@@ -1628,17 +2369,29 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, op->flags = flags; op->hr = &hr; @@ -1702,7 +1694,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx) -@@ -1636,19 +2404,554 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc +@@ -1646,18 +2399,30 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc struct wined3d_cs_unmap *op; HRESULT hr; @@ -1720,10 +1712,98 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs); +#else /* STAGING_CSMT */ + cs->ops->submit_and_wait(cs); ++#endif /* STAGING_CSMT */ return hr; } ++#if !defined(STAGING_CSMT) + static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data) ++#else /* STAGING_CSMT */ ++static UINT wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data) ++#endif /* STAGING_CSMT */ + { + const struct wined3d_cs_update_sub_resource *op = data; + const struct wined3d_box *box = &op->box; +@@ -1707,6 +2472,9 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi + + done: + wined3d_resource_release(op->resource); ++#if defined(STAGING_CSMT) ++ return op->size; ++#endif /* STAGING_CSMT */ + } + + void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, +@@ -1714,9 +2482,60 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r + unsigned int slice_pitch) + { + struct wined3d_cs_update_sub_resource *op; ++#if !defined(STAGING_CSMT) + + op = cs->ops->require_space(cs, sizeof(*op)); + op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; ++#else /* STAGING_CSMT */ ++ size_t data_size, size; ++ ++ if (resource->type != WINED3D_RTYPE_BUFFER && resource->format_flags & WINED3DFMT_FLAG_BLOCKS) ++ goto no_async; ++ ++ data_size = 0; ++ switch (resource->type) ++ { ++ case WINED3D_RTYPE_TEXTURE_3D: ++ data_size += (box->back - box->front - 1) * slice_pitch; ++ /* fall-through */ ++ case WINED3D_RTYPE_TEXTURE_2D: ++ data_size += (box->bottom - box->top - 1) * row_pitch; ++ /* fall-through */ ++ case WINED3D_RTYPE_TEXTURE_1D: ++ data_size += (box->right - box->left) * resource->format->byte_count; ++ break; ++ case WINED3D_RTYPE_BUFFER: ++ data_size = box->right - box->left; ++ break; ++ } ++ ++ size = FIELD_OFFSET(struct wined3d_cs_update_sub_resource, copy_data[data_size]); ++ if (size > sizeof(cs->current_block->data)) ++ goto no_async; ++ ++ op = cs->ops->require_space(cs, size, 0); ++ op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; ++ op->size = size; ++ op->resource = resource; ++ op->sub_resource_idx = sub_resource_idx; ++ op->box = *box; ++ op->data.row_pitch = row_pitch; ++ op->data.slice_pitch = slice_pitch; ++ op->data.data = op->copy_data; ++ memcpy(op->copy_data, data, data_size); ++ ++ wined3d_resource_acquire(resource); ++ ++ cs->ops->submit(cs); ++ return; ++ ++no_async: ++ wined3d_resource_wait_idle(resource); ++ ++ op = cs->ops->require_space(cs, sizeof(*op), 1); ++ op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; ++ op->size = sizeof(*op); ++#endif /* STAGING_CSMT */ + op->resource = resource; + op->sub_resource_idx = sub_resource_idx; + op->box = *box; +@@ -1726,11 +2545,336 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r + + wined3d_resource_acquire(resource); + ++#if defined(STAGING_CSMT) ++ cs->ops->submit_and_wait(cs); ++} ++ +static const struct +{ + size_t offset; @@ -1822,9 +1902,14 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + if (src_surface && src_surface != dst_surface) + wined3d_resource_acquire(&src_surface->container->resource); + -+ cs->ops->submit(cs); -+} -+ ++#endif /* STAGING_CSMT */ + cs->ops->submit(cs); + } + ++#if !defined(STAGING_CSMT) + static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = + { ++#else /* STAGING_CSMT */ +static UINT wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_clear_rtv *op = data; @@ -1893,146 +1978,6 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + cs->ops->submit(cs); +} + -+static UINT wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_update_sub_resource *op = data; -+ struct wined3d_const_bo_address addr; -+ struct wined3d_context *context; -+ struct wined3d_texture *texture; -+ unsigned int width, height, depth, level; -+ -+ if (op->resource->type == WINED3D_RTYPE_BUFFER) -+ { -+ struct wined3d_buffer *buffer = buffer_from_resource(op->resource); -+ HRESULT hr; -+ -+ if (FAILED(hr = wined3d_buffer_upload_data(buffer, op->box, op->data))) -+ WARN("Failed to update buffer data, hr %#x.\n", hr); -+ -+ wined3d_resource_release(op->resource); -+ -+ return op->size; -+ } -+ -+ texture = wined3d_texture_from_resource(op->resource); -+ -+ level = op->sub_resource_idx % texture->level_count; -+ width = wined3d_texture_get_level_width(texture, level); -+ height = wined3d_texture_get_level_height(texture, level); -+ depth = wined3d_texture_get_level_depth(texture, level); -+ -+ addr.buffer_object = 0; -+ addr.addr = op->data; -+ -+ context = context_acquire(texture->resource.device, NULL, 0); -+ -+ /* Only load the sub-resource for partial updates. */ -+ if (!op->box || (!op->box->left && !op->box->top && !op->box->front -+ && op->box->right == width && op->box->bottom == height && op->box->back == depth)) -+ wined3d_texture_prepare_texture(texture, context, FALSE); -+ else -+ wined3d_texture_load_location(texture, op->sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB); -+ wined3d_texture_bind_and_dirtify(texture, context, FALSE); -+ -+ wined3d_texture_upload_data(texture, op->sub_resource_idx, context, op->box, &addr, op->row_pitch, op->depth_pitch); -+ -+ context_release(context); -+ -+ wined3d_texture_validate_location(texture, op->sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); -+ wined3d_texture_invalidate_location(texture, op->sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB); -+ -+ wined3d_resource_release(op->resource); -+ -+ return op->size; -+} -+ -+void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, -+ unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, -+ unsigned int depth_pitch) -+{ -+ struct wined3d_cs_update_sub_resource *op; -+ unsigned int update_w, update_h, update_d; -+ size_t data_size, size; -+ -+ if (resource->type != WINED3D_RTYPE_BUFFER && resource->format_flags & WINED3DFMT_FLAG_BLOCKS) -+ goto no_async; -+ -+ if (box) -+ { -+ update_w = box->right - box->left; -+ update_h = box->bottom - box->top; -+ update_d = box->back - box->front; -+ } -+ else if (resource->type != WINED3D_RTYPE_BUFFER) -+ { -+ struct wined3d_texture *texture = wined3d_texture_from_resource(resource); -+ unsigned int level = sub_resource_idx % texture->level_count; -+ update_w = wined3d_texture_get_level_width(texture, level); -+ update_h = wined3d_texture_get_level_height(texture, level); -+ update_d = wined3d_texture_get_level_depth(texture, level); -+ } -+ else -+ { -+ update_w = resource->size; -+ } -+ -+ data_size = 0; -+ switch (resource->type) -+ { -+ case WINED3D_RTYPE_TEXTURE_3D: -+ data_size += max(update_d - 1, 0) * depth_pitch; -+ /* fall-through */ -+ case WINED3D_RTYPE_TEXTURE_2D: -+ data_size += max(update_h - 1, 0) * row_pitch; -+ /* fall-through */ -+ case WINED3D_RTYPE_TEXTURE_1D: -+ data_size += update_w * resource->format->byte_count; -+ break; -+ case WINED3D_RTYPE_BUFFER: -+ data_size = update_w; -+ break; -+ } -+ -+ size = FIELD_OFFSET(struct wined3d_cs_update_sub_resource, copy_data[data_size]); -+ if (size > sizeof(cs->current_block->data)) -+ goto no_async; -+ -+ op = cs->ops->require_space(cs, size, 0); -+ op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; -+ op->size = size; -+ op->resource = resource; -+ op->sub_resource_idx = sub_resource_idx; -+ op->box = box ? &op->copy_box : NULL; -+ op->data = op->copy_data; -+ op->row_pitch = row_pitch; -+ op->depth_pitch = depth_pitch; -+ -+ if (box) op->copy_box = *box; -+ memcpy(op->copy_data, data, data_size); -+ -+ wined3d_resource_acquire(resource); -+ -+ cs->ops->submit(cs); -+ return; -+ -+no_async: -+ wined3d_resource_wait_idle(resource); -+ -+ op = cs->ops->require_space(cs, sizeof(*op), 1); -+ op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; -+ op->size = sizeof(*op); -+ op->resource = resource; -+ op->sub_resource_idx = sub_resource_idx; -+ op->box = box; -+ op->data = data; -+ op->row_pitch = row_pitch; -+ op->depth_pitch = depth_pitch; -+ -+ wined3d_resource_acquire(resource); -+ -+ cs->ops->submit_and_wait(cs); -+} -+ +static UINT wined3d_cs_exec_get_dc(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_get_release_dc *op = data; @@ -2055,15 +2000,10 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + op->hr = &hr; + + cs->ops->submit_and_wait(cs); -+#endif /* STAGING_CSMT */ + + return hr; +} + -+#if !defined(STAGING_CSMT) - static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = - { -+#else /* STAGING_CSMT */ +static UINT wined3d_cs_exec_release_dc(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_get_release_dc *op = data; @@ -2185,70 +2125,6 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + cs->ops->submit(cs); +} + -+static UINT wined3d_cs_exec_map_vertex_buffers(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_map_vertex_buffers *op = data; -+ struct wined3d_state *state = &cs->device->state; -+ const struct wined3d_gl_info *gl_info; -+ struct wined3d_context *context; -+ struct wined3d_shader *vs; -+ unsigned int i; -+ WORD map; -+ -+ /* Need any context to write to the vbo. */ -+ context = context_acquire(cs->device, NULL, 0); -+ gl_info = context->gl_info; -+ -+ vs = state->shader[WINED3D_SHADER_TYPE_VERTEX]; -+ state->shader[WINED3D_SHADER_TYPE_VERTEX] = NULL; -+ context_stream_info_from_declaration(context, state, op->stream_info); -+ state->shader[WINED3D_SHADER_TYPE_VERTEX] = vs; -+ -+ /* We can't convert FROM a VBO, and vertex buffers used to source into -+ * process_vertices() are unlikely to ever be used for drawing. Release -+ * VBOs in those buffers and fix up the stream_info structure. -+ * -+ * Also apply the start index. */ -+ for (i = 0, map = op->stream_info->use_map; map; map >>= 1, ++i) -+ { -+ struct wined3d_stream_info_element *e; -+ struct wined3d_buffer *buffer; -+ -+ if (!(map & 1)) -+ continue; -+ -+ e = &op->stream_info->elements[i]; -+ buffer = state->streams[e->stream_idx].buffer; -+ e->data.buffer_object = 0; -+ e->data.addr += (ULONG_PTR)wined3d_buffer_load_sysmem(buffer, context); -+ if (buffer->buffer_object) -+ { -+ GL_EXTCALL(glDeleteBuffers(1, &buffer->buffer_object)); -+ buffer->buffer_object = 0; -+ wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_BUFFER); -+ } -+ if (e->data.addr) -+ e->data.addr += e->stride * op->src_start_idx; -+ } -+ -+ context_release(context); -+ -+ return sizeof(*op); -+} -+ -+void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_idx, -+ struct wined3d_stream_info *stream_info) -+{ -+ struct wined3d_cs_map_vertex_buffers *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op), 0); -+ op->opcode = WINED3D_CS_OP_MAP_VERTEX_BUFFERS; -+ op->src_start_idx = src_start_idx; -+ op->stream_info = stream_info; -+ -+ cs->ops->submit_and_wait(cs); -+} -+ +static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = +{ + /* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync, @@ -2257,7 +2133,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present, /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear, /* WINED3D_CS_OP_DISPATCH */ wined3d_cs_exec_dispatch, -@@ -1682,13 +2985,33 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1764,14 +2908,32 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, /* WINED3D_CS_OP_CALLBACK */ wined3d_cs_exec_callback, /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, @@ -2268,6 +2144,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c /* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource, /* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map, /* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap, + /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, +#if !defined(STAGING_CSMT) }; @@ -2277,13 +2154,11 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + /* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt, + /* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv, + /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, -+ /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, + /* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc, + /* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc, + /* WINED3D_CS_OP_UPDATE_SWAP_INTERVAL */ wined3d_cs_exec_update_swap_interval, + /* WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION */ wined3d_cs_exec_texture_add_dirty_region, + /* WINED3D_CS_OP_BUFFER_COPY */ wined3d_cs_exec_buffer_copy, -+ /* WINED3D_CS_OP_MAP_VERTEX_BUFFERS */ wined3d_cs_exec_map_vertex_buffers, +}; + +static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, int priority) @@ -2291,7 +2166,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { if (size > (cs->data_size - cs->end)) { -@@ -1732,6 +3055,7 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs) +@@ -1815,6 +2977,7 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs) HeapFree(GetProcessHeap(), 0, data); } @@ -2299,7 +2174,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p, unsigned int start_idx, unsigned int count, const void *constants) { -@@ -1772,15 +3096,271 @@ static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_pus +@@ -1855,15 +3018,271 @@ static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_pus for (i = 0, context_count = device->context_count; i < context_count; ++i) { device->contexts[i]->constant_update_mask |= push_constant_info[p].mask; @@ -2330,14 +2205,14 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + { + LeaveCriticalSection(&list->lock); + return NULL; - } ++ } + list_remove(head); + LeaveCriticalSection(&list->lock); + InterlockedDecrement(&list->count); + + return LIST_ENTRY(head, struct wined3d_cs_block, entry); - } - ++} ++ +static void wined3d_cs_wait_event(struct wined3d_cs *cs) +{ + InterlockedExchange(&cs->waiting_for_event, TRUE); @@ -2359,9 +2234,9 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + { + WaitForSingleObject(cs->event, INFINITE); +#endif /* STAGING_CSMT */ -+ } -+} -+ + } + } + +#if !defined(STAGING_CSMT) static const struct wined3d_cs_ops wined3d_cs_st_ops = { @@ -2571,7 +2446,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) { -@@ -1811,12 +3391,57 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) +@@ -1894,12 +3313,57 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) return NULL; } @@ -2757,62 +2632,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2850,7 +2891,9 @@ void CDECL wined3d_device_set_unordered_access_view(struct wined3d_device *devic - wined3d_device_set_pipeline_unordered_access_view(device, WINED3D_PIPELINE_GRAPHICS, idx, uav); - } - -+#if !defined(STAGING_CSMT) - /* Context activation is done by the caller. */ -+#endif /* STAGING_CSMT */ - #define copy_and_next(dest, src, size) memcpy(dest, src, size); dest += (size) - static HRESULT process_vertices_strided(const struct wined3d_device *device, DWORD dwDestIndex, DWORD dwCount, - const struct wined3d_stream_info *stream_info, struct wined3d_buffer *dest, DWORD flags, -@@ -3126,6 +3169,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, - UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer, - const struct wined3d_vertex_declaration *declaration, DWORD flags, DWORD dst_fvf) - { -+#if !defined(STAGING_CSMT) - struct wined3d_state *state = &device->state; - struct wined3d_stream_info stream_info; - const struct wined3d_gl_info *gl_info; -@@ -3134,6 +3178,10 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, - unsigned int i; - HRESULT hr; - WORD map; -+#else /* STAGING_CSMT */ -+ struct wined3d_stream_info stream_info; -+ HRESULT hr; -+#endif /* STAGING_CSMT */ - - TRACE("device %p, src_start_idx %u, dst_idx %u, vertex_count %u, " - "dst_buffer %p, declaration %p, flags %#x, dst_fvf %#x.\n", -@@ -3143,6 +3191,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, - if (declaration) - FIXME("Output vertex declaration not implemented yet.\n"); - -+#if !defined(STAGING_CSMT) - /* Need any context to write to the vbo. */ - context = context_acquire(device, NULL, 0); - gl_info = context->gl_info; -@@ -3178,12 +3227,17 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, - if (e->data.addr) - e->data.addr += e->stride * src_start_idx; - } -+#else /* STAGING_CSMT */ -+ wined3d_cs_emit_map_vertex_buffers(device->cs, src_start_idx, &stream_info); -+#endif /* STAGING_CSMT */ - - hr = process_vertices_strided(device, dst_idx, vertex_count, - &stream_info, dst_buffer, flags, dst_fvf); - -+#if !defined(STAGING_CSMT) - context_release(context); - -+#endif /* STAGING_CSMT */ - return hr; - } - -@@ -3470,8 +3524,10 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device) +@@ -3470,8 +3511,10 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device) HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) { @@ -2823,7 +2643,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p.\n", device); if (!device->inScene) -@@ -3480,6 +3536,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3480,6 +3523,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) return WINED3DERR_INVALIDCALL; } @@ -2831,7 +2651,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c context = context_acquire(device, NULL, 0); /* We only have to do this if we need to read the, swapbuffers performs a flush for us */ context->gl_info->gl_ops.gl.p_glFlush(); -@@ -3487,6 +3544,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) +@@ -3487,6 +3531,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) * fails. */ context_release(context); @@ -2839,7 +2659,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->inScene = FALSE; return WINED3D_OK; } -@@ -3634,11 +3692,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device +@@ -3634,11 +3679,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device start_idx, index_count, start_instance, instance_count, TRUE); } @@ -2857,7 +2677,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_context *context; struct wined3d_map_desc src; HRESULT hr = WINED3D_OK; -@@ -3662,6 +3726,13 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3662,6 +3713,13 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, } context = context_acquire(device, NULL, 0); @@ -2871,7 +2691,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Only a prepare, since we're uploading entire volumes. */ wined3d_texture_prepare_texture(dst_texture, context, FALSE); -@@ -3669,15 +3740,22 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3669,15 +3727,22 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, for (i = 0; i < level_count; ++i) { @@ -2894,7 +2714,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = wined3d_resource_unmap(&src_texture->resource, src_level + i))) goto done; } -@@ -3685,16 +3763,89 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, +@@ -3685,16 +3750,89 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device, done: context_release(context); return hr; @@ -2984,7 +2804,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture); -@@ -3731,6 +3882,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3731,6 +3869,7 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, return WINED3DERR_INVALIDCALL; } @@ -2992,7 +2812,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c level_count = min(wined3d_texture_get_level_count(src_texture), wined3d_texture_get_level_count(dst_texture)); -@@ -3753,9 +3905,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3753,9 +3892,21 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, context_release(context); /* Update every surface level of the texture. */ @@ -3014,7 +2834,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { unsigned int src_levels = src_texture->level_count; unsigned int dst_levels = dst_texture->level_count; -@@ -3788,6 +3952,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, +@@ -3788,6 +3939,38 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, FIXME("Unsupported texture type %#x.\n", type); return WINED3DERR_INVALIDCALL; } @@ -3053,7 +2873,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes) -@@ -3973,10 +4169,16 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device, +@@ -3973,10 +4156,16 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device, if (dst_resource->type == WINED3D_RTYPE_BUFFER) { @@ -3070,17 +2890,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return; } -@@ -4025,6 +4227,9 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev - struct wined3d_texture *dst_texture, *src_texture; - RECT dst_rect, src_rect; - HRESULT hr; -+#if defined(STAGING_CSMT) -+ struct wined3d_box dst_box; -+#endif /* STAGING_CSMT */ - - TRACE("device %p, dst_resource %p, dst_sub_resource_idx %u, dst_x %u, dst_y %u, dst_z %u, " - "src_resource %p, src_sub_resource_idx %u, src_box %s.\n", -@@ -4097,8 +4302,14 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev +@@ -4097,8 +4286,14 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev return WINED3DERR_INVALIDCALL; } @@ -3095,104 +2905,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (dst_resource->type != WINED3D_RTYPE_TEXTURE_2D) -@@ -4112,6 +4323,16 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev - - if (src_box) - { -+#if defined(STAGING_CSMT) -+ if ((src_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) -+ && !wined3d_texture_check_block_align(src_texture, -+ src_sub_resource_idx % src_texture->level_count, src_box)) -+ { -+ WARN("Source box not block-aligned.\n"); -+ return WINED3DERR_INVALIDCALL; -+ } -+ -+#endif /* STAGING_CSMT */ - SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom); - } - else -@@ -4125,6 +4346,25 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev - SetRect(&dst_rect, dst_x, dst_y, dst_x + (src_rect.right - src_rect.left), - dst_y + (src_rect.bottom - src_rect.top)); - -+#if defined(STAGING_CSMT) -+ if (dst_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) -+ { -+ dst_box.left = dst_rect.left; -+ dst_box.top = dst_rect.top; -+ dst_box.front = 0; -+ dst_box.right = dst_rect.right; -+ dst_box.bottom = dst_rect.bottom; -+ dst_box.back = 1; -+ -+ if(!wined3d_texture_check_block_align(dst_texture, -+ dst_sub_resource_idx % dst_texture->level_count, &dst_box)) -+ { -+ WARN("Destination box not block-aligned.\n"); -+ return WINED3DERR_INVALIDCALL; -+ } -+ } -+ -+#endif /* STAGING_CSMT */ - if (FAILED(hr = wined3d_texture_blt(dst_texture, dst_sub_resource_idx, &dst_rect, - src_texture, src_sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT))) - WARN("Failed to blit, hr %#x.\n", hr); -@@ -4137,8 +4377,10 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str - unsigned int depth_pitch) - { - unsigned int width, height, depth, level; -+#if !defined(STAGING_CSMT) - struct wined3d_const_bo_address addr; - struct wined3d_context *context; -+#endif /* STAGING_CSMT */ - struct wined3d_texture *texture; - - TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n", -@@ -4146,18 +4388,24 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str - - if (resource->type == WINED3D_RTYPE_BUFFER) - { -+#if !defined(STAGING_CSMT) - struct wined3d_buffer *buffer = buffer_from_resource(resource); - HRESULT hr; - -+#endif /* STAGING_CSMT */ - if (sub_resource_idx > 0) - { - WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx); - return; - } - -+#if !defined(STAGING_CSMT) - if (FAILED(hr = wined3d_buffer_upload_data(buffer, box, data))) - WARN("Failed to update buffer data, hr %#x.\n", hr); - -+#else /* STAGING_CSMT */ -+ wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch); -+#endif /* STAGING_CSMT */ - return; - } - -@@ -4188,6 +4436,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str - return; - } - -+#if !defined(STAGING_CSMT) - addr.buffer_object = 0; - addr.addr = data; - -@@ -4207,6 +4456,9 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str - - wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); - wined3d_texture_invalidate_location(texture, sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB); -+#else /* STAGING_CSMT */ -+ wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch); -+#endif /* STAGING_CSMT */ - } - - HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, -@@ -4255,10 +4507,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi +@@ -4244,10 +4439,15 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi return WINED3DERR_INVALIDCALL; } @@ -3208,7 +2921,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, -@@ -4828,7 +5085,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, +@@ -4817,7 +5017,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, { if (reset_state) hr = wined3d_device_create_primary_opengl_context(device); @@ -3220,7 +2933,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } /* All done. There is no need to reload resources or shaders, this will happen automatically on the -@@ -5143,3 +5404,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -5132,3 +5336,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -3424,7 +3137,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -2450,8 +2468,12 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2431,8 +2449,12 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st { struct wined3d_resource *resource = &s->container->resource; struct wined3d_device *device = resource->device; @@ -3437,7 +3150,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c const struct blit_shader *blitter; HRESULT hr; -@@ -2462,6 +2484,7 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2443,6 +2465,7 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st return WINED3DERR_INVALIDCALL; } @@ -3445,7 +3158,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c view_desc.format_id = resource->format->id; view_desc.flags = 0; view_desc.u.texture.level_idx = s->texture_level; -@@ -2477,6 +2500,19 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st +@@ -2458,6 +2481,19 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st hr = blitter->color_fill(device, view, rect, color); wined3d_rendertarget_view_decref(view); @@ -3465,7 +3178,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c return hr; } -@@ -2791,7 +2827,11 @@ static BOOL surface_load_texture(struct wined3d_surface *surface, +@@ -2772,7 +2808,11 @@ static BOOL surface_load_texture(struct wined3d_surface *surface, /* Don't use PBOs for converted surfaces. During PBO conversion we look at * WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is * getting called. */ @@ -3477,7 +3190,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c { TRACE("Removing the pbo attached to surface %p.\n", surface); -@@ -3772,7 +3812,11 @@ const struct blit_shader cpu_blit = { +@@ -3737,7 +3777,11 @@ const struct blit_shader cpu_blit = { cpu_blit_blit_surface, }; @@ -3489,22 +3202,26 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) { -@@ -3782,9 +3826,14 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3747,11 +3791,18 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst struct wined3d_texture *dst_texture = dst_surface->container; struct wined3d_device *device = dst_texture->resource.device; struct wined3d_swapchain *src_swapchain, *dst_swapchain; +#if !defined(STAGING_CSMT) struct wined3d_texture *src_texture = NULL; - unsigned int dst_w, dst_h, src_w, src_h; unsigned int src_sub_resource_idx = 0; + DWORD src_ds_flags, dst_ds_flags; + BOOL scale, convert; + HRESULT hr; +#else /* STAGING_CSMT */ + struct wined3d_texture *src_texture; + unsigned int src_sub_resource_idx; ++ DWORD src_ds_flags, dst_ds_flags; ++ BOOL scale, convert; +#endif /* STAGING_CSMT */ - DWORD src_ds_flags, dst_ds_flags; - BOOL scale, convert; -@@ -3797,6 +3846,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst + static const DWORD simple_blit = WINED3D_BLT_ASYNC + | WINED3D_BLT_COLOR_FILL +@@ -3762,6 +3813,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst | WINED3D_BLT_DO_NOT_WAIT | WINED3D_BLT_ALPHA_TEST; @@ -3512,7 +3229,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx, debug_d3dtexturefiltertype(filter)); -@@ -3814,10 +3864,12 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3779,10 +3831,12 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst fx->src_color_key.color_space_high_value); } @@ -3525,7 +3242,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } if (dst_texture->sub_resources[dst_sub_resource_idx].map_count -@@ -3875,6 +3927,15 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3822,6 +3876,15 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst if (!once++) FIXME("Can't handle WINED3D_BLT_DO_NOT_WAIT flag.\n"); flags &= ~WINED3D_BLT_DO_NOT_WAIT; @@ -3541,7 +3258,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } if (!device->d3d_initialized) -@@ -3899,11 +3960,13 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3846,11 +3909,13 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; } @@ -3555,7 +3272,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c dst_swapchain = dst_texture->swapchain; /* This isn't strictly needed. FBO blits for example could deal with -@@ -3939,13 +4002,21 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3886,13 +3951,21 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst TRACE("Depth fill.\n"); if (!wined3d_format_convert_color_to_float(dst_texture->resource.format, NULL, fx->fill_color, &color)) @@ -3577,7 +3294,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c if (src_ds_flags != dst_ds_flags) { WARN("Rejecting depth / stencil blit between incompatible formats.\n"); -@@ -3955,6 +4026,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3902,6 +3975,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_texture->resource.draw_binding, src_rect, dst_surface, dst_texture->resource.draw_binding, dst_rect))) return WINED3D_OK; @@ -3589,7 +3306,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } else -@@ -3990,7 +4066,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3937,7 +4015,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst goto fallback; if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color))) @@ -3601,7 +3318,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } else { -@@ -4034,7 +4114,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -3981,7 +4063,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst context, dst_texture->resource.draw_binding); context_release(context); } @@ -3613,7 +3330,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4058,7 +4142,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4005,7 +4091,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, 0); dst_swapchain->desc.swap_effect = swap_effect; @@ -3625,7 +3342,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } if (fbo_blit_supported(&device->adapter->gl_info, blit_op, -@@ -4079,7 +4167,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4026,7 +4116,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~dst_texture->resource.draw_binding); @@ -3637,7 +3354,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op, -@@ -4089,7 +4181,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4036,7 +4130,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst { blitter->blit_surface(device, blit_op, filter, src_surface, src_rect, dst_surface, dst_rect, color_key); @@ -3649,7 +3366,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c } } } -@@ -4097,9 +4193,142 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst +@@ -4044,9 +4142,128 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst fallback: /* Special cases for render targets. */ if (SUCCEEDED(surface_blt_special(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter))) @@ -3671,14 +3388,17 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, + const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) +{ ++ struct wined3d_box dst_box = {dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, 0, 1}; ++ struct wined3d_box src_box = {src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1}; + struct wined3d_texture *dst_texture = dst_surface->container; ++ struct wined3d_texture *src_texture = NULL; + struct wined3d_device *device = dst_texture->resource.device; + unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface), src_sub_resource_idx; + struct wined3d_texture_sub_resource *dst_sub_resource = + &dst_texture->sub_resources[dst_sub_resource_idx]; + struct wined3d_texture_sub_resource *src_sub_resource = NULL; -+ unsigned int dst_w, dst_h, src_w, src_h; + DWORD src_ds_flags, dst_ds_flags; ++ HRESULT hr; + + TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", + dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), @@ -3699,6 +3419,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + + if (src_surface) + { ++ src_texture = src_surface->container; + src_sub_resource_idx = surface_get_sub_resource_idx(src_surface); + src_sub_resource = &src_surface->container->sub_resources[src_sub_resource_idx]; + } @@ -3713,30 +3434,12 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c + } + } + -+ dst_w = wined3d_texture_get_level_width(dst_texture, dst_surface->texture_level); -+ dst_h = wined3d_texture_get_level_height(dst_texture, dst_surface->texture_level); -+ if (IsRectEmpty(dst_rect) || dst_rect->left > dst_w || dst_rect->left < 0 -+ || dst_rect->top > dst_h || dst_rect->top < 0 -+ || dst_rect->right > dst_w || dst_rect->right < 0 -+ || dst_rect->bottom > dst_h || dst_rect->bottom < 0) -+ { -+ WARN("The application gave us a bad destination rectangle.\n"); -+ return WINEDDERR_INVALIDRECT; -+ } ++ if (FAILED(hr = wined3d_texture_check_box_dimensions(dst_texture, dst_surface->texture_level, &dst_box))) ++ return hr; + -+ if (src_surface) -+ { -+ src_w = wined3d_texture_get_level_width(src_surface->container, src_surface->texture_level); -+ src_h = wined3d_texture_get_level_height(src_surface->container, src_surface->texture_level); -+ if (IsRectEmpty(src_rect) || src_rect->left > src_w || src_rect->left < 0 -+ || src_rect->top > src_h || src_rect->top < 0 -+ || src_rect->right > src_w || src_rect->right < 0 -+ || src_rect->bottom > src_h || src_rect->bottom < 0) -+ { -+ WARN("The application gave us a bad source rectangle.\n"); -+ return WINEDDERR_INVALIDRECT; -+ } -+ } ++ if (src_texture && FAILED(hr = wined3d_texture_check_box_dimensions(src_texture, ++ src_surface->texture_level, &src_box))) ++ return hr; + + dst_ds_flags = dst_texture->resource.format_flags + & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL); @@ -3974,7 +3677,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } if (context) context_release(context); -@@ -1316,18 +1356,31 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT +@@ -1340,18 +1380,31 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT wined3d_texture_invalidate_location(texture, 0, ~valid_location); if (create_dib) @@ -4006,7 +3709,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->buffer_object) return; -@@ -1339,6 +1392,16 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur +@@ -1363,6 +1416,16 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur TRACE("Created buffer object %u for texture %p, sub-resource %u.\n", sub_resource->buffer_object, texture, sub_resource_idx); @@ -4023,7 +3726,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } static void wined3d_texture_force_reload(struct wined3d_texture *texture) -@@ -1464,7 +1527,11 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -1488,7 +1551,11 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned return TRUE; case WINED3D_LOCATION_BUFFER: @@ -4035,19 +3738,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return TRUE; case WINED3D_LOCATION_TEXTURE_RGB: -@@ -1500,7 +1567,11 @@ void CDECL wined3d_texture_generate_mipmaps(struct wined3d_texture *texture) - FIXME("texture %p stub!\n", texture); - } - -+#if !defined(STAGING_CSMT) - static struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct wined3d_texture *texture, -+#else /* STAGING_CSMT */ -+struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct wined3d_texture *texture, -+#endif /* STAGING_CSMT */ - unsigned int sub_resource_idx) - { - UINT sub_count = texture->level_count * texture->layer_count; -@@ -1519,7 +1590,9 @@ static struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(str +@@ -1543,7 +1610,9 @@ static struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(str HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, UINT layer, const struct wined3d_box *dirty_region) { @@ -4057,7 +3748,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c unsigned int sub_resource_idx; TRACE("texture %p, layer %u, dirty_region %s.\n", texture, layer, debug_box(dirty_region)); -@@ -1531,6 +1604,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, +@@ -1555,6 +1624,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, } sub_resource_idx = layer * texture->level_count; @@ -4065,7 +3756,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (dirty_region) WARN("Ignoring dirty_region %s.\n", debug_box(dirty_region)); -@@ -1544,6 +1618,9 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, +@@ -1568,6 +1638,9 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, wined3d_texture_invalidate_location(texture, sub_resource_idx, ~texture->resource.map_binding); context_release(context); @@ -4075,7 +3766,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3D_OK; } -@@ -1777,7 +1854,11 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in +@@ -1801,7 +1874,11 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in } else if (sub_resource->locations & WINED3D_LOCATION_BUFFER) { @@ -4087,7 +3778,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB); wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch); texture1d_upload_data(texture, sub_resource_idx, context, NULL, &data, row_pitch, slice_pitch); -@@ -1822,7 +1903,11 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in +@@ -1846,7 +1923,11 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in case WINED3D_LOCATION_BUFFER: if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) { @@ -4099,7 +3790,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB) wined3d_texture_bind_and_dirtify(texture, context, FALSE); -@@ -2116,8 +2201,13 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) +@@ -2140,8 +2221,13 @@ static void wined3d_texture_unload(struct wined3d_resource *resource) wined3d_texture_invalidate_location(texture, i, ~WINED3D_LOCATION_DISCARDED); } @@ -4113,7 +3804,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (resource->type == WINED3D_RTYPE_TEXTURE_2D) { -@@ -2726,11 +2816,23 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 +@@ -2742,11 +2828,23 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3 TRACE("Created surface level %u, layer %u @ %p.\n", i, j, surface); @@ -4137,7 +3828,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } } } -@@ -2906,7 +3008,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2922,7 +3020,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in } else if (sub_resource->locations & WINED3D_LOCATION_BUFFER) { @@ -4149,7 +3840,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB); wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch); -@@ -2952,7 +3058,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in +@@ -2968,7 +3070,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in case WINED3D_LOCATION_BUFFER: if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) { @@ -4161,7 +3852,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB) wined3d_texture_bind_and_dirtify(texture, context, FALSE); -@@ -3486,13 +3596,49 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct +@@ -3473,13 +3579,49 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct return WINED3D_OK; } @@ -4211,7 +3902,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c TRACE("texture %p, sub_resource_idx %u, dc %p.\n", texture, sub_resource_idx, dc); -@@ -3517,6 +3663,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -3504,6 +3646,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i if (texture->resource.map_count && !(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) return WINED3DERR_INVALIDCALL; @@ -4219,7 +3910,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (device->d3d_initialized) context = context_acquire(device, NULL, 0); -@@ -3534,11 +3681,40 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i +@@ -3521,11 +3664,40 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i texture->flags |= WINED3D_TEXTURE_DC_IN_USE; ++texture->resource.map_count; ++sub_resource->map_count; @@ -4260,7 +3951,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc) -@@ -3569,6 +3745,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -3556,6 +3728,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign return WINED3DERR_INVALIDCALL; } @@ -4268,7 +3959,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if (!(texture->resource.usage & WINED3DUSAGE_OWNDC) && !(device->wined3d->flags & WINED3D_NO3D)) wined3d_surface_destroy_dc(surface); -@@ -3579,4 +3756,9 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign +@@ -3566,4 +3739,9 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign texture->flags &= ~WINED3D_TEXTURE_DC_IN_USE; return WINED3D_OK; @@ -4360,7 +4051,7 @@ diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -307,6 +307,9 @@ struct wined3d_settings +@@ -391,6 +391,9 @@ struct wined3d_settings unsigned int max_sm_ps; unsigned int max_sm_cs; BOOL no_3d; @@ -4370,7 +4061,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN; -@@ -1519,6 +1522,10 @@ struct wined3d_query +@@ -1564,6 +1567,10 @@ struct wined3d_query const void *data; DWORD data_size; const struct wined3d_query_ops *query_ops; @@ -4381,7 +4072,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; union wined3d_gl_query_object -@@ -1560,6 +1567,9 @@ struct wined3d_occlusion_query +@@ -1605,6 +1612,9 @@ struct wined3d_occlusion_query GLuint id; struct wined3d_context *context; UINT64 samples; @@ -4391,7 +4082,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_timestamp_query -@@ -2589,6 +2599,16 @@ struct wined3d_state +@@ -2591,6 +2601,16 @@ struct wined3d_state struct wined3d_rasterizer_state *rasterizer_state; }; @@ -4408,7 +4099,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h #define WINED3D_UNMAPPED_STAGE ~0u /* Multithreaded flag. Removed from the public header to signal that -@@ -2700,6 +2720,14 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL +@@ -2702,6 +2722,14 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; @@ -4423,7 +4114,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -2775,11 +2803,13 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource) +@@ -2777,11 +2805,13 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource) InterlockedDecrement(&resource->access_count); } @@ -4437,7 +4128,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void resource_cleanup(struct wined3d_resource *resource) DECLSPEC_HIDDEN; HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device, enum wined3d_resource_type type, const struct wined3d_format *format, -@@ -2890,7 +2920,11 @@ struct wined3d_texture +@@ -2892,7 +2922,11 @@ struct wined3d_texture unsigned int map_count; DWORD locations; @@ -4449,9 +4140,9 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h } sub_resources[1]; }; -@@ -2943,9 +2977,16 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, +@@ -2945,6 +2979,9 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; - BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture, + HRESULT wined3d_texture_check_box_dimensions(const struct wined3d_texture *texture, unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN; +#if defined(STAGING_CSMT) +HRESULT wined3d_texture_get_dc_cs(struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; @@ -4459,14 +4150,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN; void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_bo_address *data, DWORD locations) DECLSPEC_HIDDEN; -+#if defined(STAGING_CSMT) -+struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct wined3d_texture *texture, -+ unsigned int sub_resource_idx) DECLSPEC_HIDDEN; -+#endif /* STAGING_CSMT */ - void wined3d_texture_invalidate_location(struct wined3d_texture *texture, - unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN; - void wined3d_texture_load(struct wined3d_texture *texture, -@@ -2958,6 +2999,10 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned +@@ -2960,6 +2997,10 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; @@ -4477,7 +4161,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) DECLSPEC_HIDDEN; void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; -@@ -3065,6 +3110,11 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P +@@ -3067,6 +3108,11 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, const RECT *src_rect, UINT src_pitch, const POINT *dst_point, BOOL srgb, const struct wined3d_const_bo_address *data) DECLSPEC_HIDDEN; @@ -4489,7 +4173,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; -@@ -3192,6 +3242,7 @@ enum wined3d_push_constants +@@ -3194,6 +3240,7 @@ enum wined3d_push_constants WINED3D_PUSH_CONSTANTS_PS_B, }; @@ -4497,7 +4181,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_cs_ops { void *(*require_space)(struct wined3d_cs *cs, size_t size); -@@ -3199,6 +3250,33 @@ struct wined3d_cs_ops +@@ -3201,6 +3248,33 @@ struct wined3d_cs_ops void (*push_constants)(struct wined3d_cs *cs, enum wined3d_push_constants p, unsigned int start_idx, unsigned int count, const void *constants); }; @@ -4531,12 +4215,12 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_cs { -@@ -3209,23 +3287,75 @@ struct wined3d_cs +@@ -3211,23 +3285,75 @@ struct wined3d_cs size_t data_size, start, end; void *data; +#if !defined(STAGING_CSMT) - }; ++}; +#else /* STAGING_CSMT */ + + HANDLE thread; @@ -4551,15 +4235,15 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h + + HANDLE event; + BOOL waiting_for_event; -+}; -+ + }; + +static inline void wined3d_resource_wait_idle(struct wined3d_resource *resource) +{ + if (resource->device->cs->thread_id == GetCurrentThreadId()) return; + while (InterlockedCompareExchange(&resource->access_count, 0, 0)); +} +#endif /* STAGING_CSMT */ - ++ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HIDDEN; void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_destroy_object(struct wined3d_cs *cs, @@ -4595,11 +4279,11 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN; +#if !defined(STAGING_CSMT) -+void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN; + void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN; +#else /* STAGING_CSMT */ +void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p, + unsigned int start_idx, unsigned int count, const void *constants) DECLSPEC_HIDDEN; - void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN; ++void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN; +BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN; +HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture, + unsigned int sub_resource_idx) DECLSPEC_HIDDEN; @@ -4607,20 +4291,20 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) DECLSPEC_HIDDEN; -@@ -3273,19 +3403,37 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined +@@ -3275,10 +3401,20 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN; -+#if !defined(STAGING_CSMT) -+void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; -+#else /* STAGING_CSMT */ ++#if defined(STAGING_CSMT) +void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs, struct wined3d_texture *texture, + unsigned int sub_resource_idx, const struct wined3d_box *dirty_region) DECLSPEC_HIDDEN; +void wined3d_cs_emit_sync(struct wined3d_cs *cs); ++#endif /* STAGING_CSMT */ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, -+ unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, -+ unsigned int depth_pitch) DECLSPEC_HIDDEN; + void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, + unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, + unsigned int slice_pitch) DECLSPEC_HIDDEN; ++#if defined(STAGING_CSMT) +void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; +void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_texture *src, + struct wined3d_texture *dst) DECLSPEC_HIDDEN; @@ -4628,20 +4312,18 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_init_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) DECLSPEC_HIDDEN; HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx, - struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags) DECLSPEC_HIDDEN; +@@ -3286,12 +3422,14 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; -+#if !defined(STAGING_CSMT) ++#if !defined(STAGING_CSMT) static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p, unsigned int start_idx, unsigned int count, const void *constants) { cs->ops->push_constants(cs, p, start_idx, count, constants); } -+#else /* STAGING_CSMT */ -+void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_idx, -+ struct wined3d_stream_info *stream_info) DECLSPEC_HIDDEN; -+#endif /* STAGING_CSMT */ ++#endif /* STAGING_CSMT */ /* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other * fixed function semantics as D3DCOLOR or FLOAT16 */ + enum wined3d_buffer_conversion_type diff --git a/patches/wined3d-Revert_Buffer_Upload/0001-Revert-wined3d-Implement-wined3d_buffer_upload_data-.patch b/patches/wined3d-Revert_Buffer_Upload/0001-Revert-wined3d-Implement-wined3d_buffer_upload_data-.patch index ba73b070..e497f3d2 100644 --- a/patches/wined3d-Revert_Buffer_Upload/0001-Revert-wined3d-Implement-wined3d_buffer_upload_data-.patch +++ b/patches/wined3d-Revert_Buffer_Upload/0001-Revert-wined3d-Implement-wined3d_buffer_upload_data-.patch @@ -1,4 +1,4 @@ -From 77e96719b681f37950972bd78478c1c08a5faebc Mon Sep 17 00:00:00 2001 +From 331d0798182a0e5fab1fe59e6503d5e8597ff403 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 8 Feb 2017 19:35:36 +0100 Subject: Revert "wined3d: Implement wined3d_buffer_upload_data() on top of @@ -7,15 +7,15 @@ Subject: Revert "wined3d: Implement wined3d_buffer_upload_data() on top of This reverts commit e2dbbec1af8ae2ea8813148d56e14c8c211ee334. --- dlls/wined3d/buffer.c | 30 +++++++++++++++++++----------- - dlls/wined3d/device.c | 14 +++----------- + dlls/wined3d/cs.c | 13 +++---------- dlls/wined3d/wined3d_private.h | 2 +- - 3 files changed, 23 insertions(+), 23 deletions(-) + 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index fa3e3a7380a..5cf7b1068f9 100644 +index c584147717b..18933d1f6df 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -532,7 +532,7 @@ ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer) +@@ -525,7 +525,7 @@ ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer) /* Context activation is done by the caller. */ static void wined3d_buffer_upload_ranges(struct wined3d_buffer *buffer, struct wined3d_context *context, @@ -24,7 +24,7 @@ index fa3e3a7380a..5cf7b1068f9 100644 { const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_map_range *range; -@@ -543,7 +543,7 @@ static void wined3d_buffer_upload_ranges(struct wined3d_buffer *buffer, struct w +@@ -536,7 +536,7 @@ static void wined3d_buffer_upload_ranges(struct wined3d_buffer *buffer, struct w { range = &ranges[range_count]; GL_EXTCALL(glBufferSubData(buffer->buffer_type_hint, @@ -33,7 +33,7 @@ index fa3e3a7380a..5cf7b1068f9 100644 } checkGLcall("glBufferSubData"); } -@@ -599,7 +599,7 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined +@@ -592,7 +592,7 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined } } @@ -42,7 +42,7 @@ index fa3e3a7380a..5cf7b1068f9 100644 HeapFree(GetProcessHeap(), 0, data); } -@@ -683,7 +683,7 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, +@@ -676,7 +676,7 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, case WINED3D_LOCATION_BUFFER: if (!buffer->conversion_map) wined3d_buffer_upload_ranges(buffer, context, buffer->resource.heap_memory, @@ -51,7 +51,7 @@ index fa3e3a7380a..5cf7b1068f9 100644 else buffer_conversion_upload(buffer, context); break; -@@ -1267,23 +1267,31 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_ +@@ -1261,23 +1261,31 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_ return WINED3D_OK; } @@ -90,43 +90,37 @@ index fa3e3a7380a..5cf7b1068f9 100644 } static ULONG buffer_resource_incref(struct wined3d_resource *resource) -diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index a7ee5bc099d..a3adf3255f1 100644 ---- a/dlls/wined3d/device.c -+++ b/dlls/wined3d/device.c -@@ -4127,6 +4127,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str - if (resource->type == WINED3D_RTYPE_BUFFER) +diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c +index 9f3de815be5..39071faef32 100644 +--- a/dlls/wined3d/cs.c ++++ b/dlls/wined3d/cs.c +@@ -1669,18 +1669,11 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi + if (op->resource->type == WINED3D_RTYPE_BUFFER) { - struct wined3d_buffer *buffer = buffer_from_resource(resource); + struct wined3d_buffer *buffer = buffer_from_resource(op->resource); + HRESULT hr; - if (sub_resource_idx > 0) - { -@@ -4134,17 +4135,8 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str - return; - } - -- context = context_acquire(resource->device, NULL, 0); +- context = context_acquire(op->resource->device, NULL, 0); - if (!wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER)) - { - ERR("Failed to load buffer location.\n"); - context_release(context); -- return; +- goto done; - } -- -- wined3d_buffer_upload_data(buffer, context, box, data); -- wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER); -- context_release(context); -+ if (FAILED(hr = wined3d_buffer_upload_data(buffer, box, data))) ++ if (FAILED(hr = wined3d_buffer_upload_data(buffer, box, op->data.data))) + WARN("Failed to update buffer data, hr %#x.\n", hr); - return; +- wined3d_buffer_upload_data(buffer, context, box, op->data.data); +- wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER); +- context_release(context); + goto done; } + diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 50b7c93cad8..30de702098a 100644 +index 48f2f368d20..3883792f6fe 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3300,7 +3300,7 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, +@@ -3343,7 +3343,7 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN; HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN;