mirror of
https://github.com/yuzu-mirror/yuzu
synced 2024-11-27 21:20:19 +00:00
Memory: Always flush whole pages from surface cache
This prevents individual writes touching a cached page, but which don't overlap the surface, from constantly hitting the surface cache lookup.
This commit is contained in:
parent
ec9130de8d
commit
f2b9be9bd3
1 changed files with 10 additions and 0 deletions
|
@ -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) {
|
void RasterizerFlushRegion(PAddr start, u32 size) {
|
||||||
if (VideoCore::g_renderer != nullptr) {
|
if (VideoCore::g_renderer != nullptr) {
|
||||||
|
RoundToPages(start, size);
|
||||||
VideoCore::g_renderer->Rasterizer()->FlushRegion(start, size);
|
VideoCore::g_renderer->Rasterizer()->FlushRegion(start, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerFlushAndInvalidateRegion(PAddr start, u32 size) {
|
void RasterizerFlushAndInvalidateRegion(PAddr start, u32 size) {
|
||||||
if (VideoCore::g_renderer != nullptr) {
|
if (VideoCore::g_renderer != nullptr) {
|
||||||
|
RoundToPages(start, size);
|
||||||
VideoCore::g_renderer->Rasterizer()->FlushAndInvalidateRegion(start, size);
|
VideoCore::g_renderer->Rasterizer()->FlushAndInvalidateRegion(start, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue