summaryrefslogblamecommitdiffstats
path: root/src/shader_recompiler/frontend/ir/condition.cpp
blob: fb6b141d34b1f8a61b42d7083b1a568f90d6bd51 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13

                                                               










                                                    

                                                      
     
                                                    

                       
     



                                



                         
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#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());
    }
    const auto [pred, negated]{condition.GetPred()};
    if (!ret.empty()) {
        ret += '&';
    }
    if (negated) {
        ret += '!';
    }
    ret += fmt::to_string(pred);
    return ret;
}

} // namespace Shader::IR