summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-spirv-legalize.cpp
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2024-11-18 16:34:03 -0500
committerGitHub <noreply@github.com>2024-11-18 13:34:03 -0800
commitec5e019fa9732b99b75b2a3ca4f2ff5a7a3d2f33 (patch)
treef314f5b16ad18dd3325a7c3a4228242d6d448752 /source/slang/slang-ir-spirv-legalize.cpp
parent05903f708856a70d68bf41bbfb2b06620508dee0 (diff)
Add `IDifferentiablePtrType` support for arrays (#5576)
* Add `IDifferentiablePtrType` support for arrays - Also fixes an issue with spirv-emit of constructors that contain references to global params * Fix GLSL legalization for arrays of resource types
Diffstat (limited to 'source/slang/slang-ir-spirv-legalize.cpp')
-rw-r--r--source/slang/slang-ir-spirv-legalize.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/slang/slang-ir-spirv-legalize.cpp b/source/slang/slang-ir-spirv-legalize.cpp
index 4baa28d67..1de2edd4a 100644
--- a/source/slang/slang-ir-spirv-legalize.cpp
+++ b/source/slang/slang-ir-spirv-legalize.cpp
@@ -1465,15 +1465,21 @@ struct SPIRVLegalizationContext : public SourceEmitterBase
void maybeHoistConstructInstToGlobalScope(IRInst* inst)
{
- // If all of the operands to this instruction are global, we can hoist
- // this constructor to be a global too. This is important to make sure
+ // If all of the operands to this instruction are global, and are not global
+ // variables, we can hoist this constructor to be a global too.
+ // This is important to make sure
// that vectors made of constant components end up being emitted as
// constant vectors (using OpConstantComposite).
UIndex opIndex = 0;
for (auto operand = inst->getOperands(); opIndex < inst->getOperandCount();
operand++, opIndex++)
+ {
if (operand->get()->getParent() != m_module->getModuleInst())
return;
+
+ if (as<IRGlobalParam>(operand->get()))
+ return;
+ }
inst->insertAtEnd(m_module->getModuleInst());
}