From a12c5511a9003efb23b265a7f2f613cf49aa9f07 Mon Sep 17 00:00:00 2001 From: Yong He Date: Sat, 4 Feb 2023 20:07:14 -0800 Subject: Patch transcription of `inout` non differentiable params. (#2623) --- source/slang/slang-check-expr.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-check-expr.cpp') diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index a52a08f15..7e2bc3822 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -2232,9 +2232,18 @@ namespace Slang { if (as(derivType)) { - // Using inout type on all the derivative parameters + // An `in` differentiable parameter becomes an `inout` parameter. derivType = m_astBuilder->getInOutType(derivType); } + else if (auto inoutType = as(derivType)) + { + if (!as(inoutType->getValueType())) + { + // An `inout` non differentiable parameter becomes an `in` parameter + // (removing `out`). + derivType = inoutType->getValueType(); + } + } type->paramTypes.add(derivType); } } -- cgit v1.2.3