From c0943661e5441bfb996430c4f67fb4dddea9dfcf Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 20 Oct 2020 19:07:14 -0700 Subject: Bottleneck interface dispatch calls through a single function. (#1584) --- source/slang/slang-ir.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/slang/slang-ir.cpp') diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 6f0cc43e2..778f066dd 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -5559,5 +5559,16 @@ namespace Slang { return inst->findDecoration() != nullptr; } + IRFunc* getParentFunc(IRInst* inst) + { + auto parent = inst->getParent(); + while (parent) + { + if (auto func = as(parent)) + return func; + parent = parent->getParent(); + } + return nullptr; + } } // namespace Slang -- cgit v1.2.3