From df36026633a4f0949e2893638e481c829ac53247 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Wed, 8 Feb 2023 14:13:06 +0100 Subject: [PATCH] vkd3d: Do not read max_pending_value without holding the fence's mutex. --- libs/vkd3d/command.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 45620e86..9cf35831 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -6801,13 +6801,14 @@ static bool d3d12_command_queue_flush_ops(struct d3d12_command_queue *queue, boo { case VKD3D_CS_OP_WAIT: fence = op->u.wait.fence; + vkd3d_mutex_lock(&fence->mutex); if (op->u.wait.value > fence->max_pending_value) { + vkd3d_mutex_unlock(&fence->mutex); queue->ops_count -= i; memmove(queue->ops, op, queue->ops_count * sizeof(*op)); goto done; } - vkd3d_mutex_lock(&fence->mutex); d3d12_command_queue_wait_locked(queue, fence, op->u.wait.value); d3d12_fence_decref(fence); break;