From 9a231a5efb0ddce635e7e40c2d5b086ff4bd389a Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Thu, 12 Oct 2017 10:30:48 -0700 Subject: Do loop fix (#209) * Bug fix: emit logic for `do` loops This case was never tested, and I was outputting some garbage characters. This comit fixes the codegen and adds a test case. * Bug fix: make sure to pass through `[allow_uav_condition]` This also fixes the standard library definition of `IncrementCounter()` so that it returns a `uint` instead of `void`. --- source/slang/emit.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source/slang/emit.cpp') diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 8483caefc..7d7553bc5 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -2637,6 +2637,10 @@ struct EmitVisitor { Emit("[unroll]"); } + else if(getText(attr->getName()) == "allow_uav_condition") + { + Emit("[allow_uav_condition]"); + } } } @@ -2790,11 +2794,11 @@ struct EmitVisitor { EmitLoopAttributes(doWhileStmt); - Emit("do("); + Emit("do\n"); EmitBlockStmt(doWhileStmt->Statement); Emit(" while("); EmitExpr(doWhileStmt->Predicate); - Emit(")\n"); + Emit(");\n"); return; } else if (auto discardStmt = stmt.As()) -- cgit v1.2.3