diff options
| author | Yong He <yonghe@outlook.com> | 2024-03-07 23:44:19 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-07 23:44:19 -0800 |
| commit | faaa532aeda5bb171222134a7128254a34b87a2a (patch) | |
| tree | 7b421f94aaba96f0efaa665a1ad276a766bb6dd3 /source | |
| parent | a810aa31f5f366d69e67be96c169fec7d6041df7 (diff) | |
[SPIRV] Fix pointer lowering bug. (#3713)
* [SPIRV] Fix pointer lowering bug.
* Update falcor CI setting.
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(); |
