From 17c7163c2ae8fc290e70b43d8700b68ef18b1ee1 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 6 Oct 2023 14:03:18 -0700 Subject: Small type system fixes. (#3265) --- source/slang/slang-ir.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source/slang/slang-ir.cpp') 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(basePtr->getDataType()); - if (auto arrayType = as(basePtrType->getValueType())) + auto valueType = unwrapAttributedType(basePtrType->getValueType()); + if (auto arrayType = as(valueType)) { type = arrayType->getElementType(); } - else if (auto vectorType = as(basePtrType->getValueType())) + else if (auto vectorType = as(valueType)) { type = vectorType->getElementType(); } - else if (auto matrixType = as(basePtrType->getValueType())) + else if (auto matrixType = as(valueType)) { type = getVectorType(matrixType->getElementType(), matrixType->getColumnCount()); } - else if (const auto basicType = as(basePtrType->getValueType())) + else if (const auto basicType = as(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(basePtr->getDataType()); + auto valueType = unwrapAttributedType(basePtrType->getValueType()); IRType* resultType = nullptr; if (auto structKey = as(access)) { - auto structType = as(basePtrType->getValueType()); + auto structType = as(valueType); SLANG_RELEASE_ASSERT(structType); for (auto field : structType->getFields()) { -- cgit v1.2.3