diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-01-21 23:08:15 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-01-21 23:16:05 +0100 |
commit | dd790abab00379c232ea508fc43e87bd05d003f6 (patch) | |
tree | bb1225fbebd8ef6981b35d300a55881b13a9387a /src/video_core/memory_manager.cpp | |
parent | Merge pull request #5755 from FearlessTobi/port-5344 (diff) | |
download | yuzu-dd790abab00379c232ea508fc43e87bd05d003f6.tar yuzu-dd790abab00379c232ea508fc43e87bd05d003f6.tar.gz yuzu-dd790abab00379c232ea508fc43e87bd05d003f6.tar.bz2 yuzu-dd790abab00379c232ea508fc43e87bd05d003f6.tar.lz yuzu-dd790abab00379c232ea508fc43e87bd05d003f6.tar.xz yuzu-dd790abab00379c232ea508fc43e87bd05d003f6.tar.zst yuzu-dd790abab00379c232ea508fc43e87bd05d003f6.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/memory_manager.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index 65feff588..1926bb025 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp @@ -314,6 +314,21 @@ void MemoryManager::WriteBlockUnsafe(GPUVAddr gpu_dest_addr, const void* src_buf } } +void MemoryManager::FlushRegion(GPUVAddr gpu_addr, size_t size) const { + size_t remaining_size{size}; + size_t page_index{gpu_addr >> page_bits}; + size_t page_offset{gpu_addr & page_mask}; + while (remaining_size > 0) { + const size_t num_bytes{std::min(page_size - page_offset, remaining_size)}; + if (const auto page_addr{GpuToCpuAddress(page_index << page_bits)}; page_addr) { + rasterizer->FlushRegion(*page_addr + page_offset, num_bytes); + } + ++page_index; + page_offset = 0; + remaining_size -= num_bytes; + } +} + void MemoryManager::CopyBlock(GPUVAddr gpu_dest_addr, GPUVAddr gpu_src_addr, std::size_t size) { std::vector<u8> tmp_buffer(size); ReadBlock(gpu_src_addr, tmp_buffer.data(), size); |