diff options
| author | 2021-10-06 02:02:05 -0400 | |
|---|---|---|
| committer | 2021-11-16 22:11:30 +0100 | |
| commit | f8339cd703c2e6d24477be211e1fd91a6e1ef334 (patch) | |
| tree | f02b34bbbbbabe6a5c1f4a8a7cdacbe13a39731f /src | |
| parent | video_core: Misc resolution scaling related refactoring (diff) | |
| download | yuzu-f8339cd703c2e6d24477be211e1fd91a6e1ef334.tar.gz yuzu-f8339cd703c2e6d24477be211e1fd91a6e1ef334.tar.xz yuzu-f8339cd703c2e6d24477be211e1fd91a6e1ef334.zip | |
vk_texture_cache: Fix early returns on unsupported scales
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 28 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 2 |
2 files changed, 11 insertions, 19 deletions
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 930c7d569..1ab2b1fe9 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -1130,13 +1130,19 @@ bool Image::ScaleUp() { | |||
| 1130 | return false; | 1130 | return false; |
| 1131 | } | 1131 | } |
| 1132 | ASSERT(info.type != ImageType::Linear); | 1132 | ASSERT(info.type != ImageType::Linear); |
| 1133 | flags |= ImageFlagBits::Rescaled; | ||
| 1134 | |||
| 1135 | const auto& resolution = runtime->resolution; | 1133 | const auto& resolution = runtime->resolution; |
| 1136 | if (!resolution.active) { | 1134 | if (!resolution.active) { |
| 1137 | return true; | 1135 | return false; |
| 1138 | } | 1136 | } |
| 1139 | const auto& device = runtime->device; | 1137 | const auto& device = runtime->device; |
| 1138 | const PixelFormat format = StorageFormat(info.format); | ||
| 1139 | const auto format_info = MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, format); | ||
| 1140 | const auto similar = device.GetSupportedFormat( | ||
| 1141 | format_info.format, (VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT), | ||
| 1142 | FormatType::Optimal); | ||
| 1143 | if (similar != format_info.format) { | ||
| 1144 | return true; | ||
| 1145 | } | ||
| 1140 | if (!scaled_image) { | 1146 | if (!scaled_image) { |
| 1141 | const u32 up = resolution.up_scale; | 1147 | const u32 up = resolution.up_scale; |
| 1142 | const u32 down = resolution.down_shift; | 1148 | const u32 down = resolution.down_shift; |
| @@ -1155,23 +1161,9 @@ bool Image::ScaleUp() { | |||
| 1155 | if (aspect_mask == 0) { | 1161 | if (aspect_mask == 0) { |
| 1156 | aspect_mask = ImageAspectMask(info.format); | 1162 | aspect_mask = ImageAspectMask(info.format); |
| 1157 | } | 1163 | } |
| 1158 | if (info.num_samples > 1) { | ||
| 1159 | return true; | ||
| 1160 | } | ||
| 1161 | const PixelFormat format = StorageFormat(info.format); | ||
| 1162 | const auto format_info = MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, format); | ||
| 1163 | const auto similar = device.GetSupportedFormat( | ||
| 1164 | format_info.format, (VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT), | ||
| 1165 | FormatType::Optimal); | ||
| 1166 | |||
| 1167 | if (similar != format_info.format) { | ||
| 1168 | return true; | ||
| 1169 | } | ||
| 1170 | if (aspect_mask == 0) { | ||
| 1171 | aspect_mask = ImageAspectMask(info.format); | ||
| 1172 | } | ||
| 1173 | BlitScale(*scheduler, *original_image, *scaled_image, info, aspect_mask, resolution, true); | 1164 | BlitScale(*scheduler, *original_image, *scaled_image, info, aspect_mask, resolution, true); |
| 1174 | current_image = *scaled_image; | 1165 | current_image = *scaled_image; |
| 1166 | flags |= ImageFlagBits::Rescaled; | ||
| 1175 | return true; | 1167 | return true; |
| 1176 | } | 1168 | } |
| 1177 | 1169 | ||
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 630c73005..de522cc43 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -857,7 +857,7 @@ u64 TextureCache<P>::GetScaledImageSizeBytes(Image& image) { | |||
| 857 | const f32 add_to_size = Settings::values.resolution_info.up_factor - 1.0f; | 857 | const f32 add_to_size = Settings::values.resolution_info.up_factor - 1.0f; |
| 858 | const bool sign = std::signbit(add_to_size); | 858 | const bool sign = std::signbit(add_to_size); |
| 859 | const u32 image_size_bytes = std::max(image.guest_size_bytes, image.unswizzled_size_bytes); | 859 | const u32 image_size_bytes = std::max(image.guest_size_bytes, image.unswizzled_size_bytes); |
| 860 | const u64 tentative_size = static_cast<u64>(image_size_bytes * std::abs(add_to_size)); | 860 | const u64 tentative_size = image_size_bytes * static_cast<u32>(std::abs(add_to_size)); |
| 861 | const u64 fitted_size = Common::AlignUp(tentative_size, 1024); | 861 | const u64 fitted_size = Common::AlignUp(tentative_size, 1024); |
| 862 | return sign ? -fitted_size : fitted_size; | 862 | return sign ? -fitted_size : fitted_size; |
| 863 | } | 863 | } |