Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2021-06-03 13:19:10 +0300
committerHans-Kristian Arntzen <post@arntzen-software.no>2021-06-03 13:19:10 +0300
commit449f68ef3b0bc7ed1d62aea63beee4f85967fb60 (patch)
treee0541c791072686ad3f2abea2fd94433fa91b531 /spirv_glsl.cpp
parentd62b3c2b92c7624803719105db8c4d24d35206fe (diff)
Ensure loop control flow hints only appear above loops.
Diffstat (limited to 'spirv_glsl.cpp')
-rw-r--r--spirv_glsl.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp
index 947be8da..aa5e5fa2 100644
--- a/spirv_glsl.cpp
+++ b/spirv_glsl.cpp
@@ -14016,7 +14016,10 @@ void CompilerGLSL::branch(BlockID from, uint32_t cond, BlockID true_block, Block
if (!true_block_needs_code && !false_block_needs_code)
return;
- emit_block_hints(get<SPIRBlock>(from));
+ // We might have a loop merge here. Only consider selection flattening constructs.
+ // Loop hints are handled explicitly elsewhere.
+ if (from_block.hint == SPIRBlock::HintFlatten || from_block.hint == SPIRBlock::HintDontFlatten)
+ emit_block_hints(from_block);
if (true_block_needs_code)
{
@@ -14522,6 +14525,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
// for (;;) { create-temporary; break; } consume-temporary;
// so force-declare temporaries here.
emit_hoisted_temporaries(block.potential_declare_temporary);
+ emit_block_hints(block);
statement("for (;;)");
begin_scope();