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

29 lines
632 B
C++
Raw Normal View History

// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2021-01-09 00:30:07 -06:00
#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 00:30:07 -06:00
}
const auto [pred, negated]{condition.GetPred()};
if (!ret.empty()) {
ret += '&';
2021-01-09 00:30:07 -06:00
}
if (negated) {
ret += '!';
}
ret += fmt::to_string(pred);
2021-01-09 00:30:07 -06:00
return ret;
}
} // namespace Shader::IR