summaryrefslogtreecommitdiff
path: root/source/slang/ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/ir.cpp')
-rw-r--r--source/slang/ir.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp
index d35ffe2d1..d4d2f0f51 100644
--- a/source/slang/ir.cpp
+++ b/source/slang/ir.cpp
@@ -956,16 +956,22 @@ namespace Slang
IRInst* IRBuilder::emitLoad(
IRValue* ptr)
{
- auto ptrType = ptr->getType()->As<PtrTypeBase>();
- if( !ptrType )
+ RefPtr<Type> valueType;
+ if(auto ptrType = ptr->getType()->As<PtrTypeBase>())
+ {
+ valueType = ptrType->getValueType();
+ }
+ else if(auto ptrLikeType = ptr->getType()->As<PointerLikeType>())
+ {
+ valueType = ptrLikeType->getElementType();
+ }
+ else
{
// Bad!
SLANG_ASSERT(ptrType);
return nullptr;
}
- auto valueType = ptrType->getValueType();
-
auto inst = createInst<IRLoad>(
this,
kIROp_Load,