Commit d6bcc111 by Nicolas Capens Committed by Nicolas Capens

Fix restoring the break execution enable mask.

Switch statements and loops should not reset the execution enable mask to all lanes at the end, because they can be nested. Instead we can just restore them to the mask value before the switch/loop. Change-Id: I4089cbf637c28f39a536de1e68e2e513ead1ec7f Reviewed-on: https://swiftshader-review.googlesource.com/15908Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 6953d4a1
......@@ -1507,7 +1507,6 @@ namespace sw
Nucleus::setInsertBlock(endBlock);
enableIndex--;
enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
whileTest = false;
}
......@@ -1519,8 +1518,6 @@ namespace sw
Nucleus::createBr(endBlock);
Nucleus::setInsertBlock(endBlock);
enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
}
void PixelProgram::IF(const Src &src)
......@@ -1699,7 +1696,7 @@ namespace sw
Int4 restoreBreak = enableBreak;
Int4 restoreContinue = enableContinue;
// FIXME: jump(testBlock)
// TODO: jump(testBlock)
Nucleus::createBr(testBlock);
Nucleus::setInsertBlock(testBlock);
enableContinue = restoreContinue;
......@@ -1729,6 +1726,15 @@ namespace sw
loopRepTestBlock[loopRepDepth] = nullptr;
loopRepEndBlock[loopRepDepth] = endBlock;
Int4 restoreBreak = enableBreak;
BasicBlock *currentBlock = Nucleus::getInsertBlock();
Nucleus::setInsertBlock(endBlock);
enableBreak = restoreBreak;
Nucleus::setInsertBlock(currentBlock);
loopRepDepth++;
breakDepth = 0;
}
......
......@@ -1267,7 +1267,6 @@ namespace sw
Nucleus::setInsertBlock(endBlock);
enableIndex--;
enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
whileTest = false;
}
......@@ -1279,8 +1278,6 @@ namespace sw
Nucleus::createBr(endBlock);
Nucleus::setInsertBlock(endBlock);
enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
}
void VertexProgram::IF(const Src &src)
......@@ -1460,7 +1457,7 @@ namespace sw
Int4 restoreBreak = enableBreak;
Int4 restoreContinue = enableContinue;
// FIXME: jump(testBlock)
// TODO: jump(testBlock)
Nucleus::createBr(testBlock);
Nucleus::setInsertBlock(testBlock);
enableContinue = restoreContinue;
......@@ -1490,6 +1487,15 @@ namespace sw
loopRepTestBlock[loopRepDepth] = nullptr;
loopRepEndBlock[loopRepDepth] = endBlock;
Int4 restoreBreak = enableBreak;
BasicBlock *currentBlock = Nucleus::getInsertBlock();
Nucleus::setInsertBlock(endBlock);
enableBreak = restoreBreak;
Nucleus::setInsertBlock(currentBlock);
loopRepDepth++;
breakDepth = 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