2021-01-09 06:30:07 +00:00
|
|
|
// Copyright 2021 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <fmt/format.h>
|
|
|
|
|
|
|
|
#include "shader_recompiler/frontend/ir/condition.h"
|
|
|
|
|
|
|
|
namespace Shader::IR {
|
|
|
|
|
|
|
|
std::string NameOf(Condition condition) {
|
|
|
|
std::string ret;
|
2021-04-06 02:25:22 +00:00
|
|
|
if (condition.GetFlowTest() != FlowTest::T) {
|
|
|
|
ret = fmt::to_string(condition.GetFlowTest());
|
2021-01-09 06:30:07 +00:00
|
|
|
}
|
2021-04-06 02:25:22 +00:00
|
|
|
const auto [pred, negated]{condition.GetPred()};
|
2021-02-11 19:39:06 +00:00
|
|
|
if (!ret.empty()) {
|
|
|
|
ret += '&';
|
2021-01-09 06:30:07 +00:00
|
|
|
}
|
2021-02-11 19:39:06 +00:00
|
|
|
if (negated) {
|
|
|
|
ret += '!';
|
|
|
|
}
|
|
|
|
ret += fmt::to_string(pred);
|
2021-01-09 06:30:07 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Shader::IR
|