diff options
| author | 2021-10-12 00:54:28 -0400 | |
|---|---|---|
| committer | 2021-11-16 22:11:31 +0100 | |
| commit | b1ae935f114e1011b19d4ada352c401e6655279a (patch) | |
| tree | 65047ea2ac1816d0292df89a20e974445dfb8bc9 /src | |
| parent | video_core: Refactor resolution scale function (diff) | |
| download | yuzu-b1ae935f114e1011b19d4ada352c401e6655279a.tar.gz yuzu-b1ae935f114e1011b19d4ada352c401e6655279a.tar.xz yuzu-b1ae935f114e1011b19d4ada352c401e6655279a.zip | |
vk_texture_cache: Fix BlitScale of non-2D images
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 19 |
1 files 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 { | |||
| 592 | } | 592 | } |
| 593 | 593 | ||
| 594 | void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, const ImageInfo& info, | 594 | void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, const ImageInfo& info, |
| 595 | VkImageAspectFlags aspect_mask, const Settings::ResolutionScalingInfo& resolution, | 595 | VkImageAspectFlags aspect_mask, const Settings::ResolutionScalingInfo& resolution) { |
| 596 | bool scaling) { | 596 | const bool is_2d = info.type == ImageType::e2D; |
| 597 | const auto type = info.type; | ||
| 598 | const auto resources = info.resources; | 597 | const auto resources = info.resources; |
| 599 | const VkExtent2D extent{ | 598 | const VkExtent2D extent{ |
| 600 | .width = info.size.width, | 599 | .width = info.size.width, |
| @@ -605,15 +604,15 @@ void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, con | |||
| 605 | const VkFilter vk_filter = (is_zeta || is_int_format) ? VK_FILTER_NEAREST : VK_FILTER_LINEAR; | 604 | const VkFilter vk_filter = (is_zeta || is_int_format) ? VK_FILTER_NEAREST : VK_FILTER_LINEAR; |
| 606 | 605 | ||
| 607 | scheduler.RequestOutsideRenderPassOperationContext(); | 606 | scheduler.RequestOutsideRenderPassOperationContext(); |
| 608 | scheduler.Record([dst_image, src_image, extent, resources, aspect_mask, resolution, type, | 607 | scheduler.Record([dst_image, src_image, extent, resources, aspect_mask, resolution, is_2d, |
| 609 | scaling, vk_filter](vk::CommandBuffer cmdbuf) { | 608 | vk_filter](vk::CommandBuffer cmdbuf) { |
| 610 | const VkOffset2D src_size{ | 609 | const VkOffset2D src_size{ |
| 611 | .x = static_cast<s32>(scaling ? extent.width : resolution.ScaleUp(extent.width)), | 610 | .x = static_cast<s32>(extent.width), |
| 612 | .y = static_cast<s32>(scaling ? extent.height : resolution.ScaleUp(extent.height)), | 611 | .y = static_cast<s32>(extent.height), |
| 613 | }; | 612 | }; |
| 614 | const VkOffset2D dst_size{ | 613 | const VkOffset2D dst_size{ |
| 615 | .x = static_cast<s32>(scaling ? resolution.ScaleUp(extent.width) : extent.width), | 614 | .x = static_cast<s32>(resolution.ScaleUp(extent.width)), |
| 616 | .y = static_cast<s32>(scaling ? resolution.ScaleUp(extent.height) : extent.height), | 615 | .y = static_cast<s32>(is_2d ? resolution.ScaleUp(extent.height) : extent.height), |
| 617 | }; | 616 | }; |
| 618 | boost::container::small_vector<VkImageBlit, 4> regions; | 617 | boost::container::small_vector<VkImageBlit, 4> regions; |
| 619 | regions.reserve(resources.levels); | 618 | regions.reserve(resources.levels); |
| @@ -1154,7 +1153,7 @@ bool Image::ScaleUp() { | |||
| 1154 | if (aspect_mask == 0) { | 1153 | if (aspect_mask == 0) { |
| 1155 | aspect_mask = ImageAspectMask(info.format); | 1154 | aspect_mask = ImageAspectMask(info.format); |
| 1156 | } | 1155 | } |
| 1157 | BlitScale(*scheduler, *original_image, *scaled_image, info, aspect_mask, resolution, true); | 1156 | BlitScale(*scheduler, *original_image, *scaled_image, info, aspect_mask, resolution); |
| 1158 | current_image = *scaled_image; | 1157 | current_image = *scaled_image; |
| 1159 | flags |= ImageFlagBits::Rescaled; | 1158 | flags |= ImageFlagBits::Rescaled; |
| 1160 | return true; | 1159 | return true; |