Don't sync entire buffers

This commit is contained in:
Lander Gallastegi 2025-05-17 23:17:20 +02:00
parent ec391a4739
commit 63055efdd4

View File

@ -916,12 +916,10 @@ void BufferCache::SynchronizeBuffersInRange(VAddr device_addr, u64 size) {
VAddr device_addr_end = device_addr + size; VAddr device_addr_end = device_addr + size;
ForEachBufferInRange(device_addr, size, [&](BufferId buffer_id, Buffer& buffer) { ForEachBufferInRange(device_addr, size, [&](BufferId buffer_id, Buffer& buffer) {
RENDERER_TRACE; RENDERER_TRACE;
// Note that this function synchronizes the whole buffer, not just the range. VAddr start = std::max(buffer.CpuAddr(), device_addr);
// This is because this function is used to sync buffers before using a VAddr end = std::min(buffer.CpuAddr() + buffer.SizeBytes(), device_addr_end);
// shader that uses DMA. u32 size = static_cast<u32>(end - start);
// The ideal solution would be to sync all the mapped regions but it is SynchronizeBuffer(buffer, start, size, false);
// very slow.
SynchronizeBuffer(buffer, buffer.CpuAddr(), buffer.SizeBytes(), false);
}); });
} }