From 3c455de799b4b250a71ee844a97b51a88e09c831 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 30 Mar 2019 03:14:29 +1000 Subject: [PATCH] FramebufferManager: Fix broken EFB peeks in GL with MSAA on --- Source/Core/VideoCommon/FramebufferManager.cpp | 2 -- Source/Core/VideoCommon/TextureCacheBase.cpp | 16 ++++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Source/Core/VideoCommon/FramebufferManager.cpp b/Source/Core/VideoCommon/FramebufferManager.cpp index 864fbf144f..39b389e283 100644 --- a/Source/Core/VideoCommon/FramebufferManager.cpp +++ b/Source/Core/VideoCommon/FramebufferManager.cpp @@ -231,7 +231,6 @@ AbstractTexture* FramebufferManager::ResolveEFBColorTexture(const MathUtil::Rect // It's not valid to resolve an out-of-range rectangle. MathUtil::Rectangle clamped_region = region; clamped_region.ClampUL(0, 0, GetEFBWidth(), GetEFBHeight()); - clamped_region = g_renderer->ConvertFramebufferRectangle(clamped_region, m_efb_framebuffer.get()); // Resolve to our already-created texture. for (u32 layer = 0; layer < GetEFBLayers(); layer++) @@ -255,7 +254,6 @@ AbstractTexture* FramebufferManager::ResolveEFBDepthTexture(const MathUtil::Rect // It's not valid to resolve an out-of-range rectangle. MathUtil::Rectangle clamped_region = region; clamped_region.ClampUL(0, 0, GetEFBWidth(), GetEFBHeight()); - clamped_region = g_renderer->ConvertFramebufferRectangle(clamped_region, m_efb_framebuffer.get()); m_efb_depth_texture->FinishedRendering(); g_renderer->BeginUtilityDrawing(); diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index a210be3bc3..79e924771d 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -2306,9 +2306,11 @@ void TextureCacheBase::CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_cop } const auto scaled_src_rect = g_renderer->ConvertEFBRectangle(src_rect); + const auto framebuffer_rect = g_renderer->ConvertFramebufferRectangle( + scaled_src_rect, g_framebuffer_manager->GetEFBFramebuffer()); AbstractTexture* src_texture = - is_depth_copy ? g_framebuffer_manager->ResolveEFBDepthTexture(scaled_src_rect) : - g_framebuffer_manager->ResolveEFBColorTexture(scaled_src_rect); + is_depth_copy ? g_framebuffer_manager->ResolveEFBDepthTexture(framebuffer_rect) : + g_framebuffer_manager->ResolveEFBColorTexture(framebuffer_rect); g_renderer->BeginUtilityDrawing(); @@ -2324,8 +2326,6 @@ void TextureCacheBase::CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_cop u32 padding; }; Uniforms uniforms; - const auto framebuffer_rect = g_renderer->ConvertFramebufferRectangle( - scaled_src_rect, g_framebuffer_manager->GetEFBFramebuffer()); const float rcp_efb_width = 1.0f / static_cast(g_framebuffer_manager->GetEFBWidth()); const float rcp_efb_height = 1.0f / static_cast(g_framebuffer_manager->GetEFBHeight()); uniforms.src_left = framebuffer_rect.left * rcp_efb_width; @@ -2372,9 +2372,11 @@ void TextureCacheBase::CopyEFB(AbstractStagingTexture* dst, const EFBCopyParams& } const auto scaled_src_rect = g_renderer->ConvertEFBRectangle(src_rect); + const auto framebuffer_rect = g_renderer->ConvertFramebufferRectangle( + scaled_src_rect, g_framebuffer_manager->GetEFBFramebuffer()); AbstractTexture* src_texture = - params.depth ? g_framebuffer_manager->ResolveEFBDepthTexture(scaled_src_rect) : - g_framebuffer_manager->ResolveEFBColorTexture(scaled_src_rect); + params.depth ? g_framebuffer_manager->ResolveEFBDepthTexture(framebuffer_rect) : + g_framebuffer_manager->ResolveEFBColorTexture(framebuffer_rect); g_renderer->BeginUtilityDrawing(); @@ -2390,8 +2392,6 @@ void TextureCacheBase::CopyEFB(AbstractStagingTexture* dst, const EFBCopyParams& u32 padding; }; Uniforms encoder_params; - const auto framebuffer_rect = g_renderer->ConvertFramebufferRectangle( - scaled_src_rect, g_framebuffer_manager->GetEFBFramebuffer()); const float rcp_efb_height = 1.0f / static_cast(g_framebuffer_manager->GetEFBHeight()); encoder_params.position_uniform[0] = src_rect.left; encoder_params.position_uniform[1] = src_rect.top;