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.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/source/slang/slang-ir-autodiff.cpp b/source/slang/slang-ir-autodiff.cpp
index 5c05b0811..4edd8eabe 100644
--- a/source/slang/slang-ir-autodiff.cpp
+++ b/source/slang/slang-ir-autodiff.cpp
@@ -126,13 +126,22 @@ static IRInst* _getDiffTypeWitnessFromPairType(
bool isNoDiffType(IRType* paramType)
{
- while (auto ptrType = as<IRPtrTypeBase>(paramType))
- paramType = ptrType->getValueType();
- while (auto attrType = as<IRAttributedType>(paramType))
+ while (paramType)
{
- if (attrType->findAttr<IRNoDiffAttr>())
+ if (auto attrType = as<IRAttributedType>(paramType))
{
- return true;
+ if (attrType->findAttr<IRNoDiffAttr>())
+ return true;
+
+ paramType = attrType->getBaseType();
+ }
+ else if (auto ptrType = as<IRPtrTypeBase>(paramType))
+ {
+ paramType = ptrType->getValueType();
+ }
+ else
+ {
+ return false;
}
}
return false;