diff options
author | James Rowe <jroweboy@gmail.com> | 2017-09-27 00:55:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-27 00:55:47 +0200 |
commit | 5620327e0342bd908359805f396748335fba04a2 (patch) | |
tree | 04f2fdeff8af5c67c0158cc5b11073b3e09be176 /src/core | |
parent | Merge pull request #2958 from Subv/audio_buffer_datatype (diff) | |
parent | Memory/RasterizerCache: Ignore unmapped memory regions when caching physical regions. (diff) | |
download | yuzu-5620327e0342bd908359805f396748335fba04a2.tar yuzu-5620327e0342bd908359805f396748335fba04a2.tar.gz yuzu-5620327e0342bd908359805f396748335fba04a2.tar.bz2 yuzu-5620327e0342bd908359805f396748335fba04a2.tar.lz yuzu-5620327e0342bd908359805f396748335fba04a2.tar.xz yuzu-5620327e0342bd908359805f396748335fba04a2.tar.zst yuzu-5620327e0342bd908359805f396748335fba04a2.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/memory.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index a6b5f6c99..9b394f84b 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -325,8 +325,15 @@ void RasterizerMarkRegionCached(PAddr start, u32 size, int count_delta) { for (unsigned i = 0; i < num_pages; ++i, paddr += PAGE_SIZE) { boost::optional<VAddr> maybe_vaddr = PhysicalToVirtualAddress(paddr); - if (!maybe_vaddr) + // While the physical <-> virtual mapping is 1:1 for the regions supported by the cache, + // some games (like Pokemon Super Mystery Dungeon) will try to use textures that go beyond + // the end address of VRAM, causing the Virtual->Physical translation to fail when flushing + // parts of the texture. + if (!maybe_vaddr) { + LOG_ERROR(HW_Memory, + "Trying to flush a cached region to an invalid physical address %08X", paddr); continue; + } VAddr vaddr = *maybe_vaddr; u8& res_count = current_page_table->cached_res_count[vaddr >> PAGE_BITS]; @@ -338,6 +345,10 @@ void RasterizerMarkRegionCached(PAddr start, u32 size, int count_delta) { if (res_count == 0) { PageType& page_type = current_page_table->attributes[vaddr >> PAGE_BITS]; switch (page_type) { + case PageType::Unmapped: + // It is not necessary for a process to have this region mapped into its address + // space, for example, a system module need not have a VRAM mapping. + break; case PageType::Memory: page_type = PageType::RasterizerCachedMemory; current_page_table->pointers[vaddr >> PAGE_BITS] = nullptr; @@ -356,6 +367,10 @@ void RasterizerMarkRegionCached(PAddr start, u32 size, int count_delta) { if (res_count == 0) { PageType& page_type = current_page_table->attributes[vaddr >> PAGE_BITS]; switch (page_type) { + case PageType::Unmapped: + // It is not necessary for a process to have this region mapped into its address + // space, for example, a system module need not have a VRAM mapping. + break; case PageType::RasterizerCachedMemory: { u8* pointer = GetPointerFromVMA(vaddr & ~PAGE_MASK); if (pointer == nullptr) { |