summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2021-07-27 01:46:15 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2021-11-16 22:11:28 +0100
commit48d81506a32deb019dc65cd8099be290a392fd8d (patch)
tree702849edf8d15d0742dc902b3937bafe34a1e0f2 /src/video_core/renderer_vulkan
parentTexture Cache: Implement Rating System. (diff)
downloadyuzu-48d81506a32deb019dc65cd8099be290a392fd8d.tar
yuzu-48d81506a32deb019dc65cd8099be290a392fd8d.tar.gz
yuzu-48d81506a32deb019dc65cd8099be290a392fd8d.tar.bz2
yuzu-48d81506a32deb019dc65cd8099be290a392fd8d.tar.lz
yuzu-48d81506a32deb019dc65cd8099be290a392fd8d.tar.xz
yuzu-48d81506a32deb019dc65cd8099be290a392fd8d.tar.zst
yuzu-48d81506a32deb019dc65cd8099be290a392fd8d.zip
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/vk_texture_cache.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
index 575f12566..b21992fce 100644
--- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
@@ -595,7 +595,8 @@ struct RangedBarrierRange {
}
void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, const ImageInfo& info,
- VkImageAspectFlags aspect_mask, const Settings::ResolutionScalingInfo& resolution) {
+ VkImageAspectFlags aspect_mask, const Settings::ResolutionScalingInfo& resolution,
+ bool scaling) {
const auto type = info.type;
const auto resources = info.resources;
const VkExtent2D extent{
@@ -603,15 +604,18 @@ void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, con
.height = info.size.height,
};
scheduler.RequestOutsideRenderPassOperationContext();
- scheduler.Record([dst_image, src_image, extent, resources, aspect_mask, resolution,
- type](vk::CommandBuffer cmdbuf) {
+ scheduler.Record([dst_image, src_image, extent, resources, aspect_mask, resolution, type,
+ scaling](vk::CommandBuffer cmdbuf) {
const auto scale_up = [&](u32 value) {
return std::max<u32>((value * resolution.up_scale) >> resolution.down_shift, 1U);
};
- const bool is_2d = type == ImageType::e2D;
- const VkOffset2D mip0_size{
- .x = static_cast<s32>(scale_up(extent.width)),
- .y = static_cast<s32>(is_2d ? scale_up(extent.height) : extent.height),
+ const VkOffset2D src_size{
+ .x = static_cast<s32>(scaling ? extent.width : scale_up(extent.width)),
+ .y = static_cast<s32>(scaling ? extent.height : scale_up(extent.height)),
+ };
+ const VkOffset2D dst_size{
+ .x = static_cast<s32>(scaling ? scale_up(extent.width) : extent.width),
+ .y = static_cast<s32>(scaling ? scale_up(extent.height) : extent.height),
};
boost::container::small_vector<VkImageBlit, 4> regions;
regions.reserve(resources.levels);
@@ -630,8 +634,8 @@ void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, con
.z = 0,
},
{
- .x = std::max(1, static_cast<s32>(extent.width) >> level),
- .y = std::max(1, static_cast<s32>(extent.height) >> level),
+ .x = std::max(1, src_size.x >> level),
+ .y = std::max(1, src_size.y >> level),
.z = 1,
},
},
@@ -648,8 +652,8 @@ void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, con
.z = 0,
},
{
- .x = std::max(1, mip0_size.x >> level),
- .y = std::max(1, mip0_size.y >> level),
+ .x = std::max(1, dst_size.x >> level),
+ .y = std::max(1, dst_size.y >> level),
.z = 1,
},
},
@@ -1157,7 +1161,7 @@ bool Image::ScaleUp(bool save_as_backup) {
if (aspect_mask == 0) {
aspect_mask = ImageAspectMask(info.format);
}
- BlitScale(*scheduler, *image, *rescaled_image, info, aspect_mask, resolution);
+ BlitScale(*scheduler, *image, *rescaled_image, info, aspect_mask, resolution, true);
return true;
}
@@ -1184,14 +1188,14 @@ bool Image::ScaleDown(bool save_as_backup) {
const auto& resolution = runtime->resolution;
vk::Image downscaled_image =
- MakeImage(runtime->device, info, resolution.up_scale, resolution.down_shift);
+ MakeImage(runtime->device, info);
MemoryCommit new_commit(
runtime->memory_allocator.Commit(downscaled_image, MemoryUsage::DeviceLocal));
if (aspect_mask == 0) {
aspect_mask = ImageAspectMask(info.format);
}
- BlitScale(*scheduler, *image, *downscaled_image, info, aspect_mask, resolution);
+ BlitScale(*scheduler, *image, *downscaled_image, info, aspect_mask, resolution, false);
if (save_as_backup) {
backup_image = std::move(image);