diff options
author | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2023-10-12 00:27:23 +0200 |
---|---|---|
committer | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2023-10-12 00:27:23 +0200 |
commit | 6f4a080b9880992afc847bd5ae6e8cd66d17a9bb (patch) | |
tree | 251c6118d8d1f38f69669ab28a74963f52afdbbf /src/video_core/renderer_vulkan/vk_texture_cache.cpp | |
parent | Merge pull request #11743 from Squall-Leonhart/IFREMOVED (diff) | |
download | yuzu-6f4a080b9880992afc847bd5ae6e8cd66d17a9bb.tar yuzu-6f4a080b9880992afc847bd5ae6e8cd66d17a9bb.tar.gz yuzu-6f4a080b9880992afc847bd5ae6e8cd66d17a9bb.tar.bz2 yuzu-6f4a080b9880992afc847bd5ae6e8cd66d17a9bb.tar.lz yuzu-6f4a080b9880992afc847bd5ae6e8cd66d17a9bb.tar.xz yuzu-6f4a080b9880992afc847bd5ae6e8cd66d17a9bb.tar.zst yuzu-6f4a080b9880992afc847bd5ae6e8cd66d17a9bb.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 | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 00ab47268..54bfeccb6 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -2013,4 +2013,32 @@ void TextureCacheRuntime::AccelerateImageUpload( ASSERT(false); } +void TextureCacheRuntime::TransitionImageLayout(Image& image) { + if (!image.ExchangeInitialization()) { + VkImageMemoryBarrier barrier{ + .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, + .pNext = nullptr, + .srcAccessMask = VK_ACCESS_NONE, + .dstAccessMask = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT, + .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED, + .newLayout = VK_IMAGE_LAYOUT_GENERAL, + .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, + .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, + .image = image.Handle(), + .subresourceRange{ + .aspectMask = image.AspectMask(), + .baseMipLevel = 0, + .levelCount = VK_REMAINING_MIP_LEVELS, + .baseArrayLayer = 0, + .layerCount = VK_REMAINING_ARRAY_LAYERS, + }, + }; + scheduler.RequestOutsideRenderPassOperationContext(); + scheduler.Record([barrier = barrier](vk::CommandBuffer cmdbuf) { + cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, barrier); + }); + } +} + } // namespace Vulkan |