diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-06-19 02:53:21 +0200 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2019-07-05 21:49:32 +0200 |
commit | d20ede40b1e9cd0539982fb1feb3b13af3501ea2 (patch) | |
tree | a084fedd90a6a3cc3e11b099f4ddfe194d49c8ea /src/video_core/gpu.cpp | |
parent | NVFlinger: Correct GCC compile error (diff) | |
download | yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar.gz yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar.bz2 yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar.lz yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar.xz yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar.zst yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.zip |
Diffstat (limited to 'src/video_core/gpu.cpp')
-rw-r--r-- | src/video_core/gpu.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 278528618..da8c715b6 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -89,24 +89,27 @@ u32 GPU::GetSyncpointValue(const u32 syncpoint_id) const { } void GPU::RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value) { - for (u32 in_value : syncpt_interrupts[syncpoint_id]) { - if (in_value == value) - return; + auto& interrupt = syncpt_interrupts[syncpoint_id]; + bool contains = std::any_of(interrupt.begin(), interrupt.end(), + [value](u32 in_value) { return in_value == value; }); + if (contains) { + return; } syncpt_interrupts[syncpoint_id].emplace_back(value); } bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) { std::lock_guard lock{sync_mutex}; - auto it = syncpt_interrupts[syncpoint_id].begin(); - while (it != syncpt_interrupts[syncpoint_id].end()) { - if (value == *it) { - it = syncpt_interrupts[syncpoint_id].erase(it); - return true; - } - it++; + auto& interrupt = syncpt_interrupts[syncpoint_id]; + const auto iter = + std::find_if(interrupt.begin(), interrupt.end(), + [value](u32 interrupt_value) { return value == interrupt_value; }); + + if (iter == interrupt.end()) { + return false; } - return false; + interrupt.erase(iter); + return true; } u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { |