mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[dxvk] Sort buffer slices before returning them to the buffer
Buffer slices often get shuffled over time due to timing and thread synchronization, which makes it less and less likely for the dynamic uniform buffer binding optimization to be effective. Sorting the slices beforehand addresses the issue and may help CPU performance.
This commit is contained in:
parent
596001c37e
commit
1211bb5e5f
@ -1,6 +1,8 @@
|
||||
#include "dxvk_buffer.h"
|
||||
#include "dxvk_device.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
DxvkBuffer::DxvkBuffer(
|
||||
@ -222,6 +224,11 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkBufferTracker::reset() {
|
||||
std::sort(m_entries.begin(), m_entries.end(),
|
||||
[] (const Entry& a, const Entry& b) {
|
||||
return a.slice.handle < b.slice.handle;
|
||||
});
|
||||
|
||||
for (const auto& e : m_entries)
|
||||
e.buffer->freeSlice(e.slice);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user