aboutsummaryrefslogtreecommitdiff
path: root/src/core/memory.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2016-12-15 11:33:57 -0500
committerGitHub <noreply@github.com>2016-12-15 11:33:57 -0500
commit8d0794d406fb505d168ea47606826aee6e4aaf09 (patch)
tree9b13959bffec5fd7d65527551f2076eb8e9c985c /src/core/memory.cpp
parent37ca07cd2f9cc80de33dc70001c621771c30b11a (diff)
parent415064165a4866515a03ad91d8402b973c81866f (diff)
Merge pull request #2321 from yuriks/flush-pages
Memory: Always flush whole pages from surface cache
Diffstat (limited to 'src/core/memory.cpp')
-rw-r--r--src/core/memory.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index 65e4bba854..d058dc8444 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -357,14 +357,24 @@ void RasterizerMarkRegionCached(PAddr start, u32 size, int count_delta) {
}
}
+static void RoundToPages(PAddr& start, u32& size) {
+ PAddr start_rounded_down = start & ~PAGE_MASK;
+ PAddr end_rounded_up = ((start + size) + PAGE_MASK) & ~PAGE_MASK;
+
+ start = start_rounded_down;
+ size = end_rounded_up - start_rounded_down;
+}
+
void RasterizerFlushRegion(PAddr start, u32 size) {
if (VideoCore::g_renderer != nullptr) {
+ RoundToPages(start, size);
VideoCore::g_renderer->Rasterizer()->FlushRegion(start, size);
}
}
void RasterizerFlushAndInvalidateRegion(PAddr start, u32 size) {
if (VideoCore::g_renderer != nullptr) {
+ RoundToPages(start, size);
VideoCore::g_renderer->Rasterizer()->FlushAndInvalidateRegion(start, size);
}
}