1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 20:52:10 +01:00

[dxvk] Don't lock swap lock if not necessary

The swap lock only protects the 'next' free list, which
is not accessed at all when creating a new buffer.
This commit is contained in:
Philip Rebohle 2019-10-26 14:20:04 +02:00
parent e868f829b5
commit 7751541662
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -236,15 +236,14 @@ namespace dxvk {
std::unique_lock<sync::Spinlock> freeLock(m_freeMutex);
// If no slices are available, swap the two free lists.
if (unlikely(m_freeSlices.size() == 0)) {
if (unlikely(m_freeSlices.empty())) {
std::unique_lock<sync::Spinlock> swapLock(m_swapMutex);
std::swap(m_freeSlices, m_nextSlices);
}
// If there are still no slices available, create a new
// backing buffer and add all slices to the free list.
if (unlikely(m_freeSlices.size() == 0)) {
std::unique_lock<sync::Spinlock> swapLock(m_swapMutex);
if (unlikely(m_freeSlices.empty())) {
DxvkBufferHandle handle = allocBuffer(m_physSliceCount);
DxvkBufferSliceHandle slice;