summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-expr.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-11-29 18:17:33 -0800
committerGitHub <noreply@github.com>2022-11-29 18:17:33 -0800
commitf52b4de3b29ee27213b7d60fb620a0d5d50b49f9 (patch)
treed4570c53045bca8e9411e884b0905d9384430a58 /source/slang/slang-check-expr.cpp
parentf5581786a1891cedb165adb1afe71fe34f26e030 (diff)
Allow `no_diff` modifier on parameters (#2538)
Diffstat (limited to 'source/slang/slang-check-expr.cpp')
-rw-r--r--source/slang/slang-check-expr.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp
index 1f0e1a2dc..4b2d490b7 100644
--- a/source/slang/slang-check-expr.cpp
+++ b/source/slang/slang-check-expr.cpp
@@ -2051,6 +2051,12 @@ namespace Slang
Type* SemanticsVisitor::getDifferentialPairType(Type* primalType)
{
+ if (auto modifiedType = as<ModifiedType>(primalType))
+ {
+ if (modifiedType->findModifier<NoDiffModifierVal>())
+ return modifiedType->base;
+ }
+
// Get a reference to the builtin 'IDifferentiable' interface
auto differentiableInterface = m_astBuilder->getDifferentiableInterface();
@@ -3386,6 +3392,10 @@ namespace Slang
// TODO: validate that `type` is either `float` or a vector of `float`s
return m_astBuilder->getSNormModifierVal();
}
+ else if (auto noDiffModifier = as<NoDiffModifier>(modifier))
+ {
+ return m_astBuilder->getNoDiffModifierVal();
+ }
else
{
// TODO: more complete error message here