Commit 2ff2948b by Nicolas Capens

Don't continue looping when having returned from shader function.

Previously we would mask instruction execution after hitting a LEAVE, but still jump back on every loop iteration (even if infinite). This change applies the enableLeave mask to the loop test condition so we break out of the loop when all strands have hit LEAVE. Change-Id: Ia331a91fb363d20743d5b87a468c3cfcaa7b481e Reviewed-on: https://swiftshader-review.googlesource.com/5250Tested-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 26ea8f5e
...@@ -1656,6 +1656,7 @@ namespace sw ...@@ -1656,6 +1656,7 @@ namespace sw
const Vector4f &src = fetchRegister(temporaryRegister); const Vector4f &src = fetchRegister(temporaryRegister);
Int4 condition = As<Int4>(src.x); Int4 condition = As<Int4>(src.x);
condition &= enableStack[enableIndex - 1]; condition &= enableStack[enableIndex - 1];
if(shader->containsLeaveInstruction()) condition &= enableLeave;
enableStack[enableIndex] = condition; enableStack[enableIndex] = condition;
Bool notAllFalse = SignMask(condition) != 0; Bool notAllFalse = SignMask(condition) != 0;
......
...@@ -1438,6 +1438,7 @@ namespace sw ...@@ -1438,6 +1438,7 @@ namespace sw
const Vector4f &src = fetchRegister(temporaryRegister); const Vector4f &src = fetchRegister(temporaryRegister);
Int4 condition = As<Int4>(src.x); Int4 condition = As<Int4>(src.x);
condition &= enableStack[enableIndex - 1]; condition &= enableStack[enableIndex - 1];
if(shader->containsLeaveInstruction()) condition &= enableLeave;
enableStack[enableIndex] = condition; enableStack[enableIndex] = condition;
Bool notAllFalse = SignMask(condition) != 0; Bool notAllFalse = SignMask(condition) != 0;
......
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