Skip to content
Permalink
Browse files

FramebufferManager: Fix broken EFB peeks in GL with MSAA on

  • Loading branch information...
stenzek committed Mar 29, 2019
1 parent 963370d commit 3c455de799b4b250a71ee844a97b51a88e09c831
Showing with 8 additions and 10 deletions.
  1. +0 −2 Source/Core/VideoCommon/FramebufferManager.cpp
  2. +8 −8 Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -231,7 +231,6 @@ AbstractTexture* FramebufferManager::ResolveEFBColorTexture(const MathUtil::Rect
// It's not valid to resolve an out-of-range rectangle.
MathUtil::Rectangle<int> 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<int> 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();
@@ -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<float>(g_framebuffer_manager->GetEFBWidth());
const float rcp_efb_height = 1.0f / static_cast<float>(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<float>(g_framebuffer_manager->GetEFBHeight());
encoder_params.position_uniform[0] = src_rect.left;
encoder_params.position_uniform[1] = src_rect.top;

0 comments on commit 3c455de

Please sign in to comment.
You can’t perform that action at this time.