diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2022-02-19 14:18:02 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2022-10-06 21:00:53 +0200 |
commit | 5a568b1655f0d721891083da19e2da2614796389 (patch) | |
tree | 540d2c564bf84114484188000a871e90cf5e7772 /src | |
parent | Shader Decompiler: implement better tracking for Vulkan samplers. (diff) | |
download | yuzu-5a568b1655f0d721891083da19e2da2614796389.tar yuzu-5a568b1655f0d721891083da19e2da2614796389.tar.gz yuzu-5a568b1655f0d721891083da19e2da2614796389.tar.bz2 yuzu-5a568b1655f0d721891083da19e2da2614796389.tar.lz yuzu-5a568b1655f0d721891083da19e2da2614796389.tar.xz yuzu-5a568b1655f0d721891083da19e2da2614796389.tar.zst yuzu-5a568b1655f0d721891083da19e2da2614796389.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/memory.cpp | 9 | ||||
-rw-r--r-- | src/core/memory.h | 1 | ||||
-rw-r--r-- | src/video_core/memory_manager.cpp | 12 |
3 files changed, 18 insertions, 4 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 34ad7cadd..2ac792566 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -551,6 +551,11 @@ struct Memory::Impl { []() {}); } + [[nodiscard]] u8* GetPointerSilent(const VAddr vaddr) const { + return GetPointerImpl( + vaddr, []() {}, []() {}); + } + /** * Reads a particular data type out of memory at the given virtual address. * @@ -686,6 +691,10 @@ u8* Memory::GetPointer(VAddr vaddr) { return impl->GetPointer(vaddr); } +u8* Memory::GetPointerSilent(VAddr vaddr) { + return impl->GetPointerSilent(vaddr); +} + const u8* Memory::GetPointer(VAddr vaddr) const { return impl->GetPointer(vaddr); } diff --git a/src/core/memory.h b/src/core/memory.h index a11ff8766..81eac448b 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -114,6 +114,7 @@ public: * If the address is not valid, nullptr will be returned. */ u8* GetPointer(VAddr vaddr); + u8* GetPointerSilent(VAddr vaddr); template <typename T> T* GetPointer(VAddr vaddr) { diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index e1a8b5391..0f97db272 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp @@ -134,11 +134,15 @@ GPUVAddr MemoryManager::BigPageTableOp(GPUVAddr gpu_addr, [[maybe_unused]] VAddr big_page_table_cpu[index] = sub_value; const bool is_continous = ([&] { uintptr_t base_ptr{ - reinterpret_cast<uintptr_t>(memory.GetPointer(current_cpu_addr))}; + reinterpret_cast<uintptr_t>(memory.GetPointerSilent(current_cpu_addr))}; + if (base_ptr == 0) { + return false; + } for (VAddr start_cpu = current_cpu_addr + page_size; start_cpu < current_cpu_addr + big_page_size; start_cpu += page_size) { base_ptr += page_size; - if (base_ptr != reinterpret_cast<uintptr_t>(memory.GetPointer(start_cpu))) { + auto next_ptr = reinterpret_cast<uintptr_t>(memory.GetPointerSilent(start_cpu)); + if (next_ptr == 0 || base_ptr != next_ptr) { return false; } } @@ -359,7 +363,7 @@ void MemoryManager::ReadBlockImpl(GPUVAddr gpu_src_addr, void* dest_buffer, if constexpr (is_safe) { rasterizer->FlushRegion(cpu_addr_base, copy_amount); } - if (!IsBigPageContinous(page_index)) { + if (!IsBigPageContinous(page_index)) [[unlikely]] { memory.ReadBlockUnsafe(cpu_addr_base, dest_buffer, copy_amount); } else { u8* physical = memory.GetPointer(cpu_addr_base); @@ -407,7 +411,7 @@ void MemoryManager::WriteBlockImpl(GPUVAddr gpu_dest_addr, const void* src_buffe if constexpr (is_safe) { rasterizer->InvalidateRegion(cpu_addr_base, copy_amount); } - if (!IsBigPageContinous(page_index)) { + if (!IsBigPageContinous(page_index)) [[unlikely]] { memory.WriteBlockUnsafe(cpu_addr_base, src_buffer, copy_amount); } else { u8* physical = memory.GetPointer(cpu_addr_base); |