summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/maxwell/control_flow.cpp
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-07-12 05:22:01 -0300
committerGravatar ameerj2021-07-22 21:51:40 -0400
commitbf2956d77ab0ad06c4b5505cc9906e51e5878274 (patch)
tree3aae336c0dc3fe65351d5e6e312a214351e2e2fc /src/shader_recompiler/frontend/maxwell/control_flow.cpp
parentglsl: Clamp shared mem size to GL_MAX_COMPUTE_SHARED_MEMORY_SIZE (diff)
downloadyuzu-bf2956d77ab0ad06c4b5505cc9906e51e5878274.tar.gz
yuzu-bf2956d77ab0ad06c4b5505cc9906e51e5878274.tar.xz
yuzu-bf2956d77ab0ad06c4b5505cc9906e51e5878274.zip
shader: Avoid usage of C++20 ranges to build in clang
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell/control_flow.cpp')
-rw-r--r--src/shader_recompiler/frontend/maxwell/control_flow.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/control_flow.cpp b/src/shader_recompiler/frontend/maxwell/control_flow.cpp
index e7abea82f..1a954a509 100644
--- a/src/shader_recompiler/frontend/maxwell/control_flow.cpp
+++ b/src/shader_recompiler/frontend/maxwell/control_flow.cpp
@@ -5,7 +5,6 @@
5#include <algorithm> 5#include <algorithm>
6#include <array> 6#include <array>
7#include <optional> 7#include <optional>
8#include <ranges>
9#include <string> 8#include <string>
10#include <utility> 9#include <utility>
11 10
@@ -151,18 +150,18 @@ std::pair<Location, Stack> Stack::Pop(Token token) const {
151} 150}
152 151
153std::optional<Location> Stack::Peek(Token token) const { 152std::optional<Location> Stack::Peek(Token token) const {
154 const auto reverse_entries{entries | std::views::reverse}; 153 const auto it{std::find_if(entries.rbegin(), entries.rend(),
155 const auto it{std::ranges::find(reverse_entries, token, &StackEntry::token)}; 154 [token](const auto& entry) { return entry.token == token; })};
156 if (it == reverse_entries.end()) { 155 if (it == entries.rend()) {
157 return std::nullopt; 156 return std::nullopt;
158 } 157 }
159 return it->target; 158 return it->target;
160} 159}
161 160
162Stack Stack::Remove(Token token) const { 161Stack Stack::Remove(Token token) const {
163 const auto reverse_entries{entries | std::views::reverse}; 162 const auto it{std::find_if(entries.rbegin(), entries.rend(),
164 const auto it{std::ranges::find(reverse_entries, token, &StackEntry::token)}; 163 [token](const auto& entry) { return entry.token == token; })};
165 const auto pos{std::distance(reverse_entries.begin(), it)}; 164 const auto pos{std::distance(entries.rbegin(), it)};
166 Stack result; 165 Stack result;
167 result.entries.insert(result.entries.end(), entries.begin(), entries.end() - pos - 1); 166 result.entries.insert(result.entries.end(), entries.begin(), entries.end() - pos - 1);
168 return result; 167 return result;