Mark loop headers as complex as early as possible.

We had a case where loops were marked complex in a cascading fashion
where each loop iteration would discover one new complex loop. This was
a problem with three nested loops.
This commit is contained in:
Hans-Kristian Arntzen 2019-11-26 11:01:39 +01:00
parent 70017c6731
commit f5cb08c42f

View File

@ -12119,7 +12119,12 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
SPIRBlock::ContinueBlockType continue_type = SPIRBlock::ContinueNone;
if (block.continue_block)
{
continue_type = continue_block_type(get<SPIRBlock>(block.continue_block));
// If we know we cannot emit a loop, mark the block early as a complex loop so we don't force unnecessary recompiles.
if (continue_type == SPIRBlock::ComplexLoop)
block.complex_continue = true;
}
// If we have loop variables, stop masking out access to the variable now.
for (auto var_id : block.loop_variables)