summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-autodiff.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir-autodiff.cpp')
-rw-r--r--source/slang/slang-ir-autodiff.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/slang/slang-ir-autodiff.cpp b/source/slang/slang-ir-autodiff.cpp
index afd698e8b..f70e30b72 100644
--- a/source/slang/slang-ir-autodiff.cpp
+++ b/source/slang/slang-ir-autodiff.cpp
@@ -147,6 +147,20 @@ bool isNoDiffType(IRType* paramType)
return false;
}
+// Return true if the result type and all the parameter types are no_diff
+bool isNeverDiffFuncType(IRFuncType* const funcType)
+{
+ const auto resultType = funcType->getResultType();
+ if (!isNoDiffType(resultType))
+ return false;
+ for (const auto p : funcType->getParamTypes())
+ {
+ if (!isNoDiffType(p))
+ return false;
+ }
+ return true;
+}
+
IRInst* lookupForwardDerivativeReference(IRInst* primalFunction)
{
if (auto jvpDefinition = primalFunction->findDecoration<IRForwardDerivativeDecoration>())