diff --git a/patches/d3d11-Deferred_Context/0042-d3d11-Correctly-align-map-info-buffer.patch b/patches/d3d11-Deferred_Context/0042-d3d11-Correctly-align-map-info-buffer.patch new file mode 100644 index 00000000..87bbf0e5 --- /dev/null +++ b/patches/d3d11-Deferred_Context/0042-d3d11-Correctly-align-map-info-buffer.patch @@ -0,0 +1,43 @@ +From 3fe8383d68770398720839e579de182e69b16ff5 Mon Sep 17 00:00:00 2001 +From: Kimmo Myllyvirta +Date: Sun, 27 May 2018 11:44:36 +1000 +Subject: [PATCH] d3d11: Correctly align map info buffer + +--- + dlls/d3d11/device.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c +index 745a22d91b..210f9600d2 100644 +--- a/dlls/d3d11/device.c ++++ b/dlls/d3d11/device.c +@@ -4692,6 +4692,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_Map(ID3D11DeviceContext + struct wined3d_resource *wined3d_resource; + struct wined3d_map_info map_info; + struct deferred_call *call, *previous = NULL; ++ SIZE_T align; + HRESULT hr; + + TRACE("iface %p, resource %p, subresource_idx %u, map_type %u, map_flags %#x, mapped_subresource %p.\n", +@@ -4727,7 +4728,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_Map(ID3D11DeviceContext + if (FAILED(hr)) + return hr; + +- if (!(call = add_deferred_call(context, map_info.size))) ++ align = ((sizeof(*call) + 0xf) & ~0xf) - sizeof(*call); ++ if (!(call = add_deferred_call(context, map_info.size + align))) + return E_OUTOFMEMORY; + + call->cmd = DEFERRED_MAP; +@@ -4736,7 +4738,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_deferred_context_Map(ID3D11DeviceContext + call->map_info.subresource_idx = subresource_idx; + call->map_info.map_type = map_type; + call->map_info.map_flags = map_flags; +- call->map_info.buffer = (void *)(call + 1); ++ call->map_info.buffer = (BYTE *)(call + 1) + align; + call->map_info.size = map_info.size; + + if (previous) +-- +2.17.0 + diff --git a/patches/d3d11-Deferred_Context/definition b/patches/d3d11-Deferred_Context/definition index eee30301..4668564a 100644 --- a/patches/d3d11-Deferred_Context/definition +++ b/patches/d3d11-Deferred_Context/definition @@ -1,3 +1,4 @@ Fixes: [42191] Add semi-stub for D3D11 deferred context implementation +Fixes: [44089] Correcly align the mapinfo buffer. #This is pretty dumb. -Depends: nvapi-Stub_DLL \ No newline at end of file +Depends: nvapi-Stub_DLL diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 9f528d11..48c013b9 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -3052,6 +3052,7 @@ if test "$enable_d3d11_Deferred_Context" -eq 1; then patch_apply d3d11-Deferred_Context/0039-d3d11-Implement-d3d11_deferred_context_UpdateSubreso.patch patch_apply d3d11-Deferred_Context/0040-d3d11-Implement-restoring-of-state-after-executing-a.patch patch_apply d3d11-Deferred_Context/0041-d3d11-Allow-NULL-pointer-for-initial-count-in-d3d11_.patch + patch_apply d3d11-Deferred_Context/0042-d3d11-Correctly-align-map-info-buffer.patch ( printf '%s\n' '+ { "Kimmo Myllyvirta", "d3d11: Add stub deferred rendering context.", 1 },'; printf '%s\n' '+ { "Michael Müller", "wined3d: Add wined3d_resource_map_info function.", 1 },'; @@ -3094,6 +3095,7 @@ if test "$enable_d3d11_Deferred_Context" -eq 1; then printf '%s\n' '+ { "Michael Müller", "d3d11: Implement d3d11_deferred_context_UpdateSubresource.", 1 },'; printf '%s\n' '+ { "Michael Müller", "d3d11: Implement restoring of state after executing a command list.", 1 },'; printf '%s\n' '+ { "Steve Melenchuk", "d3d11: Allow NULL pointer for initial count in d3d11_deferred_context_CSSetUnorderedAccessViews.", 1 },'; + printf '%s\n' '+ { "Kimmo Myllyvirta", "d3d11: Correctly align map info buffer.", 1 },'; ) >> "$patchlist" fi