|
|
@ -18,10 +18,10 @@ RasterizerAccelerated::~RasterizerAccelerated() = default;
|
|
|
|
void RasterizerAccelerated::UpdatePagesCachedCount(VAddr addr, u64 size, int delta) {
|
|
|
|
void RasterizerAccelerated::UpdatePagesCachedCount(VAddr addr, u64 size, int delta) {
|
|
|
|
const auto page_end = Common::DivCeil(addr + size, Core::Memory::PAGE_SIZE);
|
|
|
|
const auto page_end = Common::DivCeil(addr + size, Core::Memory::PAGE_SIZE);
|
|
|
|
for (auto page = addr >> Core::Memory::PAGE_BITS; page != page_end; ++page) {
|
|
|
|
for (auto page = addr >> Core::Memory::PAGE_BITS; page != page_end; ++page) {
|
|
|
|
auto& count = cached_pages.at(page >> 3).Count(page);
|
|
|
|
auto& count = cached_pages.at(page >> 2).Count(page);
|
|
|
|
|
|
|
|
|
|
|
|
if (delta > 0) {
|
|
|
|
if (delta > 0) {
|
|
|
|
ASSERT_MSG(count < UINT8_MAX, "Count may overflow!");
|
|
|
|
ASSERT_MSG(count < UINT16_MAX, "Count may overflow!");
|
|
|
|
} else if (delta < 0) {
|
|
|
|
} else if (delta < 0) {
|
|
|
|
ASSERT_MSG(count > 0, "Count may underflow!");
|
|
|
|
ASSERT_MSG(count > 0, "Count may underflow!");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -29,7 +29,7 @@ void RasterizerAccelerated::UpdatePagesCachedCount(VAddr addr, u64 size, int del
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Adds or subtracts 1, as count is a unsigned 8-bit value
|
|
|
|
// Adds or subtracts 1, as count is a unsigned 8-bit value
|
|
|
|
count += static_cast<u8>(delta);
|
|
|
|
count += static_cast<u16>(delta);
|
|
|
|
|
|
|
|
|
|
|
|
// Assume delta is either -1 or 1
|
|
|
|
// Assume delta is either -1 or 1
|
|
|
|
if (count == 0) {
|
|
|
|
if (count == 0) {
|
|
|
|