diff options
| author | 2021-10-17 01:22:13 +0200 | |
|---|---|---|
| committer | 2021-11-16 22:11:31 +0100 | |
| commit | ef1dc4263586f5b81b53a5158db2c1cd2086ed4c (patch) | |
| tree | 5fc6d6b3323151961f25c557584177790ad37227 /src/video_core/texture_cache | |
| parent | vulkan: Fix rescaling push constant usage (diff) | |
| download | yuzu-ef1dc4263586f5b81b53a5158db2c1cd2086ed4c.tar.gz yuzu-ef1dc4263586f5b81b53a5158db2c1cd2086ed4c.tar.xz yuzu-ef1dc4263586f5b81b53a5158db2c1cd2086ed4c.zip | |
Texture cache: Fix memory consumption and ignore rating when a depth texture is rendered.
Diffstat (limited to 'src/video_core/texture_cache')
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 261cb6c48..c06cddae9 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -230,7 +230,8 @@ void TextureCache<P>::UpdateRenderTargets(bool is_clear) { | |||
| 230 | auto& image = slot_images[image_id]; | 230 | auto& image = slot_images[image_id]; |
| 231 | can_rescale &= ImageCanRescale(image); | 231 | can_rescale &= ImageCanRescale(image); |
| 232 | any_blacklisted |= True(image.flags & ImageFlagBits::Blacklisted); | 232 | any_blacklisted |= True(image.flags & ImageFlagBits::Blacklisted); |
| 233 | any_rescaled |= True(image.flags & ImageFlagBits::Rescaled); | 233 | any_rescaled |= True(image.flags & ImageFlagBits::Rescaled) || |
| 234 | GetFormatType(image.info.format) != SurfaceType::ColorTexture; | ||
| 234 | scale_rating = std::max<u32>(scale_rating, image.scale_tick <= frame_tick | 235 | scale_rating = std::max<u32>(scale_rating, image.scale_tick <= frame_tick |
| 235 | ? image.scale_rating + 1U | 236 | ? image.scale_rating + 1U |
| 236 | : image.scale_rating); | 237 | : image.scale_rating); |
| @@ -857,7 +858,7 @@ u64 TextureCache<P>::GetScaledImageSizeBytes(Image& image) { | |||
| 857 | const f32 add_to_size = Settings::values.resolution_info.up_factor - 1.0f; | 858 | const f32 add_to_size = Settings::values.resolution_info.up_factor - 1.0f; |
| 858 | const bool sign = std::signbit(add_to_size); | 859 | const bool sign = std::signbit(add_to_size); |
| 859 | const u32 image_size_bytes = std::max(image.guest_size_bytes, image.unswizzled_size_bytes); | 860 | const u32 image_size_bytes = std::max(image.guest_size_bytes, image.unswizzled_size_bytes); |
| 860 | const u64 tentative_size = image_size_bytes * static_cast<u32>(std::abs(add_to_size)); | 861 | const u64 tentative_size = image_size_bytes * static_cast<u64>(std::abs(add_to_size)); |
| 861 | const u64 fitted_size = Common::AlignUp(tentative_size, 1024); | 862 | const u64 fitted_size = Common::AlignUp(tentative_size, 1024); |
| 862 | return sign ? -fitted_size : fitted_size; | 863 | return sign ? -fitted_size : fitted_size; |
| 863 | } | 864 | } |
| @@ -879,7 +880,7 @@ bool TextureCache<P>::ScaleDown(Image& image) { | |||
| 879 | if (!rescaled) { | 880 | if (!rescaled) { |
| 880 | return false; | 881 | return false; |
| 881 | } | 882 | } |
| 882 | total_used_memory += GetScaledImageSizeBytes(image); | 883 | total_used_memory -= GetScaledImageSizeBytes(image); |
| 883 | InvalidateScale(image); | 884 | InvalidateScale(image); |
| 884 | return true; | 885 | return true; |
| 885 | } | 886 | } |