mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 20:52:10 +01:00
[dxvk] Limit maximum size of multi-slice buffers
Reduces memory fragmentation caused by frequently renamed buffers.
This commit is contained in:
parent
d8e31f221f
commit
acf6c27e76
@ -16,6 +16,13 @@ namespace dxvk {
|
||||
// we don't violate any Vulkan alignment requirements
|
||||
m_physSliceLength = createInfo.size;
|
||||
m_physSliceStride = align(createInfo.size, 256);
|
||||
|
||||
// Limit size of multi-slice buffers to reduce fragmentation
|
||||
constexpr VkDeviceSize MaxBufferSize = 4 << 20;
|
||||
|
||||
m_physSliceMaxCount = MaxBufferSize >= m_physSliceStride
|
||||
? MaxBufferSize / m_physSliceStride
|
||||
: 1;
|
||||
|
||||
// Allocate a single buffer slice
|
||||
m_buffer = allocBuffer(1);
|
||||
|
@ -257,7 +257,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
m_buffers.push_back(std::move(handle));
|
||||
m_physSliceCount *= 2;
|
||||
m_physSliceCount = std::min(m_physSliceCount * 2, m_physSliceMaxCount);
|
||||
}
|
||||
|
||||
// Take the first slice from the queue
|
||||
@ -299,9 +299,10 @@ namespace dxvk {
|
||||
std::vector<DxvkBufferSliceHandle> m_freeSlices;
|
||||
std::vector<DxvkBufferSliceHandle> m_nextSlices;
|
||||
|
||||
VkDeviceSize m_physSliceLength = 0;
|
||||
VkDeviceSize m_physSliceStride = 0;
|
||||
VkDeviceSize m_physSliceCount = 2;
|
||||
VkDeviceSize m_physSliceLength = 0;
|
||||
VkDeviceSize m_physSliceStride = 0;
|
||||
VkDeviceSize m_physSliceCount = 1;
|
||||
VkDeviceSize m_physSliceMaxCount = 1;
|
||||
|
||||
DxvkBufferHandle allocBuffer(
|
||||
VkDeviceSize sliceCount) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user