mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-27 13:54:16 +01:00
[dxvk] Discard slices from old physical buffers
Improves effectiveness of an optimization that allows using dynamic buffer offsets for descriptor sets.
This commit is contained in:
parent
79a1703aea
commit
32cd85dc11
@ -42,11 +42,11 @@ namespace dxvk {
|
||||
// If there are still no slices available, create a new
|
||||
// physical buffer and add all slices to the free list.
|
||||
if (m_freeSlices.size() == 0) {
|
||||
const Rc<DxvkPhysicalBuffer> buffer
|
||||
= this->allocPhysicalBuffer(m_physSliceCount);
|
||||
std::unique_lock<std::mutex> swapLock(m_swapMutex);
|
||||
m_physBuffer = this->allocPhysicalBuffer(m_physSliceCount);
|
||||
|
||||
for (uint32_t i = 0; i < m_physSliceCount; i++) {
|
||||
m_freeSlices.push_back(buffer->slice(
|
||||
m_freeSlices.push_back(m_physBuffer->slice(
|
||||
m_physSliceStride * i,
|
||||
m_physSliceLength));
|
||||
}
|
||||
@ -64,7 +64,11 @@ namespace dxvk {
|
||||
void DxvkBuffer::freePhysicalSlice(const DxvkPhysicalBufferSlice& slice) {
|
||||
// Add slice to a separate free list to reduce lock contention.
|
||||
std::unique_lock<std::mutex> swapLock(m_swapMutex);
|
||||
m_nextSlices.push_back(slice);
|
||||
|
||||
// Discard slices allocated from other physical buffers.
|
||||
// This may make descriptor set binding more efficient.
|
||||
if (m_physBuffer->handle() == slice.handle())
|
||||
m_nextSlices.push_back(slice);
|
||||
}
|
||||
|
||||
|
||||
|
@ -149,6 +149,8 @@ namespace dxvk {
|
||||
VkDeviceSize m_physSliceLength = 0;
|
||||
VkDeviceSize m_physSliceStride = 0;
|
||||
VkDeviceSize m_physSliceCount = 2;
|
||||
|
||||
Rc<DxvkPhysicalBuffer> m_physBuffer;
|
||||
|
||||
Rc<DxvkPhysicalBuffer> allocPhysicalBuffer(
|
||||
VkDeviceSize sliceCount) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user