diff options
| author | 2018-10-09 19:28:58 -0400 | |
|---|---|---|
| committer | 2018-10-16 11:31:00 -0400 | |
| commit | 0be7e8228952c2e08644e4ebc56aa0274042bdae (patch) | |
| tree | 227db4acf1d8b116c3b792048c7b35bf4a5f5e30 /src/video_core/rasterizer_cache.h | |
| parent | gl_rasterizer_cache: Reintroduce code for handling swizzle and flush to guest... (diff) | |
| download | yuzu-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.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 @@ | |||
| 17 | template <class T> | 17 | template <class T> |
| 18 | class RasterizerCache : NonCopyable { | 18 | class RasterizerCache : NonCopyable { |
| 19 | public: | 19 | public: |
| 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 | ||