summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/FramebufferManager.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2019-03-02 17:05:38 +1000
committerStenzek <stenzek@gmail.com>2019-03-09 12:24:04 +1000
commita218a794cb365690fe33099be14fbf3b08de5d33 (patch)
tree29916e77ee951dbe9d4bd2220a1ab7edbe0cadc7 /Source/Core/VideoCommon/FramebufferManager.cpp
parent6bc4bfd26af96de8642e75bbf644722c44baeb7b (diff)
FramebufferManager: Implement deferred EFB cache invalidation
Diffstat (limited to 'Source/Core/VideoCommon/FramebufferManager.cpp')
-rw-r--r--Source/Core/VideoCommon/FramebufferManager.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/Source/Core/VideoCommon/FramebufferManager.cpp b/Source/Core/VideoCommon/FramebufferManager.cpp
index ec055a7278..489ce62292 100644
--- a/Source/Core/VideoCommon/FramebufferManager.cpp
+++ b/Source/Core/VideoCommon/FramebufferManager.cpp
@@ -80,7 +80,7 @@ bool FramebufferManager::Initialize()
void FramebufferManager::RecreateEFBFramebuffer()
{
FlushEFBPokes();
- InvalidatePeekCache();
+ InvalidatePeekCache(true);
DestroyReadbackFramebuffer();
DestroyEFBFramebuffer();
@@ -289,7 +289,7 @@ bool FramebufferManager::ReinterpretPixelData(EFBReinterpretType convtype)
std::swap(m_efb_color_texture, m_efb_convert_color_texture);
std::swap(m_efb_framebuffer, m_efb_convert_framebuffer);
g_renderer->EndUtilityDrawing();
- InvalidatePeekCache();
+ InvalidatePeekCache(true);
return true;
}
@@ -396,27 +396,40 @@ void FramebufferManager::SetEFBCacheTileSize(u32 size)
if (m_efb_cache_tile_size == size)
return;
- InvalidatePeekCache();
+ InvalidatePeekCache(true);
m_efb_cache_tile_size = size;
DestroyReadbackFramebuffer();
if (!CreateReadbackFramebuffer())
PanicAlert("Failed to create EFB readback framebuffers");
}
-void FramebufferManager::InvalidatePeekCache()
+void FramebufferManager::InvalidatePeekCache(bool forced)
{
- if (m_efb_color_cache.valid)
+ if (forced || m_efb_color_cache.out_of_date)
{
m_efb_color_cache.valid = false;
+ m_efb_color_cache.out_of_date = false;
std::fill(m_efb_color_cache.tiles.begin(), m_efb_color_cache.tiles.end(), false);
}
- if (m_efb_depth_cache.valid)
+ if (forced || m_efb_depth_cache.out_of_date)
{
m_efb_depth_cache.valid = false;
+ m_efb_depth_cache.out_of_date = false;
std::fill(m_efb_depth_cache.tiles.begin(), m_efb_depth_cache.tiles.end(), false);
}
}
+void FramebufferManager::FlagPeekCacheAsOutOfDate()
+{
+ if (m_efb_color_cache.valid)
+ m_efb_color_cache.out_of_date = true;
+ if (m_efb_depth_cache.valid)
+ m_efb_depth_cache.out_of_date = true;
+
+ if (!g_ActiveConfig.bEFBAccessDeferInvalidation)
+ InvalidatePeekCache();
+}
+
bool FramebufferManager::CompileReadbackPipelines()
{
AbstractPipelineConfig config = {};
@@ -580,6 +593,7 @@ void FramebufferManager::PopulateEFBCache(bool depth, u32 tile_index)
// Wait until the copy is complete.
data.readback_texture->Flush();
data.valid = true;
+ data.out_of_date = false;
if (IsUsingTiledEFBCache())
data.tiles[tile_index] = true;
}
@@ -588,7 +602,7 @@ void FramebufferManager::ClearEFB(const MathUtil::Rectangle<int>& rc, bool clear
bool clear_alpha, bool clear_z, u32 color, u32 z)
{
FlushEFBPokes();
- InvalidatePeekCache();
+ FlagPeekCacheAsOutOfDate();
g_renderer->BeginUtilityDrawing();
// Set up uniforms.