mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-30 08:44:19 +01:00
Swap order of checking/setting region modifications in the buffer_cache
This commit is contained in:
parent
7944f271dc
commit
b3691fc33c
@ -96,12 +96,12 @@ void BufferCache<P>::TickFrame() {
|
|||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
void BufferCache<P>::WriteMemory(VAddr cpu_addr, u64 size) {
|
void BufferCache<P>::WriteMemory(VAddr cpu_addr, u64 size) {
|
||||||
memory_tracker.MarkRegionAsCpuModified(cpu_addr, size);
|
|
||||||
if (memory_tracker.IsRegionGpuModified(cpu_addr, size)) {
|
if (memory_tracker.IsRegionGpuModified(cpu_addr, size)) {
|
||||||
const IntervalType subtract_interval{cpu_addr, cpu_addr + size};
|
const IntervalType subtract_interval{cpu_addr, cpu_addr + size};
|
||||||
ClearDownload(subtract_interval);
|
ClearDownload(subtract_interval);
|
||||||
common_ranges.subtract(subtract_interval);
|
common_ranges.subtract(subtract_interval);
|
||||||
}
|
}
|
||||||
|
memory_tracker.MarkRegionAsCpuModified(cpu_addr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
@ -122,9 +122,10 @@ std::optional<VideoCore::RasterizerDownloadArea> BufferCache<P>::GetFlushArea(VA
|
|||||||
area->preemtive = true;
|
area->preemtive = true;
|
||||||
return area;
|
return area;
|
||||||
};
|
};
|
||||||
|
area->preemtive =
|
||||||
|
!IsRegionGpuModified(cpu_addr_start_aligned, cpu_addr_end_aligned - cpu_addr_start_aligned);
|
||||||
memory_tracker.MarkRegionAsPreflushable(cpu_addr_start_aligned,
|
memory_tracker.MarkRegionAsPreflushable(cpu_addr_start_aligned,
|
||||||
cpu_addr_end_aligned - cpu_addr_start_aligned);
|
cpu_addr_end_aligned - cpu_addr_start_aligned);
|
||||||
area->preemtive = !IsRegionGpuModified(cpu_addr, size);
|
|
||||||
return area;
|
return area;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1223,11 +1224,10 @@ void BufferCache<P>::UpdateComputeTextureBuffers() {
|
|||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
void BufferCache<P>::MarkWrittenBuffer(BufferId buffer_id, VAddr cpu_addr, u32 size) {
|
void BufferCache<P>::MarkWrittenBuffer(BufferId buffer_id, VAddr cpu_addr, u32 size) {
|
||||||
memory_tracker.MarkRegionAsGpuModified(cpu_addr, size);
|
|
||||||
|
|
||||||
if (memory_tracker.IsRegionCpuModified(cpu_addr, size)) {
|
if (memory_tracker.IsRegionCpuModified(cpu_addr, size)) {
|
||||||
SynchronizeBuffer(slot_buffers[buffer_id], cpu_addr, size);
|
SynchronizeBuffer(slot_buffers[buffer_id], cpu_addr, size);
|
||||||
}
|
}
|
||||||
|
memory_tracker.MarkRegionAsGpuModified(cpu_addr, size);
|
||||||
|
|
||||||
const IntervalType base_interval{cpu_addr, cpu_addr + size};
|
const IntervalType base_interval{cpu_addr, cpu_addr + size};
|
||||||
common_ranges.add(base_interval);
|
common_ranges.add(base_interval);
|
||||||
|
Loading…
Reference in New Issue
Block a user