diff options
Diffstat (limited to 'llvm/lib/Analysis/DXILResource.cpp')
-rw-r--r-- | llvm/lib/Analysis/DXILResource.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/DXILResource.cpp b/llvm/lib/Analysis/DXILResource.cpp index 4ffc9db..63c0ce8 100644 --- a/llvm/lib/Analysis/DXILResource.cpp +++ b/llvm/lib/Analysis/DXILResource.cpp @@ -382,7 +382,15 @@ ResourceTypeInfo::UAVInfo ResourceTypeInfo::getUAV() const { uint32_t ResourceTypeInfo::getCBufferSize(const DataLayout &DL) const { assert(isCBuffer() && "Not a CBuffer"); - return cast<CBufferExtType>(HandleTy)->getCBufferSize(); + + Type *ElTy = cast<CBufferExtType>(HandleTy)->getResourceType(); + + if (auto *LayoutTy = dyn_cast<LayoutExtType>(ElTy)) { + return LayoutTy->getSize(); + } + + // TODO: What should we do with unannotated arrays? + return DL.getTypeAllocSize(ElTy); } dxil::SamplerType ResourceTypeInfo::getSamplerType() const { |