1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

[spirv] Account for unreachable continue blocks

Fixes code gen in the following pattern encountered in Black Ops 3:

loop
  break
endloop

We cannot eliminate the loop since we have to adhere to structured
control flow rules, which might be broken if the code inside the
loop was non-trivial.
This commit is contained in:
Philip Rebohle 2024-09-03 20:24:22 +02:00 committed by Philip Rebohle
parent 427e706a40
commit d0ea5a4a87

View File

@ -3973,9 +3973,18 @@ namespace dxvk {
branches.insert({ blockId, ins.arg(i) });
} break;
case spv::OpSelectionMerge:
case spv::OpSelectionMerge: {
mergeBlocks.insert(ins.arg(1));
} break;
case spv::OpLoopMerge: {
mergeBlocks.insert(ins.arg(1));
// It is possible for the continue block to be unreachable in
// practice, but we still need to emit it if we are not going
// to eliminate this loop. Since the current block dominates
// the loop, use it to keep the continue block intact.
branches.insert({ blockId, ins.arg(2) });
} break;
default:;