yuzu/src/shader_recompiler/frontend/ir/condition.cpp

30 lines
651 B
C++
Raw Normal View History

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;
if (condition.GetFlowTest() != FlowTest::T) {
ret = fmt::to_string(condition.GetFlowTest());
2021-01-09 06:30:07 +00:00
}
const auto [pred, negated]{condition.GetPred()};
if (!ret.empty()) {
ret += '&';
2021-01-09 06:30:07 +00:00
}
if (negated) {
ret += '!';
}
ret += fmt::to_string(pred);
2021-01-09 06:30:07 +00:00
return ret;
}
} // namespace Shader::IR