summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-10-06 14:03:18 -0700
committerGitHub <noreply@github.com>2023-10-06 14:03:18 -0700
commit17c7163c2ae8fc290e70b43d8700b68ef18b1ee1 (patch)
tree09df040039fb1221810f956bb83871430cbac47f /source/slang/slang-ir.cpp
parent4547125ce945140dc10542e9606b225dd06159b8 (diff)
Small type system fixes. (#3265)
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index 6a3a26bd5..cf58e6cd4 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -4848,19 +4848,20 @@ namespace Slang
{
IRType* type = nullptr;
auto basePtrType = as<IRPtrTypeBase>(basePtr->getDataType());
- if (auto arrayType = as<IRArrayType>(basePtrType->getValueType()))
+ auto valueType = unwrapAttributedType(basePtrType->getValueType());
+ if (auto arrayType = as<IRArrayType>(valueType))
{
type = arrayType->getElementType();
}
- else if (auto vectorType = as<IRVectorType>(basePtrType->getValueType()))
+ else if (auto vectorType = as<IRVectorType>(valueType))
{
type = vectorType->getElementType();
}
- else if (auto matrixType = as<IRMatrixType>(basePtrType->getValueType()))
+ else if (auto matrixType = as<IRMatrixType>(valueType))
{
type = getVectorType(matrixType->getElementType(), matrixType->getColumnCount());
}
- else if (const auto basicType = as<IRBasicType>(basePtrType->getValueType()))
+ else if (const auto basicType = as<IRBasicType>(valueType))
{
// HLSL support things like float.x, in which case we just return the base pointer.
return basePtr;
@@ -4884,10 +4885,11 @@ namespace Slang
for (auto access : accessChain)
{
auto basePtrType = cast<IRPtrTypeBase>(basePtr->getDataType());
+ auto valueType = unwrapAttributedType(basePtrType->getValueType());
IRType* resultType = nullptr;
if (auto structKey = as<IRStructKey>(access))
{
- auto structType = as<IRStructType>(basePtrType->getValueType());
+ auto structType = as<IRStructType>(valueType);
SLANG_RELEASE_ASSERT(structType);
for (auto field : structType->getFields())
{