1
0
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:
Philip Rebohle 2019-11-23 00:32:05 +01:00
parent 596001c37e
commit 1211bb5e5f
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -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);