From d87493a46c00be37b820a473c0827bbb865eb222 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 2 Oct 2023 15:39:34 -0700 Subject: More direct-SPIRV fixes. (#3257) * More direct-SPIRV fixes. * Fix array-reg-to-mem. --------- Co-authored-by: Yong He --- source/slang/slang-ir-util.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source/slang/slang-ir-util.cpp') diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp index b4a41f8a5..5ecbc8121 100644 --- a/source/slang/slang-ir-util.cpp +++ b/source/slang/slang-ir-util.cpp @@ -814,6 +814,24 @@ IRInst* findWitnessTableEntry(IRWitnessTable* table, IRInst* key) return nullptr; } +IRInst* getVulkanPayloadLocation(IRInst* payloadGlobalVar) +{ + IRInst* location = nullptr; + for (auto decor : payloadGlobalVar->getDecorations()) + { + switch (decor->getOp()) + { + case kIROp_VulkanRayPayloadDecoration: + case kIROp_VulkanCallablePayloadDecoration: + case kIROp_VulkanHitObjectAttributesDecoration: + return decor->getOperand(0); + default: + continue; + } + } + return location; +} + void moveParams(IRBlock* dest, IRBlock* src) { for (auto param = src->getFirstChild(); param;) -- cgit v1.2.3