diff options
| author | 2020-07-24 11:29:37 -0700 | |
|---|---|---|
| committer | 2020-07-24 11:29:37 -0700 | |
| commit | d488cb843e65e10babc51edb6b741b2b3f38aeae (patch) | |
| tree | 66ea37433c81262b0fa1b339a0204f9e5aee9ed0 | |
| parent | Merge pull request #4391 from lioncash/nrvo (diff) | |
| parent | buffer_cache: Eliminate redundant map lookup in MarkRegionAsWritten() (diff) | |
| download | yuzu-d488cb843e65e10babc51edb6b741b2b3f38aeae.tar.gz yuzu-d488cb843e65e10babc51edb6b741b2b3f38aeae.tar.xz yuzu-d488cb843e65e10babc51edb6b741b2b3f38aeae.zip | |
Merge pull request #4388 from lioncash/written
buffer_cache: Eliminate redundant map lookup in MarkRegionAsWritten()
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index dd7ce8c99..b5dc68902 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -524,11 +524,8 @@ private: | |||
| 524 | void MarkRegionAsWritten(VAddr start, VAddr end) { | 524 | void MarkRegionAsWritten(VAddr start, VAddr end) { |
| 525 | const u64 page_end = end >> WRITE_PAGE_BIT; | 525 | const u64 page_end = end >> WRITE_PAGE_BIT; |
| 526 | for (u64 page_start = start >> WRITE_PAGE_BIT; page_start <= page_end; ++page_start) { | 526 | for (u64 page_start = start >> WRITE_PAGE_BIT; page_start <= page_end; ++page_start) { |
| 527 | auto it = written_pages.find(page_start); | 527 | if (const auto [it, inserted] = written_pages.emplace(page_start, 1); !inserted) { |
| 528 | if (it != written_pages.end()) { | 528 | ++it->second; |
| 529 | it->second = it->second + 1; | ||
| 530 | } else { | ||
| 531 | written_pages.insert_or_assign(page_start, 1); | ||
| 532 | } | 529 | } |
| 533 | } | 530 | } |
| 534 | } | 531 | } |
| @@ -539,7 +536,7 @@ private: | |||
| 539 | auto it = written_pages.find(page_start); | 536 | auto it = written_pages.find(page_start); |
| 540 | if (it != written_pages.end()) { | 537 | if (it != written_pages.end()) { |
| 541 | if (it->second > 1) { | 538 | if (it->second > 1) { |
| 542 | it->second = it->second - 1; | 539 | --it->second; |
| 543 | } else { | 540 | } else { |
| 544 | written_pages.erase(it); | 541 | written_pages.erase(it); |
| 545 | } | 542 | } |