summaryrefslogtreecommitdiff
path: root/src/video_core/shader/ast.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2019-10-17 20:05:25 -0400
committerGravatar Lioncash2019-10-17 20:26:13 -0400
commit7f6a8a33d4deefea1c6360d8010893286664175e (patch)
tree1378548963f3b6b9b4e965c282aa3d5ecae7f220 /src/video_core/shader/ast.cpp
parentvideo_core/shader/ast: Make use of fmt where applicable (diff)
downloadyuzu-7f6a8a33d4deefea1c6360d8010893286664175e.tar.gz
yuzu-7f6a8a33d4deefea1c6360d8010893286664175e.tar.xz
yuzu-7f6a8a33d4deefea1c6360d8010893286664175e.zip
video_core/shader/ast: Rename Ident() to Indent()
This can be confusing, given "ident" is generally used as a shorthand for "identifier".
Diffstat (limited to 'src/video_core/shader/ast.cpp')
-rw-r--r--src/video_core/shader/ast.cpp26
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:
251 void operator()(const ASTIfThen& ast) { 251 void operator()(const ASTIfThen& ast) {
252 ExprPrinter expr_parser{}; 252 ExprPrinter expr_parser{};
253 std::visit(expr_parser, *ast.condition); 253 std::visit(expr_parser, *ast.condition);
254 inner += fmt::format("{}if ({}) {{\n", Ident(), expr_parser.GetResult()); 254 inner += fmt::format("{}if ({}) {{\n", Indent(), expr_parser.GetResult());
255 scope++; 255 scope++;
256 ASTNode current = ast.nodes.GetFirst(); 256 ASTNode current = ast.nodes.GetFirst();
257 while (current) { 257 while (current) {
@@ -259,11 +259,11 @@ public:
259 current = current->GetNext(); 259 current = current->GetNext();
260 } 260 }
261 scope--; 261 scope--;
262 inner += fmt::format("{}}}\n", Ident()); 262 inner += fmt::format("{}}}\n", Indent());
263 } 263 }
264 264
265 void operator()(const ASTIfElse& ast) { 265 void operator()(const ASTIfElse& ast) {
266 inner += Ident() + "else {\n"; 266 inner += Indent() + "else {\n";
267 scope++; 267 scope++;
268 ASTNode current = ast.nodes.GetFirst(); 268 ASTNode current = ast.nodes.GetFirst();
269 while (current) { 269 while (current) {
@@ -271,21 +271,21 @@ public:
271 current = current->GetNext(); 271 current = current->GetNext();
272 } 272 }
273 scope--; 273 scope--;
274 inner += Ident() + "}\n"; 274 inner += Indent() + "}\n";
275 } 275 }
276 276
277 void operator()(const ASTBlockEncoded& ast) { 277 void operator()(const ASTBlockEncoded& ast) {
278 inner += fmt::format("{}Block({}, {});\n", Ident(), ast.start, ast.end); 278 inner += fmt::format("{}Block({}, {});\n", Indent(), ast.start, ast.end);
279 } 279 }
280 280
281 void operator()(const ASTBlockDecoded& ast) { 281 void operator()(const ASTBlockDecoded& ast) {
282 inner += Ident() + "Block;\n"; 282 inner += Indent() + "Block;\n";
283 } 283 }
284 284
285 void operator()(const ASTVarSet& ast) { 285 void operator()(const ASTVarSet& ast) {
286 ExprPrinter expr_parser{}; 286 ExprPrinter expr_parser{};
287 std::visit(expr_parser, *ast.condition); 287 std::visit(expr_parser, *ast.condition);
288 inner += fmt::format("{}V{} := {};\n", Ident(), ast.index, expr_parser.GetResult()); 288 inner += fmt::format("{}V{} := {};\n", Indent(), ast.index, expr_parser.GetResult());
289 } 289 }
290 290
291 void operator()(const ASTLabel& ast) { 291 void operator()(const ASTLabel& ast) {
@@ -296,13 +296,13 @@ public:
296 ExprPrinter expr_parser{}; 296 ExprPrinter expr_parser{};
297 std::visit(expr_parser, *ast.condition); 297 std::visit(expr_parser, *ast.condition);
298 inner += 298 inner +=
299 fmt::format("{}({}) -> goto Label_{};\n", Ident(), expr_parser.GetResult(), ast.label); 299 fmt::format("{}({}) -> goto Label_{};\n", Indent(), expr_parser.GetResult(), ast.label);
300 } 300 }
301 301
302 void operator()(const ASTDoWhile& ast) { 302 void operator()(const ASTDoWhile& ast) {
303 ExprPrinter expr_parser{}; 303 ExprPrinter expr_parser{};
304 std::visit(expr_parser, *ast.condition); 304 std::visit(expr_parser, *ast.condition);
305 inner += fmt::format("{}do {{\n", Ident()); 305 inner += fmt::format("{}do {{\n", Indent());
306 scope++; 306 scope++;
307 ASTNode current = ast.nodes.GetFirst(); 307 ASTNode current = ast.nodes.GetFirst();
308 while (current) { 308 while (current) {
@@ -310,23 +310,23 @@ public:
310 current = current->GetNext(); 310 current = current->GetNext();
311 } 311 }
312 scope--; 312 scope--;
313 inner += fmt::format("{}}} while ({});\n", Ident(), expr_parser.GetResult()); 313 inner += fmt::format("{}}} while ({});\n", Indent(), expr_parser.GetResult());
314 } 314 }
315 315
316 void operator()(const ASTReturn& ast) { 316 void operator()(const ASTReturn& ast) {
317 ExprPrinter expr_parser{}; 317 ExprPrinter expr_parser{};
318 std::visit(expr_parser, *ast.condition); 318 std::visit(expr_parser, *ast.condition);
319 inner += fmt::format("{}({}) -> {};\n", Ident(), expr_parser.GetResult(), 319 inner += fmt::format("{}({}) -> {};\n", Indent(), expr_parser.GetResult(),
320 ast.kills ? "discard" : "exit"); 320 ast.kills ? "discard" : "exit");
321 } 321 }
322 322
323 void operator()(const ASTBreak& ast) { 323 void operator()(const ASTBreak& ast) {
324 ExprPrinter expr_parser{}; 324 ExprPrinter expr_parser{};
325 std::visit(expr_parser, *ast.condition); 325 std::visit(expr_parser, *ast.condition);
326 inner += fmt::format("{}({}) -> break;\n", Ident(), expr_parser.GetResult()); 326 inner += fmt::format("{}({}) -> break;\n", Indent(), expr_parser.GetResult());
327 } 327 }
328 328
329 std::string& Ident() { 329 std::string& Indent() {
330 if (memo_scope == scope) { 330 if (memo_scope == scope) {
331 return tabs_memo; 331 return tabs_memo;
332 } 332 }