summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2021-04-12 17:52:34 -0700
committerGravatar GitHub2021-04-12 17:52:34 -0700
commit335a3cc115535d73974cf4e626599bb555f64d0f (patch)
tree6044d00b85b02efa4d9c86b1bf44e98030c7ff0d
parentMerge pull request #6193 from lioncash/incguard (diff)
parentquery_cache: Make use of std::erase_if (diff)
downloadyuzu-335a3cc115535d73974cf4e626599bb555f64d0f.tar.gz
yuzu-335a3cc115535d73974cf4e626599bb555f64d0f.tar.xz
yuzu-335a3cc115535d73974cf4e626599bb555f64d0f.zip
Merge pull request #6186 from lioncash/cache-erase
query_cache: Make use of std::erase_if
-rw-r--r--src/video_core/query_cache.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h
index 203f2af05..639d7ce7e 100644
--- a/src/video_core/query_cache.h
+++ b/src/video_core/query_cache.h
@@ -208,9 +208,9 @@ public:
208private: 208private:
209 /// Flushes a memory range to guest memory and removes it from the cache. 209 /// Flushes a memory range to guest memory and removes it from the cache.
210 void FlushAndRemoveRegion(VAddr addr, std::size_t size) { 210 void FlushAndRemoveRegion(VAddr addr, std::size_t size) {
211 const u64 addr_begin = static_cast<u64>(addr); 211 const u64 addr_begin = addr;
212 const u64 addr_end = addr_begin + static_cast<u64>(size); 212 const u64 addr_end = addr_begin + size;
213 const auto in_range = [addr_begin, addr_end](CachedQuery& query) { 213 const auto in_range = [addr_begin, addr_end](const CachedQuery& query) {
214 const u64 cache_begin = query.GetCpuAddr(); 214 const u64 cache_begin = query.GetCpuAddr();
215 const u64 cache_end = cache_begin + query.SizeInBytes(); 215 const u64 cache_end = cache_begin + query.SizeInBytes();
216 return cache_begin < addr_end && addr_begin < cache_end; 216 return cache_begin < addr_end && addr_begin < cache_end;
@@ -230,8 +230,7 @@ private:
230 rasterizer.UpdatePagesCachedCount(query.GetCpuAddr(), query.SizeInBytes(), -1); 230 rasterizer.UpdatePagesCachedCount(query.GetCpuAddr(), query.SizeInBytes(), -1);
231 query.Flush(); 231 query.Flush();
232 } 232 }
233 contents.erase(std::remove_if(std::begin(contents), std::end(contents), in_range), 233 std::erase_if(contents, in_range);
234 std::end(contents));
235 } 234 }
236 } 235 }
237 236