From 779fe13e62e6c0e9d591f2cb33d00a89191dd6a6 Mon Sep 17 00:00:00 2001 From: Robin Kertels Date: Mon, 26 Sep 2022 23:41:56 +0200 Subject: VideoCommon: Update EFB peek cache on draw done and tokens Massively improves performance in Mario Galaxy on Android. --- Source/Core/VideoCommon/FramebufferManager.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/FramebufferManager.h') diff --git a/Source/Core/VideoCommon/FramebufferManager.h b/Source/Core/VideoCommon/FramebufferManager.h index 2d27fef09b..1e918ff937 100644 --- a/Source/Core/VideoCommon/FramebufferManager.h +++ b/Source/Core/VideoCommon/FramebufferManager.h @@ -99,7 +99,9 @@ public: float PeekEFBDepth(u32 x, u32 y); void SetEFBCacheTileSize(u32 size); void InvalidatePeekCache(bool forced = true); + void RefreshPeekCache(); void FlagPeekCacheAsOutOfDate(); + void EndOfFrame(); // Writes a value to the framebuffer. This will never block, and writes will be batched. void PokeEFBColor(u32 x, u32 y, u32 color); @@ -117,6 +119,12 @@ protected: }; static_assert(std::is_standard_layout::value, "EFBPokeVertex is standard-layout"); + struct EFBCacheTile + { + bool present; + u8 frame_access_mask; + }; + // EFB cache - for CPU EFB access // Tiles are ordered left-to-right, then top-to-bottom struct EFBCacheData @@ -125,9 +133,10 @@ protected: std::unique_ptr framebuffer; std::unique_ptr readback_texture; std::unique_ptr copy_pipeline; - std::vector tiles; + std::vector tiles; bool out_of_date; bool valid; + bool needs_flush; }; bool CreateEFBFramebuffer(); @@ -151,7 +160,7 @@ protected: bool IsUsingTiledEFBCache() const; bool IsEFBCacheTilePresent(bool depth, u32 x, u32 y, u32* tile_index) const; MathUtil::Rectangle GetEFBCacheTileRect(u32 tile_index) const; - void PopulateEFBCache(bool depth, u32 tile_index); + void PopulateEFBCache(bool depth, u32 tile_index, bool async = false); void CreatePokeVertices(std::vector* destination_list, u32 x, u32 y, float z, u32 color); -- cgit v1.2.3