summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir/condition.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/frontend/ir/condition.cpp')
-rw-r--r--src/shader_recompiler/frontend/ir/condition.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/condition.cpp b/src/shader_recompiler/frontend/ir/condition.cpp
new file mode 100644
index 000000000..edff35dc7
--- /dev/null
+++ b/src/shader_recompiler/frontend/ir/condition.cpp
@@ -0,0 +1,31 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <string>
6
7#include <fmt/format.h>
8
9#include "shader_recompiler/frontend/ir/condition.h"
10
11namespace Shader::IR {
12
13std::string NameOf(Condition condition) {
14 std::string ret;
15 if (condition.FlowTest() != FlowTest::T) {
16 ret = fmt::to_string(condition.FlowTest());
17 }
18 const auto [pred, negated]{condition.Pred()};
19 if (pred != Pred::PT || negated) {
20 if (!ret.empty()) {
21 ret += '&';
22 }
23 if (negated) {
24 ret += '!';
25 }
26 ret += fmt::to_string(pred);
27 }
28 return ret;
29}
30
31} // namespace Shader::IR