summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-08-16 22:47:35 -0700
committerGitHub <noreply@github.com>2023-08-17 13:47:35 +0800
commit216fc18661fd6e05053b4cc864396e6017e85b04 (patch)
tree48dfd4aef767694f3063d3c79bcc0a1e3c184346 /source/slang/slang-ir.cpp
parenta0ee2bf671d61d1e2b561db3966e57ffc802040f (diff)
Create storage types of different layouts for SPIRV emit. (#3116)
* Create storage types of different layouts for SPIRV emit. * Fix. * Fix. * Fix. * Update expected failure list. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index 1a499842d..c666ccc08 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -317,7 +317,7 @@ namespace Slang
IRInst* IRArrayTypeBase::getElementCount()
{
if (auto arrayType = as<IRArrayType>(this))
- return arrayType->getElementCount();
+ return arrayType->getOperand(1);
return nullptr;
}
@@ -2809,6 +2809,29 @@ namespace Slang
operands);
}
+ IRArrayType* IRBuilder::getArrayType(
+ IRType* elementType,
+ IRInst* elementCount,
+ IRInst* stride)
+ {
+ IRInst* operands[] = { elementType, elementCount, stride };
+ return (IRArrayType*)getType(
+ kIROp_ArrayType,
+ sizeof(operands) / sizeof(operands[0]),
+ operands);
+ }
+
+ IRUnsizedArrayType* IRBuilder::getUnsizedArrayType(
+ IRType* elementType,
+ IRInst* stride)
+ {
+ IRInst* operands[] = { elementType, stride };
+ return (IRUnsizedArrayType*)getType(
+ kIROp_UnsizedArrayType,
+ sizeof(operands) / sizeof(operands[0]),
+ operands);
+ }
+
IRVectorType* IRBuilder::getVectorType(
IRType* elementType,
IRInst* elementCount)