2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

vk_texture_cache: Fix BlitScale of non-2D images

This commit is contained in:
ameerj 2021-10-12 00:54:28 -04:00 committed by Fernando Sahmkow
parent abd07e4158
commit b1ae935f11

View file

@ -592,9 +592,8 @@ struct RangedBarrierRange {
} }
void BlitScale(VKScheduler& scheduler, VkImage src_image, VkImage dst_image, const ImageInfo& info, 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 bool is_2d = info.type == ImageType::e2D;
const auto type = info.type;
const auto resources = info.resources; const auto resources = info.resources;
const VkExtent2D extent{ const VkExtent2D extent{
.width = info.size.width, .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; const VkFilter vk_filter = (is_zeta || is_int_format) ? VK_FILTER_NEAREST : VK_FILTER_LINEAR;
scheduler.RequestOutsideRenderPassOperationContext(); scheduler.RequestOutsideRenderPassOperationContext();
scheduler.Record([dst_image, src_image, extent, resources, aspect_mask, resolution, type, scheduler.Record([dst_image, src_image, extent, resources, aspect_mask, resolution, is_2d,
scaling, vk_filter](vk::CommandBuffer cmdbuf) { vk_filter](vk::CommandBuffer cmdbuf) {
const VkOffset2D src_size{ const VkOffset2D src_size{
.x = static_cast<s32>(scaling ? extent.width : resolution.ScaleUp(extent.width)), .x = static_cast<s32>(extent.width),
.y = static_cast<s32>(scaling ? extent.height : resolution.ScaleUp(extent.height)), .y = static_cast<s32>(extent.height),
}; };
const VkOffset2D dst_size{ const VkOffset2D dst_size{
.x = static_cast<s32>(scaling ? resolution.ScaleUp(extent.width) : extent.width), .x = static_cast<s32>(resolution.ScaleUp(extent.width)),
.y = static_cast<s32>(scaling ? resolution.ScaleUp(extent.height) : extent.height), .y = static_cast<s32>(is_2d ? resolution.ScaleUp(extent.height) : extent.height),
}; };
boost::container::small_vector<VkImageBlit, 4> regions; boost::container::small_vector<VkImageBlit, 4> regions;
regions.reserve(resources.levels); regions.reserve(resources.levels);
@ -1154,7 +1153,7 @@ bool Image::ScaleUp() {
if (aspect_mask == 0) { if (aspect_mask == 0) {
aspect_mask = ImageAspectMask(info.format); 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; current_image = *scaled_image;
flags |= ImageFlagBits::Rescaled; flags |= ImageFlagBits::Rescaled;
return true; return true;