summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir-util.cpp')
-rw-r--r--source/slang/slang-ir-util.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp
index 41ac19ee9..f96cc174c 100644
--- a/source/slang/slang-ir-util.cpp
+++ b/source/slang/slang-ir-util.cpp
@@ -407,6 +407,8 @@ bool isPtrLikeOrHandleType(IRInst* type)
return true;
if (as<IRPseudoPtrType>(type))
return true;
+ if (as<IRHLSLStructuredBufferTypeBase>(type))
+ return true;
switch (type->getOp())
{
case kIROp_ComPtrType:
@@ -871,10 +873,15 @@ bool isGlobalOrUnknownMutableAddress(IRGlobalValueWithCode* parentFunc, IRInst*
if (root)
{
+ // If this is a global readonly resource, it is not a mutable address.
if (as<IRParameterGroupType>(root->getDataType()))
{
return false;
}
+ if (as<IRHLSLStructuredBufferType>(root->getDataType()))
+ {
+ return false;
+ }
}
switch (root->getOp())
@@ -991,6 +998,47 @@ void resetScratchDataBit(IRInst* inst, int bitIndex)
}
}
+UnownedStringSlice getBasicTypeNameHint(IRType* basicType)
+{
+ switch (basicType->getOp())
+ {
+ case kIROp_IntType:
+ return UnownedStringSlice::fromLiteral("int");
+ case kIROp_Int8Type:
+ return UnownedStringSlice::fromLiteral("int8");
+ case kIROp_Int16Type:
+ return UnownedStringSlice::fromLiteral("int16");
+ case kIROp_Int64Type:
+ return UnownedStringSlice::fromLiteral("int64");
+ case kIROp_IntPtrType:
+ return UnownedStringSlice::fromLiteral("intptr");
+ case kIROp_UIntType:
+ return UnownedStringSlice::fromLiteral("uint");
+ case kIROp_UInt8Type:
+ return UnownedStringSlice::fromLiteral("uint8");
+ case kIROp_UInt16Type:
+ return UnownedStringSlice::fromLiteral("uint16");
+ case kIROp_UInt64Type:
+ return UnownedStringSlice::fromLiteral("uint64");
+ case kIROp_UIntPtrType:
+ return UnownedStringSlice::fromLiteral("uintptr");
+ case kIROp_FloatType:
+ return UnownedStringSlice::fromLiteral("float");
+ case kIROp_HalfType:
+ return UnownedStringSlice::fromLiteral("half");
+ case kIROp_DoubleType:
+ return UnownedStringSlice::fromLiteral("double");
+ case kIROp_BoolType:
+ return UnownedStringSlice::fromLiteral("bool");
+ case kIROp_VoidType:
+ return UnownedStringSlice::fromLiteral("void");
+ case kIROp_CharType:
+ return UnownedStringSlice::fromLiteral("char");
+ default:
+ return UnownedStringSlice();
+ }
+}
+
struct GenericChildrenMigrationContextImpl
{
IRCloneEnv cloneEnv;