summaryrefslogtreecommitdiff
path: root/src/video_core/rasterizer_cache.h
diff options
context:
space:
mode:
authorGravatar bunnei2018-10-09 19:28:58 -0400
committerGravatar bunnei2018-10-16 11:31:00 -0400
commit0be7e8228952c2e08644e4ebc56aa0274042bdae (patch)
tree227db4acf1d8b116c3b792048c7b35bf4a5f5e30 /src/video_core/rasterizer_cache.h
parentgl_rasterizer_cache: Reintroduce code for handling swizzle and flush to guest... (diff)
downloadyuzu-0be7e8228952c2e08644e4ebc56aa0274042bdae.tar.gz
yuzu-0be7e8228952c2e08644e4ebc56aa0274042bdae.tar.xz
yuzu-0be7e8228952c2e08644e4ebc56aa0274042bdae.zip
rasterizer_cache: Reintroduce method for flushing.
Diffstat (limited to 'src/video_core/rasterizer_cache.h')
-rw-r--r--src/video_core/rasterizer_cache.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/video_core/rasterizer_cache.h b/src/video_core/rasterizer_cache.h
index 083b283b0..4a34491a9 100644
--- a/src/video_core/rasterizer_cache.h
+++ b/src/video_core/rasterizer_cache.h
@@ -17,6 +17,22 @@
17template <class T> 17template <class T>
18class RasterizerCache : NonCopyable { 18class RasterizerCache : NonCopyable {
19public: 19public:
20 /// Write any cached resources overlapping the region back to memory (if dirty)
21 void FlushRegion(Tegra::GPUVAddr addr, size_t size) {
22 if (size == 0)
23 return;
24
25 const ObjectInterval interval{addr, addr + size};
26 for (auto& pair : boost::make_iterator_range(object_cache.equal_range(interval))) {
27 for (auto& cached_object : pair.second) {
28 if (!cached_object)
29 continue;
30
31 cached_object->Flush();
32 }
33 }
34 }
35
20 /// Mark the specified region as being invalidated 36 /// Mark the specified region as being invalidated
21 void InvalidateRegion(VAddr addr, u64 size) { 37 void InvalidateRegion(VAddr addr, u64 size) {
22 if (size == 0) 38 if (size == 0)
@@ -71,6 +87,7 @@ protected:
71 void Unregister(const T& object) { 87 void Unregister(const T& object) {
72 auto& rasterizer = Core::System::GetInstance().Renderer().Rasterizer(); 88 auto& rasterizer = Core::System::GetInstance().Renderer().Rasterizer();
73 rasterizer.UpdatePagesCachedCount(object->GetAddr(), object->GetSizeInBytes(), -1); 89 rasterizer.UpdatePagesCachedCount(object->GetAddr(), object->GetSizeInBytes(), -1);
90 object->Flush();
74 object_cache.subtract({GetInterval(object), ObjectSet{object}}); 91 object_cache.subtract({GetInterval(object), ObjectSet{object}});
75 } 92 }
76 93