aboutsummaryrefslogtreecommitdiff
path: root/src/core/memory.cpp
diff options
context:
space:
mode:
authorDavid <25727384+ogniK5377@users.noreply.github.com>2019-09-21 20:07:25 +1000
committerGitHub <noreply@github.com>2019-09-21 20:07:25 +1000
commit6a0425d049951b34bda48c29cd0c97aabe28440b (patch)
tree43aa0549a5cb209e311963ffb2e17f1f515d87ca /src/core/memory.cpp
parent95f4d78e870984dcae9049189d2e18f02ff9fe6b (diff)
parent22928abc70892bea7cc918bbc658f40145d6505a (diff)
Merge pull request #2872 from FernandoS27/mem-gpu-opt
Core/Memory: Only FlushAndInvalidate GPU if the page is marked as RasterizerCachedMemory
Diffstat (limited to 'src/core/memory.cpp')
-rw-r--r--src/core/memory.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index 8555691c0a..9e030789d8 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -43,8 +43,13 @@ static void MapPages(Common::PageTable& page_table, VAddr base, u64 size, u8* me
// During boot, current_page_table might not be set yet, in which case we need not flush
if (Core::System::GetInstance().IsPoweredOn()) {
- Core::System::GetInstance().GPU().FlushAndInvalidateRegion(base << PAGE_BITS,
- size * PAGE_SIZE);
+ auto& gpu = Core::System::GetInstance().GPU();
+ for (u64 i = 0; i < size; i++) {
+ const auto page = base + i;
+ if (page_table.attributes[page] == Common::PageType::RasterizerCachedMemory) {
+ gpu.FlushAndInvalidateRegion(page << PAGE_BITS, PAGE_SIZE);
+ }
+ }
}
VAddr end = base + size;