diff options
author | bunnei <bunneidev@gmail.com> | 2022-08-07 08:00:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-07 08:00:46 +0200 |
commit | 9dc8d02acc852fa867c4a97adb93ac56b36cc57f (patch) | |
tree | f96cde50d1f7969e722fba296694f038a4faa779 | |
parent | Merge pull request #8700 from liamwhite/xc3-vk-crash (diff) | |
parent | video_core: differentiate between tiled and untiled framebuffer sizes for unaccelerated copies (diff) | |
download | yuzu-9dc8d02acc852fa867c4a97adb93ac56b36cc57f.tar yuzu-9dc8d02acc852fa867c4a97adb93ac56b36cc57f.tar.gz yuzu-9dc8d02acc852fa867c4a97adb93ac56b36cc57f.tar.bz2 yuzu-9dc8d02acc852fa867c4a97adb93ac56b36cc57f.tar.lz yuzu-9dc8d02acc852fa867c4a97adb93ac56b36cc57f.tar.xz yuzu-9dc8d02acc852fa867c4a97adb93ac56b36cc57f.tar.zst yuzu-9dc8d02acc852fa867c4a97adb93ac56b36cc57f.zip |
-rw-r--r-- | src/video_core/renderer_vulkan/vk_blit_screen.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index 4a1d96322..27e6ebf94 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp @@ -87,12 +87,8 @@ u32 GetBytesPerPixel(const Tegra::FramebufferConfig& framebuffer) { } std::size_t GetSizeInBytes(const Tegra::FramebufferConfig& framebuffer) { - // TODO(Rodrigo): Read this from HLE - constexpr u32 block_height_log2 = 4; - const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer); - const u64 size_bytes{Tegra::Texture::CalculateSize( - true, bytes_per_pixel, framebuffer.stride, framebuffer.height, 1, block_height_log2, 0)}; - return size_bytes; + return static_cast<std::size_t>(framebuffer.stride) * + static_cast<std::size_t>(framebuffer.height) * GetBytesPerPixel(framebuffer); } VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) { @@ -173,10 +169,12 @@ VkSemaphore BlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer, // TODO(Rodrigo): Read this from HLE constexpr u32 block_height_log2 = 4; const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer); - const u64 size_bytes{GetSizeInBytes(framebuffer)}; - + const u64 linear_size{GetSizeInBytes(framebuffer)}; + const u64 tiled_size{Tegra::Texture::CalculateSize(true, bytes_per_pixel, + framebuffer.stride, framebuffer.height, + 1, block_height_log2, 0)}; Tegra::Texture::UnswizzleTexture( - mapped_span.subspan(image_offset, size_bytes), std::span(host_ptr, size_bytes), + mapped_span.subspan(image_offset, linear_size), std::span(host_ptr, tiled_size), bytes_per_pixel, framebuffer.width, framebuffer.height, 1, block_height_log2, 0); const VkBufferImageCopy copy{ |