summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-03-03 02:44:02 +0100
committerbunnei <bunneidev@gmail.com>2021-03-03 02:44:02 +0100
commit6ab839462c2d109781320bc09579b1e370c16395 (patch)
treeef28523c030b5d57460794a5cdc1d6cef7ade0f3 /src/video_core
parentvideo_core: rasterizer_accelerated: Use a flat array instead of interval_map for cached pages. (diff)
downloadyuzu-6ab839462c2d109781320bc09579b1e370c16395.tar
yuzu-6ab839462c2d109781320bc09579b1e370c16395.tar.gz
yuzu-6ab839462c2d109781320bc09579b1e370c16395.tar.bz2
yuzu-6ab839462c2d109781320bc09579b1e370c16395.tar.lz
yuzu-6ab839462c2d109781320bc09579b1e370c16395.tar.xz
yuzu-6ab839462c2d109781320bc09579b1e370c16395.tar.zst
yuzu-6ab839462c2d109781320bc09579b1e370c16395.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/rasterizer_accelerated.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/video_core/rasterizer_accelerated.cpp b/src/video_core/rasterizer_accelerated.cpp
index c54b17670..f684cd7e5 100644
--- a/src/video_core/rasterizer_accelerated.cpp
+++ b/src/video_core/rasterizer_accelerated.cpp
@@ -20,9 +20,15 @@ void RasterizerAccelerated::UpdatePagesCachedCount(VAddr addr, u64 size, int del
for (auto page = addr >> Core::Memory::PAGE_BITS; page != page_end; ++page) {
auto& count = cached_pages.at(page >> 3).Count(page);
- ASSERT_MSG(count < UINT8_MAX, "Count may exceed UINT8_MAX!");
+ if (delta < 0) {
+ ASSERT_MSG(count > 0, "Count may underflow!");
+ } else if (delta > 0) {
+ ASSERT_MSG(count < UINT8_MAX, "Count may overflow!");
+ } else {
+ ASSERT_MSG(true, "Delta must be non-zero!");
+ }
- count += delta;
+ count += static_cast<s8>(delta);
// Assume delta is either -1 or 1
if (count == 0) {
@@ -31,8 +37,6 @@ void RasterizerAccelerated::UpdatePagesCachedCount(VAddr addr, u64 size, int del
} else if (count == 1 && delta > 0) {
cpu_memory.RasterizerMarkRegionCached(page << Core::Memory::PAGE_BITS,
Core::Memory::PAGE_SIZE, true);
- } else {
- ASSERT(count >= 0);
}
}
}