Conor McCarthy : vkd3d: Lock the heap mutex while binding heap memory.
Alexandre Julliard
julliard at winehq.org
Mon Feb 14 15:40:56 CST 2022
Module: vkd3d
Branch: master
Commit: c9aea8993fc02a677cb8f2d30741d10f6e9c2b49
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=c9aea8993fc02a677cb8f2d30741d10f6e9c2b49
Author: Conor McCarthy <cmccarthy at codeweavers.com>
Date: Mon Feb 14 15:58:22 2022 +1000
vkd3d: Lock the heap mutex while binding heap memory.
Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d/resource.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c
index 7b94ac9..4c48e22 100644
--- a/libs/vkd3d/resource.c
+++ b/libs/vkd3d/resource.c
@@ -1941,11 +1941,17 @@ static HRESULT vkd3d_bind_heap_memory(struct d3d12_device *device,
goto allocate_memory;
}
+ /* Syncronisation is not required for binding, but vkMapMemory() may be called
+ * from another thread and it requires exclusive access. */
+ vkd3d_mutex_lock(&heap->mutex);
+
if (d3d12_resource_is_buffer(resource))
vr = VK_CALL(vkBindBufferMemory(vk_device, resource->u.vk_buffer, heap->vk_memory, heap_offset));
else
vr = VK_CALL(vkBindImageMemory(vk_device, resource->u.vk_image, heap->vk_memory, heap_offset));
+ vkd3d_mutex_unlock(&heap->mutex);
+
if (vr == VK_SUCCESS)
{
resource->heap = heap;
More information about the wine-cvs
mailing list