From b1ae935f114e1011b19d4ada352c401e6655279a Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Tue, 12 Oct 2021 00:54:28 -0400 Subject: [PATCH] vk_texture_cache: Fix BlitScale of non-2D images --- .../renderer_vulkan/vk_texture_cache.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index caefce5fc..ccfdf64ea 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -592,9 +592,8 @@ struct RangedBarrierRange { } void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, const ImageInfo& info, - VkImageAspectFlags aspect_mask, const Settings::ResolutionScalingInfo& resolution, - bool scaling) { - const auto type = info.type; + VkImageAspectFlags aspect_mask, const Settings::ResolutionScalingInfo& resolution) { + const bool is_2d = info.type == ImageType::e2D; const auto resources = info.resources; const VkExtent2D extent{ .width = info.size.width, @@ -605,15 +604,15 @@ void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, con const VkFilter vk_filter = (is_zeta || is_int_format) ? VK_FILTER_NEAREST : VK_FILTER_LINEAR; scheduler.RequestOutsideRenderPassOperationContext(); - scheduler.Record([dst_image, src_image, extent, resources, aspect_mask, resolution, type, - scaling, vk_filter](vk::CommandBuffer cmdbuf) { + scheduler.Record([dst_image, src_image, extent, resources, aspect_mask, resolution, is_2d, + vk_filter](vk::CommandBuffer cmdbuf) { const VkOffset2D src_size{ - .x = static_cast(scaling ? extent.width : resolution.ScaleUp(extent.width)), - .y = static_cast(scaling ? extent.height : resolution.ScaleUp(extent.height)), + .x = static_cast(extent.width), + .y = static_cast(extent.height), }; const VkOffset2D dst_size{ - .x = static_cast(scaling ? resolution.ScaleUp(extent.width) : extent.width), - .y = static_cast(scaling ? resolution.ScaleUp(extent.height) : extent.height), + .x = static_cast(resolution.ScaleUp(extent.width)), + .y = static_cast(is_2d ? resolution.ScaleUp(extent.height) : extent.height), }; boost::container::small_vector regions; regions.reserve(resources.levels); @@ -1154,7 +1153,7 @@ bool Image::ScaleUp() { if (aspect_mask == 0) { aspect_mask = ImageAspectMask(info.format); } - BlitScale(*scheduler, *original_image, *scaled_image, info, aspect_mask, resolution, true); + BlitScale(*scheduler, *original_image, *scaled_image, info, aspect_mask, resolution); current_image = *scaled_image; flags |= ImageFlagBits::Rescaled; return true;