mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +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:
parent
e868f829b5
commit
7751541662
@ -236,15 +236,14 @@ namespace dxvk {
|
|||||||
std::unique_lock<sync::Spinlock> freeLock(m_freeMutex);
|
std::unique_lock<sync::Spinlock> freeLock(m_freeMutex);
|
||||||
|
|
||||||
// If no slices are available, swap the two free lists.
|
// 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::unique_lock<sync::Spinlock> swapLock(m_swapMutex);
|
||||||
std::swap(m_freeSlices, m_nextSlices);
|
std::swap(m_freeSlices, m_nextSlices);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are still no slices available, create a new
|
// If there are still no slices available, create a new
|
||||||
// backing buffer and add all slices to the free list.
|
// backing buffer and add all slices to the free list.
|
||||||
if (unlikely(m_freeSlices.size() == 0)) {
|
if (unlikely(m_freeSlices.empty())) {
|
||||||
std::unique_lock<sync::Spinlock> swapLock(m_swapMutex);
|
|
||||||
DxvkBufferHandle handle = allocBuffer(m_physSliceCount);
|
DxvkBufferHandle handle = allocBuffer(m_physSliceCount);
|
||||||
|
|
||||||
DxvkBufferSliceHandle slice;
|
DxvkBufferSliceHandle slice;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user