vkd3d: Do not read blocked_queue_count without holding the device mutex.

This commit is contained in:
Giovanni Mascellani 2023-02-08 12:55:05 +01:00 committed by Alexandre Julliard
parent 240b2f966f
commit e076fd9c77
Notes: Alexandre Julliard 2023-02-13 22:20:19 +01:00
Approved-by: Conor McCarthy (@cmccarthy)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/87

View File

@ -642,6 +642,9 @@ static HRESULT d3d12_device_add_blocked_command_queues(struct d3d12_device *devi
HRESULT hr = S_OK;
unsigned int i;
if (count == 0)
return S_OK;
vkd3d_mutex_lock(&device->mutex);
if ((i = ARRAY_SIZE(device->blocked_queues) - device->blocked_queue_count) < count)
@ -697,8 +700,6 @@ static HRESULT d3d12_device_flush_blocked_queues(struct d3d12_device *device)
/* Executing an op on one queue may unblock another, so repeat until nothing is flushed. */
do
{
if (!device->blocked_queue_count)
return S_OK;
if (FAILED(hr = d3d12_device_flush_blocked_queues_once(device, &flushed_any)))
return hr;
}