diff options
Diffstat (limited to 'source/slang/slang-ir.cpp')
| -rw-r--r-- | source/slang/slang-ir.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 4d507de41..34ea23b85 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -2307,6 +2307,16 @@ namespace Slang (IRInst* const*) paramTypes); } + IRWitnessTableType* IRBuilder::getWitnessTableType( + IRType* baseType) + { + return (IRWitnessTableType*)findOrEmitHoistableInst( + nullptr, + kIROp_WitnessTableType, + 1, + (IRInst* const*)&baseType); + } + IRConstantBufferType* IRBuilder::getConstantBufferType(IRType* elementType) { IRInst* operands[] = { elementType }; @@ -2465,7 +2475,7 @@ namespace Slang IRInst* IRBuilder::emitExtractExistentialWitnessTable( IRInst* existentialValue) { - auto type = getWitnessTableType(); + auto type = getWitnessTableType(existentialValue->getDataType()); auto inst = createInst<IRInst>( this, kIROp_ExtractExistentialWitnessTable, @@ -2775,7 +2785,7 @@ namespace Slang IRWitnessTable* witnessTable = createInst<IRWitnessTable>( this, kIROp_WitnessTable, - nullptr, + getWitnessTableType(baseType), baseType); addGlobalValue(this, witnessTable); return witnessTable; |
