diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-emit-spirv.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index 098c2cc2b..1b5747621 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -5805,14 +5805,23 @@ SlangResult emitSPIRVFromIR( } // Move forward delcared pointers to the end. - for (auto ptrType : context.m_forwardDeclaredPointers) + do { - auto spvPtrType = context.m_mapIRInstToSpvInst[ptrType]; - context.ensureInst(ptrType->getValueType()); - auto parent = spvPtrType->parent; - spvPtrType->removeFromParent(); - parent->addInst(spvPtrType); - } + auto fwdPointers = context.m_forwardDeclaredPointers; + context.m_forwardDeclaredPointers.clear(); + + for (auto ptrType : fwdPointers) + { + auto spvPtrType = context.m_mapIRInstToSpvInst[ptrType]; + // When we emit a pointee type, we may introduce new + // forward-declared pointer types, so we need to + // keep iterating until we have emitted all of them. + context.ensureInst(ptrType->getValueType()); + auto parent = spvPtrType->parent; + spvPtrType->removeFromParent(); + parent->addInst(spvPtrType); + } + } while (context.m_forwardDeclaredPointers.getCount() != 0); context.emitFrontMatter(); |
