diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2024-05-30 16:47:39 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-30 16:47:39 -0700 |
| commit | febbeb140bea65180ff4be9b164207c582235d4d (patch) | |
| tree | 06a25bfdd3dc22c584d9bb9343bf979d5ee7a3dc /source/slang/slang-emit-spirv.cpp | |
| parent | 66252cb316b26beb86b7c2b5fce2dacdcd2cf659 (diff) | |
Support SPIR-V DebugTypePointer (#4228)
Diffstat (limited to 'source/slang/slang-emit-spirv.cpp')
| -rw-r--r-- | source/slang/slang-emit-spirv.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index 8acc1505b..9ad8513fc 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -5700,16 +5700,36 @@ struct SPIRVEmitContext builder.getIntValue(builder.getUIntType(), spvEncoding), builder.getIntValue(builder.getUIntType(), kUnknownPhysicalLayout)); } - else if (as<IRPtrTypeBase>(type)) + else if (auto ptrType = as<IRPtrTypeBase>(type)) { - StringBuilder sbName; - getTypeNameHint(sbName, basicType); + IRType* baseType = ptrType->getValueType(); + if (as<IRBasicType>(baseType)) + { + // If the base type of the pointer is basic types, + // emit the basic types and emit DebugTypePointer with it. + SpvInst* debugBaseType = emitDebugType(baseType); + SpvStorageClass storageClass = SpvStorageClassFunction; + if (ptrType->hasAddressSpace()) + storageClass = (SpvStorageClass)ptrType->getAddressSpace(); + + return emitOpDebugTypePointer( + getSection(SpvLogicalSectionID::ConstantsAndTypes), + nullptr, + m_voidType, + getNonSemanticDebugInfoExtInst(), + debugBaseType, + builder.getIntValue(builder.getUIntType(), storageClass), + builder.getIntValue(builder.getUIntType(), kUnknownPhysicalLayout)); + } + + // If the base type of the pointer is more complex, + // emit the pointer as "uintptr" of DebugTypeBasic. return emitOpDebugTypeBasic( getSection(SpvLogicalSectionID::ConstantsAndTypes), nullptr, m_voidType, getNonSemanticDebugInfoExtInst(), - builder.getStringValue(sbName.getUnownedSlice()), + builder.getStringValue(String("uint64").getUnownedSlice()), builder.getIntValue(builder.getUIntType(), 64), builder.getIntValue(builder.getUIntType(), 0), builder.getIntValue(builder.getUIntType(), kUnknownPhysicalLayout)); |
