diff options
author | Fernando S <fsahmkow27@gmail.com> | 2023-03-05 15:30:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-05 15:30:47 +0100 |
commit | fdae95efaa84fe1baeab0b4dd1435720cae0f88d (patch) | |
tree | 383070bd0d4a33189f38423ceea9a5692d38ba09 /src/video_core/renderer_vulkan/vk_texture_cache.cpp | |
parent | Merge pull request #9884 from liamwhite/service-cleanup (diff) | |
parent | Engines: Implement Accelerate DMA Texture. (diff) | |
download | yuzu-fdae95efaa84fe1baeab0b4dd1435720cae0f88d.tar yuzu-fdae95efaa84fe1baeab0b4dd1435720cae0f88d.tar.gz yuzu-fdae95efaa84fe1baeab0b4dd1435720cae0f88d.tar.bz2 yuzu-fdae95efaa84fe1baeab0b4dd1435720cae0f88d.tar.lz yuzu-fdae95efaa84fe1baeab0b4dd1435720cae0f88d.tar.xz yuzu-fdae95efaa84fe1baeab0b4dd1435720cae0f88d.tar.zst yuzu-fdae95efaa84fe1baeab0b4dd1435720cae0f88d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 80adb70eb..8a204f93f 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -864,13 +864,19 @@ void TextureCacheRuntime::ReinterpretImage(Image& dst, Image& src, const VkImageAspectFlags src_aspect_mask = src.AspectMask(); const VkImageAspectFlags dst_aspect_mask = dst.AspectMask(); - std::ranges::transform(copies, vk_in_copies.begin(), [src_aspect_mask](const auto& copy) { - return MakeBufferImageCopy(copy, true, src_aspect_mask); - }); + const auto bpp_in = BytesPerBlock(src.info.format) / DefaultBlockWidth(src.info.format); + const auto bpp_out = BytesPerBlock(dst.info.format) / DefaultBlockWidth(dst.info.format); + std::ranges::transform(copies, vk_in_copies.begin(), + [src_aspect_mask, bpp_in, bpp_out](const auto& copy) { + auto copy2 = copy; + copy2.src_offset.x = (bpp_out * copy.src_offset.x) / bpp_in; + copy2.extent.width = (bpp_out * copy.extent.width) / bpp_in; + return MakeBufferImageCopy(copy2, true, src_aspect_mask); + }); std::ranges::transform(copies, vk_out_copies.begin(), [dst_aspect_mask](const auto& copy) { return MakeBufferImageCopy(copy, false, dst_aspect_mask); }); - const u32 img_bpp = BytesPerBlock(src.info.format); + const u32 img_bpp = BytesPerBlock(dst.info.format); size_t total_size = 0; for (const auto& copy : copies) { total_size += copy.extent.width * copy.extent.height * copy.extent.depth * img_bpp; |