summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-09-15 20:37:45 -0700
committerGitHub <noreply@github.com>2022-09-15 20:37:45 -0700
commita5d3bec25d70f23da1e79cd7773981ff34593611 (patch)
tree92c8cb983c57bbee141d4e6f3f91f265e04d6a08 /source/slang/slang-ir.cpp
parenta6032446c6bf7f64d1e201bf438a4c7605a3dbb4 (diff)
Run simple compute kernel in gfx-smoke test. (#2400)
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index 19d3ce59a..46d6d445d 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -2203,15 +2203,24 @@ namespace Slang
return static_cast<IRStringLit*>(_findOrEmitConstant(keyInst));
}
- IRPtrLit* IRBuilder::getPtrValue(void* value)
+ IRPtrLit* IRBuilder::_getPtrValue(void* data)
{
- IRType* type = getPtrType(getVoidType());
+ auto type = getPtrType(getVoidType());
+ IRConstant keyInst;
+ memset(&keyInst, 0, sizeof(keyInst));
+ keyInst.m_op = kIROp_PtrLit;
+ keyInst.typeUse.usedValue = type;
+ keyInst.value.ptrVal = data;
+ return (IRPtrLit*)_findOrEmitConstant(keyInst);
+ }
+ IRPtrLit* IRBuilder::getNullPtrValue(IRType* type)
+ {
IRConstant keyInst;
memset(&keyInst, 0, sizeof(keyInst));
keyInst.m_op = kIROp_PtrLit;
keyInst.typeUse.usedValue = type;
- keyInst.value.ptrVal = value;
+ keyInst.value.ptrVal = nullptr;
return (IRPtrLit*) _findOrEmitConstant(keyInst);
}
@@ -4589,6 +4598,9 @@ namespace Slang
switch (managedPtrType->getOp())
{
case kIROp_InterfaceType:
+ return emitIntrinsicInst(
+ getPtrType(getNativePtrType((IRType*)managedPtrType)), kIROp_GetManagedPtrWriteRef, 1, &ptrToManagedPtr);
+ break;
case kIROp_ComPtrType:
return emitIntrinsicInst(
getPtrType(getNativePtrType((IRType*)managedPtrType->getOperand(0))), kIROp_GetManagedPtrWriteRef, 1, &ptrToManagedPtr);
@@ -4651,7 +4663,7 @@ namespace Slang
void IRBuilder::addHighLevelDeclDecoration(IRInst* inst, Decl* decl)
{
- auto ptrConst = getPtrValue(decl);
+ auto ptrConst = _getPtrValue(decl);
addDecoration(inst, kIROp_HighLevelDeclDecoration, ptrConst);
}
@@ -6193,6 +6205,7 @@ namespace Slang
case kIROp_PackAnyValue:
case kIROp_UnpackAnyValue:
case kIROp_Reinterpret:
+ case kIROp_GetNativePtr:
return false;
}
}