diff options
author | Lioncash <mathew1800@gmail.com> | 2019-10-18 02:05:25 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-10-18 02:26:13 +0200 |
commit | 7f6a8a33d4deefea1c6360d8010893286664175e (patch) | |
tree | 1378548963f3b6b9b4e965c282aa3d5ecae7f220 | |
parent | video_core/shader/ast: Make use of fmt where applicable (diff) | |
download | yuzu-7f6a8a33d4deefea1c6360d8010893286664175e.tar yuzu-7f6a8a33d4deefea1c6360d8010893286664175e.tar.gz yuzu-7f6a8a33d4deefea1c6360d8010893286664175e.tar.bz2 yuzu-7f6a8a33d4deefea1c6360d8010893286664175e.tar.lz yuzu-7f6a8a33d4deefea1c6360d8010893286664175e.tar.xz yuzu-7f6a8a33d4deefea1c6360d8010893286664175e.tar.zst yuzu-7f6a8a33d4deefea1c6360d8010893286664175e.zip |
-rw-r--r-- | src/video_core/shader/ast.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/video_core/shader/ast.cpp b/src/video_core/shader/ast.cpp index 0be048044..ea121e9d5 100644 --- a/src/video_core/shader/ast.cpp +++ b/src/video_core/shader/ast.cpp @@ -251,7 +251,7 @@ public: void operator()(const ASTIfThen& ast) { ExprPrinter expr_parser{}; std::visit(expr_parser, *ast.condition); - inner += fmt::format("{}if ({}) {{\n", Ident(), expr_parser.GetResult()); + inner += fmt::format("{}if ({}) {{\n", Indent(), expr_parser.GetResult()); scope++; ASTNode current = ast.nodes.GetFirst(); while (current) { @@ -259,11 +259,11 @@ public: current = current->GetNext(); } scope--; - inner += fmt::format("{}}}\n", Ident()); + inner += fmt::format("{}}}\n", Indent()); } void operator()(const ASTIfElse& ast) { - inner += Ident() + "else {\n"; + inner += Indent() + "else {\n"; scope++; ASTNode current = ast.nodes.GetFirst(); while (current) { @@ -271,21 +271,21 @@ public: current = current->GetNext(); } scope--; - inner += Ident() + "}\n"; + inner += Indent() + "}\n"; } void operator()(const ASTBlockEncoded& ast) { - inner += fmt::format("{}Block({}, {});\n", Ident(), ast.start, ast.end); + inner += fmt::format("{}Block({}, {});\n", Indent(), ast.start, ast.end); } void operator()(const ASTBlockDecoded& ast) { - inner += Ident() + "Block;\n"; + inner += Indent() + "Block;\n"; } void operator()(const ASTVarSet& ast) { ExprPrinter expr_parser{}; std::visit(expr_parser, *ast.condition); - inner += fmt::format("{}V{} := {};\n", Ident(), ast.index, expr_parser.GetResult()); + inner += fmt::format("{}V{} := {};\n", Indent(), ast.index, expr_parser.GetResult()); } void operator()(const ASTLabel& ast) { @@ -296,13 +296,13 @@ public: ExprPrinter expr_parser{}; std::visit(expr_parser, *ast.condition); inner += - fmt::format("{}({}) -> goto Label_{};\n", Ident(), expr_parser.GetResult(), ast.label); + fmt::format("{}({}) -> goto Label_{};\n", Indent(), expr_parser.GetResult(), ast.label); } void operator()(const ASTDoWhile& ast) { ExprPrinter expr_parser{}; std::visit(expr_parser, *ast.condition); - inner += fmt::format("{}do {{\n", Ident()); + inner += fmt::format("{}do {{\n", Indent()); scope++; ASTNode current = ast.nodes.GetFirst(); while (current) { @@ -310,23 +310,23 @@ public: current = current->GetNext(); } scope--; - inner += fmt::format("{}}} while ({});\n", Ident(), expr_parser.GetResult()); + inner += fmt::format("{}}} while ({});\n", Indent(), expr_parser.GetResult()); } void operator()(const ASTReturn& ast) { ExprPrinter expr_parser{}; std::visit(expr_parser, *ast.condition); - inner += fmt::format("{}({}) -> {};\n", Ident(), expr_parser.GetResult(), + inner += fmt::format("{}({}) -> {};\n", Indent(), expr_parser.GetResult(), ast.kills ? "discard" : "exit"); } void operator()(const ASTBreak& ast) { ExprPrinter expr_parser{}; std::visit(expr_parser, *ast.condition); - inner += fmt::format("{}({}) -> break;\n", Ident(), expr_parser.GetResult()); + inner += fmt::format("{}({}) -> break;\n", Indent(), expr_parser.GetResult()); } - std::string& Ident() { + std::string& Indent() { if (memo_scope == scope) { return tabs_memo; } |