-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[HLSL] Adding DXIL Storage type into TypedInfo
#164887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
c5bb883
fccbe5c
e417ac7
569631d
0c1e646
1e7a714
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -206,6 +206,13 @@ static dxil::ElementType toDXILElementType(Type *Ty, bool IsSigned) { | |
| return ElementType::Invalid; | ||
| } | ||
|
|
||
| static dxil::ElementType toDXILTargetType(dxil::ElementType ET) { | ||
| // TODO: Handle unorm, snorm, and packed. | ||
|
||
| if (ET == dxil::ElementType::U64 || ET == dxil::ElementType::F64) | ||
|
||
| return dxil::ElementType::U32; | ||
| return ET; | ||
| } | ||
|
|
||
| ResourceTypeInfo::ResourceTypeInfo(TargetExtType *HandleTy, | ||
| const dxil::ResourceClass RC_, | ||
| const dxil::ResourceKind Kind_) | ||
|
|
@@ -569,10 +576,11 @@ ResourceTypeInfo::TypedInfo ResourceTypeInfo::getTyped() const { | |
|
|
||
| auto [ElTy, IsSigned] = getTypedElementType(Kind, HandleTy); | ||
| dxil::ElementType ET = toDXILElementType(ElTy, IsSigned); | ||
| dxil::ElementType DXILTargetTy = toDXILTargetType(ET); | ||
| uint32_t Count = 1; | ||
| if (auto *VTy = dyn_cast<FixedVectorType>(ElTy)) | ||
| Count = VTy->getNumElements(); | ||
| return {ET, Count}; | ||
| return {ET, DXILTargetTy, Count}; | ||
| } | ||
|
|
||
| dxil::SamplerFeedbackType ResourceTypeInfo::getFeedbackType() const { | ||
|
|
@@ -714,7 +722,8 @@ MDTuple *ResourceInfo::getAsMetadata(Module &M, | |
| Tags.push_back(getIntMD(RTI.getStruct(DL).Stride)); | ||
| } else if (RTI.isTyped()) { | ||
| Tags.push_back(getIntMD(llvm::to_underlying(ExtPropTags::ElementType))); | ||
| Tags.push_back(getIntMD(llvm::to_underlying(RTI.getTyped().ElementTy))); | ||
| Tags.push_back( | ||
| getIntMD(llvm::to_underlying(RTI.getTyped().DXILTargetTy))); | ||
| } else if (RTI.isFeedback()) { | ||
| Tags.push_back( | ||
| getIntMD(llvm::to_underlying(ExtPropTags::SamplerFeedbackKind))); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we come up with a better name for this? I think
DXILTargetTyis a little ambiguous. This is the type we need to access the object as in resource operations, so maybe "StorageTy" or "DXILAccessTy"? Do you have any other ideas?