diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2023-03-07 03:16:17 +0100 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2023-03-07 04:57:45 +0100 |
commit | 6b9cc0ed23b15a1b96b322b03feff2153e44a4a9 (patch) | |
tree | 6949cedbe90b6d34e2092c8eba57b243defb21dc /src/video_core/renderer_vulkan/vk_texture_cache.cpp | |
parent | Merge pull request #9890 from Kelebek1/reverb_fix (diff) | |
download | yuzu-6b9cc0ed23b15a1b96b322b03feff2153e44a4a9.tar yuzu-6b9cc0ed23b15a1b96b322b03feff2153e44a4a9.tar.gz yuzu-6b9cc0ed23b15a1b96b322b03feff2153e44a4a9.tar.bz2 yuzu-6b9cc0ed23b15a1b96b322b03feff2153e44a4a9.tar.lz yuzu-6b9cc0ed23b15a1b96b322b03feff2153e44a4a9.tar.xz yuzu-6b9cc0ed23b15a1b96b322b03feff2153e44a4a9.tar.zst yuzu-6b9cc0ed23b15a1b96b322b03feff2153e44a4a9.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_texture_cache.cpp')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 8a204f93f..bf6389ff1 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -1312,15 +1312,16 @@ Image::Image(const VideoCommon::NullImageParams& params) : VideoCommon::ImageBas Image::~Image() = default; -void Image::UploadMemory(const StagingBufferRef& map, std::span<const BufferImageCopy> copies) { +void Image::UploadMemory(VkBuffer buffer, VkDeviceSize offset, + std::span<const VideoCommon::BufferImageCopy> copies) { // TODO: Move this to another API const bool is_rescaled = True(flags & ImageFlagBits::Rescaled); if (is_rescaled) { ScaleDown(true); } scheduler->RequestOutsideRenderPassOperationContext(); - std::vector vk_copies = TransformBufferImageCopies(copies, map.offset, aspect_mask); - const VkBuffer src_buffer = map.buffer; + std::vector vk_copies = TransformBufferImageCopies(copies, offset, aspect_mask); + const VkBuffer src_buffer = buffer; const VkImage vk_image = *original_image; const VkImageAspectFlags vk_aspect_mask = aspect_mask; const bool is_initialized = std::exchange(initialized, true); @@ -1333,14 +1334,19 @@ void Image::UploadMemory(const StagingBufferRef& map, std::span<const BufferImag } } -void Image::DownloadMemory(const StagingBufferRef& map, std::span<const BufferImageCopy> copies) { +void Image::UploadMemory(const StagingBufferRef& map, std::span<const BufferImageCopy> copies) { + UploadMemory(map.buffer, map.offset, copies); +} + +void Image::DownloadMemory(VkBuffer buffer, VkDeviceSize offset, + std::span<const VideoCommon::BufferImageCopy> copies) { const bool is_rescaled = True(flags & ImageFlagBits::Rescaled); if (is_rescaled) { ScaleDown(); } - std::vector vk_copies = TransformBufferImageCopies(copies, map.offset, aspect_mask); + std::vector vk_copies = TransformBufferImageCopies(copies, offset, aspect_mask); scheduler->RequestOutsideRenderPassOperationContext(); - scheduler->Record([buffer = map.buffer, image = *original_image, aspect_mask = aspect_mask, + scheduler->Record([buffer, image = *original_image, aspect_mask = aspect_mask, vk_copies](vk::CommandBuffer cmdbuf) { const VkImageMemoryBarrier read_barrier{ .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, @@ -1395,6 +1401,10 @@ void Image::DownloadMemory(const StagingBufferRef& map, std::span<const BufferIm } } +void Image::DownloadMemory(const StagingBufferRef& map, std::span<const BufferImageCopy> copies) { + DownloadMemory(map.buffer, map.offset, copies); +} + bool Image::IsRescaled() const noexcept { return True(flags & ImageFlagBits::Rescaled); } |