From 48da42b49feeb82dfc5af15c8673dcae5198be8a Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 15 Apr 2017 19:57:25 +1000 Subject: [PATCH] Vulkan: Ensure framedump texture is incorrect layout for render/readback --- Source/Core/VideoBackends/Vulkan/Renderer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp index 15fb00e77e..3b446e2292 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp +++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp @@ -756,6 +756,10 @@ bool Renderer::DrawFrameDump(const TargetRectangle& scaled_efb_rect, u32 xfb_add if (!ResizeFrameDumpBuffer(width, height)) return false; + // If there was a previous frame dumped, we'll still be in TRANSFER_SRC layout. + m_frame_dump_render_texture->TransitionToLayout(g_command_buffer_mgr->GetCurrentCommandBuffer(), + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); + VkClearValue clear_value = {{{0.0f, 0.0f, 0.0f, 1.0f}}}; VkClearRect clear_rect = {{{0, 0}, {width, height}}, 0, 1}; VkClearAttachment clear_attachment = {VK_IMAGE_ASPECT_COLOR_BIT, 0, clear_value}; @@ -781,6 +785,8 @@ bool Renderer::DrawFrameDump(const TargetRectangle& scaled_efb_rect, u32 xfb_add return false; // Queue a copy to the current frame dump buffer. It will be written to the frame dump later. + m_frame_dump_render_texture->TransitionToLayout(g_command_buffer_mgr->GetCurrentCommandBuffer(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL); readback_texture->CopyFromImage(g_command_buffer_mgr->GetCurrentCommandBuffer(), m_frame_dump_render_texture->GetImage(), VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, width, height, 0, 0);