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-reflection-api.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-reflection-api.cpp')
| -rw-r--r-- | source/slang/slang-reflection-api.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp index 5c5773fec..9c1d48a28 100644 --- a/source/slang/slang-reflection-api.cpp +++ b/source/slang/slang-reflection-api.cpp @@ -149,7 +149,7 @@ static SlangParameterCategory maybeRemapParameterCategory( // of this variable? Type* type = typeLayout->getType(); while (auto arrayType = as<ArrayExpressionType>(type)) - type = arrayType->baseType; + type = arrayType->getElementType(); switch (spReflectionType_GetKind(convert(type))) { case SLANG_TYPE_KIND_CONSTANT_BUFFER: @@ -462,7 +462,7 @@ SLANG_API size_t spReflectionType_GetElementCount(SlangReflectionType* inType) if(auto arrayType = as<ArrayExpressionType>(type)) { - return arrayType->arrayLength ? (size_t) getIntVal(arrayType->arrayLength) : 0; + return !arrayType->isUnsized() ? (size_t)getIntVal(arrayType->getElementCount()) : 0; } else if( auto vectorType = as<VectorExpressionType>(type)) { @@ -479,7 +479,7 @@ SLANG_API SlangReflectionType* spReflectionType_GetElementType(SlangReflectionTy if(auto arrayType = as<ArrayExpressionType>(type)) { - return (SlangReflectionType*) arrayType->baseType; + return (SlangReflectionType*) arrayType->getElementType(); } else if( auto parameterGroupType = as<ParameterGroupType>(type)) { @@ -631,7 +631,7 @@ SLANG_API SlangResourceShape spReflectionType_GetResourceShape(SlangReflectionTy while(auto arrayType = as<ArrayExpressionType>(type)) { - type = arrayType->baseType; + type = arrayType->getElementType(); } if(auto textureType = as<TextureTypeBase>(type)) @@ -667,7 +667,7 @@ SLANG_API SlangResourceAccess spReflectionType_GetResourceAccess(SlangReflection while(auto arrayType = as<ArrayExpressionType>(type)) { - type = arrayType->baseType; + type = arrayType->getElementType(); } if(auto textureType = as<TextureTypeBase>(type)) @@ -763,7 +763,7 @@ SLANG_API SlangReflectionType* spReflectionType_GetResourceResultType(SlangRefle while(auto arrayType = as<ArrayExpressionType>(type)) { - type = arrayType->baseType; + type = arrayType->getElementType(); } if (auto textureType = as<TextureTypeBase>(type)) @@ -1492,9 +1492,9 @@ namespace Slang LayoutSize elementCount = LayoutSize::infinite(); if( auto arrayType = as<ArrayExpressionType>(arrayTypeLayout->type) ) { - if( auto elementCountVal = arrayType->arrayLength ) + if( !arrayType->isUnsized()) { - elementCount = LayoutSize::RawValue(getIntVal(elementCountVal)); + elementCount = LayoutSize::RawValue(getIntVal(arrayType->getElementCount())); } } addRangesRec(elementTypeLayout, path, multiplier * elementCount); |
