diff options
author | bunnei <bunneidev@gmail.com> | 2018-10-10 01:28:58 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-10-16 17:31:00 +0200 |
commit | 0be7e8228952c2e08644e4ebc56aa0274042bdae (patch) | |
tree | 227db4acf1d8b116c3b792048c7b35bf4a5f5e30 /src/video_core/rasterizer_cache.h | |
parent | gl_rasterizer_cache: Reintroduce code for handling swizzle and flush to guest RAM. (diff) | |
download | yuzu-0be7e8228952c2e08644e4ebc56aa0274042bdae.tar yuzu-0be7e8228952c2e08644e4ebc56aa0274042bdae.tar.gz yuzu-0be7e8228952c2e08644e4ebc56aa0274042bdae.tar.bz2 yuzu-0be7e8228952c2e08644e4ebc56aa0274042bdae.tar.lz yuzu-0be7e8228952c2e08644e4ebc56aa0274042bdae.tar.xz yuzu-0be7e8228952c2e08644e4ebc56aa0274042bdae.tar.zst yuzu-0be7e8228952c2e08644e4ebc56aa0274042bdae.zip |
Diffstat (limited to 'src/video_core/rasterizer_cache.h')
-rw-r--r-- | src/video_core/rasterizer_cache.h | 17 |
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 @@ template <class T> class RasterizerCache : NonCopyable { public: + /// Write any cached resources overlapping the region back to memory (if dirty) + void FlushRegion(Tegra::GPUVAddr addr, size_t size) { + if (size == 0) + return; + + const ObjectInterval interval{addr, addr + size}; + for (auto& pair : boost::make_iterator_range(object_cache.equal_range(interval))) { + for (auto& cached_object : pair.second) { + if (!cached_object) + continue; + + cached_object->Flush(); + } + } + } + /// Mark the specified region as being invalidated void InvalidateRegion(VAddr addr, u64 size) { if (size == 0) @@ -71,6 +87,7 @@ protected: void Unregister(const T& object) { auto& rasterizer = Core::System::GetInstance().Renderer().Rasterizer(); rasterizer.UpdatePagesCachedCount(object->GetAddr(), object->GetSizeInBytes(), -1); + object->Flush(); object_cache.subtract({GetInterval(object), ObjectSet{object}}); } |