diff options
| author | 2021-10-03 22:42:29 +0200 | |
|---|---|---|
| committer | 2021-11-16 22:11:30 +0100 | |
| commit | 237a43004fb27a273495a0b44515cf7389dea553 (patch) | |
| tree | 10eb6f87cc587f9a440212685f2234f75600505d /src/video_core | |
| parent | gl_texture_cache: Fix BGR pbo size for scaled textures (diff) | |
| download | yuzu-237a43004fb27a273495a0b44515cf7389dea553.tar.gz yuzu-237a43004fb27a273495a0b44515cf7389dea553.tar.xz yuzu-237a43004fb27a273495a0b44515cf7389dea553.zip | |
Texture Cache: Fix calculations when scaling.
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index b60f840c1..691198853 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -858,6 +858,12 @@ bool TextureCache<P>::ScaleUp(Image& image) { | |||
| 858 | if (!rescaled) { | 858 | if (!rescaled) { |
| 859 | return false; | 859 | return false; |
| 860 | } | 860 | } |
| 861 | const auto& add_to_size = Settings::values.resolution_info.up_factor - 1.0f; | ||
| 862 | const auto sign = std::signbit(add_to_size); | ||
| 863 | const u64 tentative_size = static_cast<u64>( | ||
| 864 | std::max(image.guest_size_bytes, image.unswizzled_size_bytes) * std::abs(add_to_size)); | ||
| 865 | const u64 fitted_size = Common::AlignUp(tentative_size, 1024); | ||
| 866 | total_used_memory += sign ? -fitted_size : fitted_size; | ||
| 861 | InvalidateScale(image); | 867 | InvalidateScale(image); |
| 862 | return true; | 868 | return true; |
| 863 | } | 869 | } |
| @@ -868,6 +874,12 @@ bool TextureCache<P>::ScaleDown(Image& image) { | |||
| 868 | if (!rescaled) { | 874 | if (!rescaled) { |
| 869 | return false; | 875 | return false; |
| 870 | } | 876 | } |
| 877 | const auto& add_to_size = Settings::values.resolution_info.up_factor - 1.0f; | ||
| 878 | const auto sign = std::signbit(add_to_size); | ||
| 879 | const u64 tentative_size = static_cast<u64>( | ||
| 880 | std::max(image.guest_size_bytes, image.unswizzled_size_bytes) * std::abs(add_to_size)); | ||
| 881 | const u64 fitted_size = Common::AlignUp(tentative_size, 1024); | ||
| 882 | total_used_memory += sign ? fitted_size : -fitted_size; | ||
| 871 | InvalidateScale(image); | 883 | InvalidateScale(image); |
| 872 | return true; | 884 | return true; |
| 873 | } | 885 | } |