From b39ac950eb8fa71fd745e4c42d2805d3317daeda Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 5 Oct 2016 22:27:37 +1000 Subject: [PATCH] Vulkan: Don't save borders to screenshots/frame dumps This matches the behavior on GL, making for easier comparisons. --- Source/Core/VideoBackends/Vulkan/Renderer.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp index 74e2707a5d..c8f9aaa4d3 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp +++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp @@ -618,8 +618,15 @@ void Renderer::DrawScreen(const TargetRectangle& src_rect, const Texture2D* src_ bool Renderer::DrawScreenshot(const TargetRectangle& src_rect, const Texture2D* src_tex) { - u32 width = std::max(1u, static_cast(s_backbuffer_width)); - u32 height = std::max(1u, static_cast(s_backbuffer_height)); + // Draw the screenshot to an image containing only the active screen area, removing any + // borders as a result of the game rendering in a different aspect ratio. + TargetRectangle target_rect = GetTargetRectangle(); + target_rect.right = target_rect.GetWidth(); + target_rect.bottom = target_rect.GetHeight(); + target_rect.left = 0; + target_rect.top = 0; + u32 width = std::max(1u, static_cast(target_rect.GetWidth())); + u32 height = std::max(1u, static_cast(target_rect.GetHeight())); if (!ResizeScreenshotBuffer(width, height)) return false; @@ -637,8 +644,8 @@ bool Renderer::DrawScreenshot(const TargetRectangle& src_rect, const Texture2D* VK_SUBPASS_CONTENTS_INLINE); vkCmdClearAttachments(g_command_buffer_mgr->GetCurrentCommandBuffer(), 1, &clear_attachment, 1, &clear_rect); - BlitScreen(m_framebuffer_mgr->GetColorCopyForReadbackRenderPass(), GetTargetRectangle(), src_rect, - src_tex, true); + BlitScreen(m_framebuffer_mgr->GetColorCopyForReadbackRenderPass(), target_rect, src_rect, src_tex, + true); vkCmdEndRenderPass(g_command_buffer_mgr->GetCurrentCommandBuffer()); // Copy to the readback texture.