We emit loop header variables even for while and dowhile.
Make the name clearer.
This commit is contained in:
parent
8bfb04d29d
commit
cff057ca5a
@ -10565,7 +10565,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
|
|||||||
bool select_branch_to_true_block = false;
|
bool select_branch_to_true_block = false;
|
||||||
bool select_branch_to_false_block = false;
|
bool select_branch_to_false_block = false;
|
||||||
bool skip_direct_branch = false;
|
bool skip_direct_branch = false;
|
||||||
bool emitted_for_loop_header = false;
|
bool emitted_loop_header_variables = false;
|
||||||
bool force_complex_continue_block = false;
|
bool force_complex_continue_block = false;
|
||||||
|
|
||||||
emit_hoisted_temporaries(block.declare_temporary);
|
emit_hoisted_temporaries(block.declare_temporary);
|
||||||
@ -10592,7 +10592,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
|
|||||||
else
|
else
|
||||||
select_branch_to_true_block = true;
|
select_branch_to_true_block = true;
|
||||||
|
|
||||||
emitted_for_loop_header = true;
|
emitted_loop_header_variables = true;
|
||||||
force_complex_continue_block = true;
|
force_complex_continue_block = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10608,7 +10608,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
|
|||||||
else
|
else
|
||||||
select_branch_to_true_block = true;
|
select_branch_to_true_block = true;
|
||||||
|
|
||||||
emitted_for_loop_header = true;
|
emitted_loop_header_variables = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// This is the newer loop behavior in glslang which branches from Loop header directly to
|
// This is the newer loop behavior in glslang which branches from Loop header directly to
|
||||||
@ -10619,14 +10619,14 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
|
|||||||
if (attempt_emit_loop_header(block, SPIRBlock::MergeToDirectForLoop))
|
if (attempt_emit_loop_header(block, SPIRBlock::MergeToDirectForLoop))
|
||||||
{
|
{
|
||||||
skip_direct_branch = true;
|
skip_direct_branch = true;
|
||||||
emitted_for_loop_header = true;
|
emitted_loop_header_variables = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (continue_type == SPIRBlock::DoWhileLoop)
|
else if (continue_type == SPIRBlock::DoWhileLoop)
|
||||||
{
|
{
|
||||||
flush_undeclared_variables(block);
|
flush_undeclared_variables(block);
|
||||||
emit_while_loop_initializers(block);
|
emit_while_loop_initializers(block);
|
||||||
emitted_for_loop_header = true;
|
emitted_loop_header_variables = true;
|
||||||
// We have some temporaries where the loop header is the dominator.
|
// We have some temporaries where the loop header is the dominator.
|
||||||
// We risk a case where we have code like:
|
// We risk a case where we have code like:
|
||||||
// for (;;) { create-temporary; break; } consume-temporary;
|
// for (;;) { create-temporary; break; } consume-temporary;
|
||||||
@ -10641,6 +10641,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
|
|||||||
{
|
{
|
||||||
flush_undeclared_variables(block);
|
flush_undeclared_variables(block);
|
||||||
emit_while_loop_initializers(block);
|
emit_while_loop_initializers(block);
|
||||||
|
emitted_loop_header_variables = true;
|
||||||
|
|
||||||
// We have a generic loop without any distinguishable pattern like for, while or do while.
|
// We have a generic loop without any distinguishable pattern like for, while or do while.
|
||||||
get<SPIRBlock>(block.continue_block).complex_continue = true;
|
get<SPIRBlock>(block.continue_block).complex_continue = true;
|
||||||
@ -10663,7 +10664,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
|
|||||||
|
|
||||||
// If we didn't successfully emit a loop header and we had loop variable candidates, we have a problem
|
// If we didn't successfully emit a loop header and we had loop variable candidates, we have a problem
|
||||||
// as writes to said loop variables might have been masked out, we need a recompile.
|
// as writes to said loop variables might have been masked out, we need a recompile.
|
||||||
if (!emitted_for_loop_header && !block.loop_variables.empty())
|
if (!emitted_loop_header_variables && !block.loop_variables.empty())
|
||||||
{
|
{
|
||||||
force_recompile = true;
|
force_recompile = true;
|
||||||
for (auto var : block.loop_variables)
|
for (auto var : block.loop_variables)
|
||||||
|
Loading…
Reference in New Issue
Block a user