summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-c-like.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
-rw-r--r--source/slang/slang-emit-c-like.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index 2019bfa8c..af53b545f 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -4268,6 +4268,27 @@ void CLikeSourceEmitter::computeEmitActions(IRModule* module, List<EmitAction>&
}
}
+ for (auto inst : module->getGlobalInsts())
+ {
+ // After emitting all structure types we need to emit all raytracing objects to
+ // ensure they are emitted before the layout location is referenced, otherwise,
+ // this can be a compile error if layout is emitted after location is referenced
+ // this is required since in GLSL, it is likley in a programs life time a raytracing
+ // object will never be referenced by name
+ for (auto dec : inst->getDecorations())
+ {
+ switch (dec->getOp())
+ {
+ case kIROp_VulkanRayPayloadDecoration:
+ case kIROp_VulkanRayPayloadInDecoration:
+ case kIROp_VulkanHitObjectAttributesDecoration:
+ case kIROp_VulkanCallablePayloadDecoration:
+ case kIROp_VulkanCallablePayloadInDecoration:
+ case kIROp_VulkanHitAttributesDecoration:
+ ensureGlobalInst(&ctx, inst, EmitAction::Level::Definition);
+ };
+ }
+ }
for(auto inst : module->getGlobalInsts())
{
if( as<IRType>(inst) )