[PATCH] wined3d: Check for failure from wined3d_device_context_require_space() in wined3d_device_context_emit_unmap().
Zebediah Figura
zfigura at codeweavers.com
Mon Jul 26 12:41:37 CDT 2021
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51485
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
dlls/d3d11/tests/d3d11.c | 14 ++++++++++++++
dlls/wined3d/cs.c | 3 ++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index f85646050e7..50801064694 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -33104,6 +33104,20 @@ static void test_deferred_context_map(void)
ID3D11CommandList_Release(list);
+ /* Dead Rising unmaps a resource on the wrong context. */
+
+ hr = ID3D11DeviceContext_Map(immediate, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map_desc);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ ID3D11DeviceContext_Unmap(deferred, (ID3D11Resource *)buffer, 0);
+
+ hr = ID3D11DeviceContext_Map(immediate, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map_desc);
+ todo_wine ok(hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr);
+ if (hr == S_OK)
+ ID3D11DeviceContext_Unmap(immediate, (ID3D11Resource *)buffer, 0);
+
+ ID3D11DeviceContext_Unmap(immediate, (ID3D11Resource *)buffer, 0);
+
/* Test WRITE_NO_OVERWRITE. */
hr = ID3D11DeviceContext_Map(immediate, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map_desc);
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 13c0fce5bb1..51e5055c4ab 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2520,7 +2520,8 @@ HRESULT wined3d_device_context_emit_unmap(struct wined3d_device_context *context
wined3d_not_from_cs(context->device->cs);
- op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_MAP);
+ if (!(op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_MAP)))
+ return E_OUTOFMEMORY;
op->opcode = WINED3D_CS_OP_UNMAP;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
--
2.30.2
More information about the wine-devel
mailing list