Commit 555f7e1a by Nicolas Capens

Fix evaluating empty loop condition to true.

Bug 27351438 Change-Id: If15f0f91931f34af6e78ad773036b91ff5d57d01 Reviewed-on: https://swiftshader-review.googlesource.com/4902Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 1c92d06a
...@@ -1676,11 +1676,11 @@ namespace glsl ...@@ -1676,11 +1676,11 @@ namespace glsl
TIntermTyped *condition = node->getCondition(); TIntermTyped *condition = node->getCondition();
TIntermTyped *expression = node->getExpression(); TIntermTyped *expression = node->getExpression();
TIntermNode *body = node->getBody(); TIntermNode *body = node->getBody();
Constant True(true);
if(node->getType() == ELoopDoWhile) if(node->getType() == ELoopDoWhile)
{ {
Temporary iterate(this); Temporary iterate(this);
Constant True(true);
emit(sw::Shader::OPCODE_MOV, &iterate, &True); emit(sw::Shader::OPCODE_MOV, &iterate, &True);
emit(sw::Shader::OPCODE_WHILE, 0, &iterate); // FIXME: Implement real do-while emit(sw::Shader::OPCODE_WHILE, 0, &iterate); // FIXME: Implement real do-while
...@@ -1727,6 +1727,10 @@ namespace glsl ...@@ -1727,6 +1727,10 @@ namespace glsl
{ {
condition->traverse(this); condition->traverse(this);
} }
else
{
condition = &True;
}
emit(sw::Shader::OPCODE_WHILE, 0, condition); emit(sw::Shader::OPCODE_WHILE, 0, condition);
......
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