diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-07-07 20:45:33 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-07-09 22:20:36 +0200 |
commit | f75544a9432949da4ded4566b326af28a29091ac (patch) | |
tree | c85440bdbafe8c1a9ab4eb00c1a84a326da25277 /src | |
parent | Fence Manager: Force ordering on WFI. (diff) | |
download | yuzu-f75544a9432949da4ded4566b326af28a29091ac.tar yuzu-f75544a9432949da4ded4566b326af28a29091ac.tar.gz yuzu-f75544a9432949da4ded4566b326af28a29091ac.tar.bz2 yuzu-f75544a9432949da4ded4566b326af28a29091ac.tar.lz yuzu-f75544a9432949da4ded4566b326af28a29091ac.tar.xz yuzu-f75544a9432949da4ded4566b326af28a29091ac.tar.zst yuzu-f75544a9432949da4ded4566b326af28a29091ac.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 33fa5305e..e1dc32e17 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -592,35 +592,19 @@ void BufferCache<P>::CommitAsyncFlushesHigh() { const VAddr cpu_addr_end = interval.upper(); ForEachBufferInRange(cpu_addr, size, [&](BufferId buffer_id, Buffer& buffer) { boost::container::small_vector<BufferCopy, 1> copies; - buffer.ForEachDownloadRange( - cpu_addr, size, false, [&](u64 range_offset, u64 range_size) { - VAddr cpu_addr_base = buffer.CpuAddr() + range_offset; - VAddr cpu_addr_end2 = cpu_addr_base + range_size; - const s64 difference = s64(cpu_addr_end2 - cpu_addr_end); - cpu_addr_end2 -= u64(std::max<s64>(difference, 0)); - const s64 difference2 = s64(cpu_addr - cpu_addr_base); - cpu_addr_base += u64(std::max<s64>(difference2, 0)); - const u64 new_size = cpu_addr_end2 - cpu_addr_base; - const u64 new_offset = cpu_addr_base - buffer.CpuAddr(); - downloads.push_back({ - BufferCopy{ - .src_offset = new_offset, - .dst_offset = total_size_bytes, - .size = new_size, - }, - buffer_id, - }); - total_size_bytes += new_size; - largest_copy = std::max(largest_copy, new_size); - constexpr u64 align_mask = ~(32ULL - 1); - const VAddr align_up_address = (cpu_addr_base + 31) & align_mask; - const u64 difference_base = align_up_address - cpu_addr_base; - if (difference_base > new_size) { - return; - } - const u64 fixed_size = new_size - difference_base; - buffer.UnmarkRegionAsGpuModified(align_up_address, fixed_size & align_mask); - }); + buffer.ForEachDownloadRange(cpu_addr, size, true, + [&](u64 range_offset, u64 range_size) { + downloads.push_back({ + BufferCopy{ + .src_offset = range_offset, + .dst_offset = total_size_bytes, + .size = range_size, + }, + buffer_id, + }); + total_size_bytes += range_size; + largest_copy = std::max(largest_copy, range_size); + }); }); } } |