diff options
| author | Yong He <yonghe@outlook.com> | 2023-01-30 19:24:09 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-30 19:24:09 -0800 |
| commit | 499b0253c224e68ceed6e5b6b1ee9cd7d65aad0f (patch) | |
| tree | 4c570a36d305c8909d633183694e0d1225f044c2 /source/slang/slang-type-layout.cpp | |
| parent | 134dd7eb26fc7988ae13559d276cbf337b4b9d27 (diff) | |
Make ArrayExpressionType a DeclRefType and define its autodiff extension in stdlib. (#2615)
* Allow array parameters in forward diff.
* Use type canonicalization instead of coersion.
* Reimplement array type.
* Fix.
* Update test case.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-type-layout.cpp')
| -rw-r--r-- | source/slang/slang-type-layout.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/slang/slang-type-layout.cpp b/source/slang/slang-type-layout.cpp index 45bacaa44..3da0cc95a 100644 --- a/source/slang/slang-type-layout.cpp +++ b/source/slang/slang-type-layout.cpp @@ -1467,6 +1467,8 @@ static LayoutSize GetElementCount(IntVal* val) if (auto constantVal = as<ConstantIntVal>(val)) { + if (constantVal->value == kUnsizedArrayMagicLength) + return LayoutSize::infinite(); return LayoutSize(LayoutSize::RawValue(constantVal->value)); } else if( auto varRefVal = as<GenericParamIntVal>(val) ) @@ -3669,7 +3671,7 @@ static TypeLayoutResult _createTypeLayout( } else if (auto arrayType = as<ArrayExpressionType>(type)) { - return createArrayLikeTypeLayout(context, arrayType, arrayType->baseType, arrayType->arrayLength); + return createArrayLikeTypeLayout(context, arrayType, arrayType->getElementType(), arrayType->getElementCount()); } else if (auto declRefType = as<DeclRefType>(type)) { |
