condition.cpp 642 B

1234567891011121314151617181920212223242526272829
  1. // Copyright 2021 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <string>
  5. #include <fmt/format.h>
  6. #include "shader_recompiler/frontend/ir/condition.h"
  7. namespace Shader::IR {
  8. std::string NameOf(Condition condition) {
  9. std::string ret;
  10. if (condition.FlowTest() != FlowTest::T) {
  11. ret = fmt::to_string(condition.FlowTest());
  12. }
  13. const auto [pred, negated]{condition.Pred()};
  14. if (!ret.empty()) {
  15. ret += '&';
  16. }
  17. if (negated) {
  18. ret += '!';
  19. }
  20. ret += fmt::to_string(pred);
  21. return ret;
  22. }
  23. } // namespace Shader::IR