summaryrefslogtreecommitdiff
path: root/src/video_core/gpu.cpp
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-06-18 20:53:21 -0400
committerGravatar FernandoS272019-07-05 15:49:32 -0400
commitd20ede40b1e9cd0539982fb1feb3b13af3501ea2 (patch)
treea084fedd90a6a3cc3e11b099f4ddfe194d49c8ea /src/video_core/gpu.cpp
parentNVFlinger: Correct GCC compile error (diff)
downloadyuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar.gz
yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.tar.xz
yuzu-d20ede40b1e9cd0539982fb1feb3b13af3501ea2.zip
NVServices: Styling, define constructors as explicit and corrections
Diffstat (limited to 'src/video_core/gpu.cpp')
-rw-r--r--src/video_core/gpu.cpp25
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 {
89} 89}
90 90
91void GPU::RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value) { 91void GPU::RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value) {
92 for (u32 in_value : syncpt_interrupts[syncpoint_id]) { 92 auto& interrupt = syncpt_interrupts[syncpoint_id];
93 if (in_value == value) 93 bool contains = std::any_of(interrupt.begin(), interrupt.end(),
94 return; 94 [value](u32 in_value) { return in_value == value; });
95 if (contains) {
96 return;
95 } 97 }
96 syncpt_interrupts[syncpoint_id].emplace_back(value); 98 syncpt_interrupts[syncpoint_id].emplace_back(value);
97} 99}
98 100
99bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) { 101bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) {
100 std::lock_guard lock{sync_mutex}; 102 std::lock_guard lock{sync_mutex};
101 auto it = syncpt_interrupts[syncpoint_id].begin(); 103 auto& interrupt = syncpt_interrupts[syncpoint_id];
102 while (it != syncpt_interrupts[syncpoint_id].end()) { 104 const auto iter =
103 if (value == *it) { 105 std::find_if(interrupt.begin(), interrupt.end(),
104 it = syncpt_interrupts[syncpoint_id].erase(it); 106 [value](u32 interrupt_value) { return value == interrupt_value; });
105 return true; 107
106 } 108 if (iter == interrupt.end()) {
107 it++; 109 return false;
108 } 110 }
109 return false; 111 interrupt.erase(iter);
112 return true;
110} 113}
111 114
112u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { 115u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {