mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-27 06:20:07 +00:00
Texture Cache: Fix calculations when scaling.
This commit is contained in:
parent
e0a3830855
commit
237a43004f
@ -858,6 +858,12 @@ bool TextureCache<P>::ScaleUp(Image& image) {
|
|||||||
if (!rescaled) {
|
if (!rescaled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const auto& add_to_size = Settings::values.resolution_info.up_factor - 1.0f;
|
||||||
|
const auto sign = std::signbit(add_to_size);
|
||||||
|
const u64 tentative_size = static_cast<u64>(
|
||||||
|
std::max(image.guest_size_bytes, image.unswizzled_size_bytes) * std::abs(add_to_size));
|
||||||
|
const u64 fitted_size = Common::AlignUp(tentative_size, 1024);
|
||||||
|
total_used_memory += sign ? -fitted_size : fitted_size;
|
||||||
InvalidateScale(image);
|
InvalidateScale(image);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -868,6 +874,12 @@ bool TextureCache<P>::ScaleDown(Image& image) {
|
|||||||
if (!rescaled) {
|
if (!rescaled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const auto& add_to_size = Settings::values.resolution_info.up_factor - 1.0f;
|
||||||
|
const auto sign = std::signbit(add_to_size);
|
||||||
|
const u64 tentative_size = static_cast<u64>(
|
||||||
|
std::max(image.guest_size_bytes, image.unswizzled_size_bytes) * std::abs(add_to_size));
|
||||||
|
const u64 fitted_size = Common::AlignUp(tentative_size, 1024);
|
||||||
|
total_used_memory += sign ? fitted_size : -fitted_size;
|
||||||
InvalidateScale(image);
|
InvalidateScale(image);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user