summaryrefslogtreecommitdiff
path: root/src/video_core/fence_manager.h
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-12-30 02:25:23 -0300
committerGravatar ReinUsesLisp2020-12-30 03:38:50 -0300
commit9764c13d6d2977903f407761b27d847c0056e1c4 (patch)
treef6f5d6d6379b0404147969e7d1f548ed3d49ca01 /src/video_core/fence_manager.h
parentvideo_core: Add a delayed destruction ring abstraction (diff)
downloadyuzu-9764c13d6d2977903f407761b27d847c0056e1c4.tar.gz
yuzu-9764c13d6d2977903f407761b27d847c0056e1c4.tar.xz
yuzu-9764c13d6d2977903f407761b27d847c0056e1c4.zip
video_core: Rewrite the texture cache
The current texture cache has several points that hurt maintainability and performance. It's easy to break unrelated parts of the cache when doing minor changes. The cache can easily forget valuable information about the cached textures by CPU writes or simply by its normal usage.The current texture cache has several points that hurt maintainability and performance. It's easy to break unrelated parts of the cache when doing minor changes. The cache can easily forget valuable information about the cached textures by CPU writes or simply by its normal usage. This commit aims to address those issues.
Diffstat (limited to 'src/video_core/fence_manager.h')
-rw-r--r--src/video_core/fence_manager.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/video_core/fence_manager.h b/src/video_core/fence_manager.h
index c5f26896e..3512283ff 100644
--- a/src/video_core/fence_manager.h
+++ b/src/video_core/fence_manager.h
@@ -9,6 +9,7 @@
9 9
10#include "common/common_types.h" 10#include "common/common_types.h"
11#include "core/core.h" 11#include "core/core.h"
12#include "video_core/delayed_destruction_ring.h"
12#include "video_core/gpu.h" 13#include "video_core/gpu.h"
13#include "video_core/memory_manager.h" 14#include "video_core/memory_manager.h"
14#include "video_core/rasterizer_interface.h" 15#include "video_core/rasterizer_interface.h"
@@ -47,6 +48,11 @@ protected:
47template <typename TFence, typename TTextureCache, typename TTBufferCache, typename TQueryCache> 48template <typename TFence, typename TTextureCache, typename TTBufferCache, typename TQueryCache>
48class FenceManager { 49class FenceManager {
49public: 50public:
51 /// Notify the fence manager about a new frame
52 void TickFrame() {
53 delayed_destruction_ring.Tick();
54 }
55
50 void SignalSemaphore(GPUVAddr addr, u32 value) { 56 void SignalSemaphore(GPUVAddr addr, u32 value) {
51 TryReleasePendingFences(); 57 TryReleasePendingFences();
52 const bool should_flush = ShouldFlush(); 58 const bool should_flush = ShouldFlush();
@@ -86,7 +92,7 @@ public:
86 } else { 92 } else {
87 gpu.IncrementSyncPoint(current_fence->GetPayload()); 93 gpu.IncrementSyncPoint(current_fence->GetPayload());
88 } 94 }
89 fences.pop(); 95 PopFence();
90 } 96 }
91 } 97 }
92 98
@@ -132,7 +138,7 @@ private:
132 } else { 138 } else {
133 gpu.IncrementSyncPoint(current_fence->GetPayload()); 139 gpu.IncrementSyncPoint(current_fence->GetPayload());
134 } 140 }
135 fences.pop(); 141 PopFence();
136 } 142 }
137 } 143 }
138 144
@@ -158,7 +164,14 @@ private:
158 query_cache.CommitAsyncFlushes(); 164 query_cache.CommitAsyncFlushes();
159 } 165 }
160 166
167 void PopFence() {
168 delayed_destruction_ring.Push(std::move(fences.front()));
169 fences.pop();
170 }
171
161 std::queue<TFence> fences; 172 std::queue<TFence> fences;
173
174 DelayedDestructionRing<TFence, 6> delayed_destruction_ring;
162}; 175};
163 176
164} // namespace VideoCommon 177} // namespace VideoCommon