summaryrefslogtreecommitdiff
path: root/src/video_core/buffer_cache
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/buffer_cache')
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index f3aa35295..510f11089 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -153,8 +153,8 @@ public:
153 bool MustFlushRegion(VAddr addr, std::size_t size) { 153 bool MustFlushRegion(VAddr addr, std::size_t size) {
154 std::lock_guard lock{mutex}; 154 std::lock_guard lock{mutex};
155 155
156 std::vector<MapInterval> objects = GetMapsInRange(addr, size); 156 const std::vector<MapInterval> objects = GetMapsInRange(addr, size);
157 return std::any_of(objects.begin(), objects.end(), [](const MapInterval& map) { 157 return std::any_of(objects.cbegin(), objects.cend(), [](const MapInterval& map) {
158 return map->IsModified() && map->IsRegistered(); 158 return map->IsModified() && map->IsRegistered();
159 }); 159 });
160 } 160 }
@@ -176,7 +176,7 @@ public:
176 176
177 for (const auto& object : GetMapsInRange(addr, size)) { 177 for (const auto& object : GetMapsInRange(addr, size)) {
178 if (object->IsMemoryMarked() && object->IsRegistered()) { 178 if (object->IsMemoryMarked() && object->IsRegistered()) {
179 Unmark(object); 179 UnmarkMemory(object);
180 object->SetSyncPending(true); 180 object->SetSyncPending(true);
181 marked_for_unregister.emplace_back(object); 181 marked_for_unregister.emplace_back(object);
182 } 182 }
@@ -217,10 +217,7 @@ public:
217 } 217 }
218 218
219 bool ShouldWaitAsyncFlushes() const { 219 bool ShouldWaitAsyncFlushes() const {
220 if (committed_flushes.empty()) { 220 return !committed_flushes.empty() && committed_flushes.front() != nullptr;
221 return false;
222 }
223 return committed_flushes.front() != nullptr;
224 } 221 }
225 222
226 bool HasUncommittedFlushes() const { 223 bool HasUncommittedFlushes() const {
@@ -294,7 +291,7 @@ protected:
294 } 291 }
295 } 292 }
296 293
297 void Unmark(const MapInterval& map) { 294 void UnmarkMemory(const MapInterval& map) {
298 if (!map->IsMemoryMarked()) { 295 if (!map->IsMemoryMarked()) {
299 return; 296 return;
300 } 297 }
@@ -305,7 +302,7 @@ protected:
305 302
306 /// Unregisters an object from the cache 303 /// Unregisters an object from the cache
307 void Unregister(const MapInterval& map) { 304 void Unregister(const MapInterval& map) {
308 Unmark(map); 305 UnmarkMemory(map);
309 map->MarkAsRegistered(false); 306 map->MarkAsRegistered(false);
310 if (map->IsSyncPending()) { 307 if (map->IsSyncPending()) {
311 marked_for_unregister.remove(map); 308 marked_for_unregister.remove(map);