Commit 0c6f9360 by John Kessenich

HLSL: Fix #96: Support do-while loop substatements with no curly braces.

parent 67027189
...@@ -118,8 +118,9 @@ gl_FragCoord origin is upper left ...@@ -118,8 +118,9 @@ gl_FragCoord origin is upper left
0:24 Convert int to bool ( temp bool) 0:24 Convert int to bool ( temp bool)
0:24 'i' ( temp int) 0:24 'i' ( temp int)
0:24 Loop Body 0:24 Loop Body
0:24 Pre-Decrement ( temp int) 0:? Sequence
0:24 'i' ( temp int) 0:24 Pre-Decrement ( temp int)
0:24 'i' ( temp int)
0:? Sequence 0:? Sequence
0:26 Loop with condition tested first 0:26 Loop with condition tested first
0:26 Loop Condition 0:26 Loop Condition
...@@ -286,8 +287,9 @@ gl_FragCoord origin is upper left ...@@ -286,8 +287,9 @@ gl_FragCoord origin is upper left
0:24 Convert int to bool ( temp bool) 0:24 Convert int to bool ( temp bool)
0:24 'i' ( temp int) 0:24 'i' ( temp int)
0:24 Loop Body 0:24 Loop Body
0:24 Pre-Decrement ( temp int) 0:? Sequence
0:24 'i' ( temp int) 0:24 Pre-Decrement ( temp int)
0:24 'i' ( temp int)
0:? Sequence 0:? Sequence
0:26 Loop with condition tested first 0:26 Loop with condition tested first
0:26 Loop Condition 0:26 Loop Condition
......
float4 PixelShaderFunction(float4 input) : COLOR0 float4 PixelShaderFunction(float input) : COLOR0
{ {
[unroll] do {} while (false); [unroll] do {} while (false);
[unroll] do {;} while (false); [unroll] do {;} while (false);
do { return input; } while (all(input == input)); do { return (float4)input; } while (input > 2.0);
do ++input; while (input < 10.0);
do while (++input < 10.0); while (++input < 10.0); // nest while inside do-while
return (float4)input;
} }
...@@ -3328,18 +3328,12 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement) ...@@ -3328,18 +3328,12 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement)
case EHTokDo: case EHTokDo:
parseContext.nestLooping(); parseContext.nestLooping();
if (! acceptTokenClass(EHTokLeftBrace))
expected("{");
// statement // statement
if (! peekTokenClass(EHTokRightBrace) && ! acceptScopedStatement(statement)) { if (! acceptScopedStatement(statement)) {
expected("do sub-statement"); expected("do sub-statement");
return false; return false;
} }
if (! acceptTokenClass(EHTokRightBrace))
expected("}");
// WHILE // WHILE
if (! acceptTokenClass(EHTokWhile)) { if (! acceptTokenClass(EHTokWhile)) {
expected("while"); expected("while");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment