summaryrefslogtreecommitdiff
path: root/src/video_core/rasterizer_cache.h
diff options
context:
space:
mode:
authorGravatar bunnei2018-11-11 08:20:27 -0800
committerGravatar GitHub2018-11-11 08:20:27 -0800
commitc82bccab5600fe013580d264dfd0a1729de34201 (patch)
tree65dfb31af2c99f5157297e20faf2bff607e33d93 /src/video_core/rasterizer_cache.h
parentMerge pull request #1648 from FernandoS27/texs-3-array (diff)
parentrasterizer_cache: Remove reliance on the System singleton (diff)
downloadyuzu-c82bccab5600fe013580d264dfd0a1729de34201.tar.gz
yuzu-c82bccab5600fe013580d264dfd0a1729de34201.tar.xz
yuzu-c82bccab5600fe013580d264dfd0a1729de34201.zip
Merge pull request #1663 from lioncash/raster
rasterizer_cache: Remove reliance on the System singleton
Diffstat (limited to 'src/video_core/rasterizer_cache.h')
-rw-r--r--src/video_core/rasterizer_cache.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/video_core/rasterizer_cache.h b/src/video_core/rasterizer_cache.h
index d999c92fa..6d41321fa 100644
--- a/src/video_core/rasterizer_cache.h
+++ b/src/video_core/rasterizer_cache.h
@@ -10,10 +10,8 @@
10#include <boost/range/iterator_range_core.hpp> 10#include <boost/range/iterator_range_core.hpp>
11 11
12#include "common/common_types.h" 12#include "common/common_types.h"
13#include "core/core.h"
14#include "core/settings.h" 13#include "core/settings.h"
15#include "video_core/rasterizer_interface.h" 14#include "video_core/rasterizer_interface.h"
16#include "video_core/renderer_base.h"
17 15
18class RasterizerCacheObject { 16class RasterizerCacheObject {
19public: 17public:
@@ -66,6 +64,8 @@ class RasterizerCache : NonCopyable {
66 friend class RasterizerCacheObject; 64 friend class RasterizerCacheObject;
67 65
68public: 66public:
67 explicit RasterizerCache(VideoCore::RasterizerInterface& rasterizer) : rasterizer{rasterizer} {}
68
69 /// Write any cached resources overlapping the specified region back to memory 69 /// Write any cached resources overlapping the specified region back to memory
70 void FlushRegion(Tegra::GPUVAddr addr, size_t size) { 70 void FlushRegion(Tegra::GPUVAddr addr, size_t size) {
71 const auto& objects{GetSortedObjectsFromRegion(addr, size)}; 71 const auto& objects{GetSortedObjectsFromRegion(addr, size)};
@@ -111,14 +111,12 @@ protected:
111 void Register(const T& object) { 111 void Register(const T& object) {
112 object->SetIsRegistered(true); 112 object->SetIsRegistered(true);
113 object_cache.add({GetInterval(object), ObjectSet{object}}); 113 object_cache.add({GetInterval(object), ObjectSet{object}});
114 auto& rasterizer = Core::System::GetInstance().Renderer().Rasterizer();
115 rasterizer.UpdatePagesCachedCount(object->GetAddr(), object->GetSizeInBytes(), 1); 114 rasterizer.UpdatePagesCachedCount(object->GetAddr(), object->GetSizeInBytes(), 1);
116 } 115 }
117 116
118 /// Unregisters an object from the cache 117 /// Unregisters an object from the cache
119 void Unregister(const T& object) { 118 void Unregister(const T& object) {
120 object->SetIsRegistered(false); 119 object->SetIsRegistered(false);
121 auto& rasterizer = Core::System::GetInstance().Renderer().Rasterizer();
122 rasterizer.UpdatePagesCachedCount(object->GetAddr(), object->GetSizeInBytes(), -1); 120 rasterizer.UpdatePagesCachedCount(object->GetAddr(), object->GetSizeInBytes(), -1);
123 121
124 // Only flush if use_accurate_gpu_emulation is enabled, as it incurs a performance hit 122 // Only flush if use_accurate_gpu_emulation is enabled, as it incurs a performance hit
@@ -179,4 +177,5 @@ private:
179 177
180 ObjectCache object_cache; ///< Cache of objects 178 ObjectCache object_cache; ///< Cache of objects
181 u64 modified_ticks{}; ///< Counter of cache state ticks, used for in-order flushing 179 u64 modified_ticks{}; ///< Counter of cache state ticks, used for in-order flushing
180 VideoCore::RasterizerInterface& rasterizer;
182}; 181};