File tree Expand file tree Collapse file tree 3 files changed +8
-27
lines changed Expand file tree Collapse file tree 3 files changed +8
-27
lines changed Original file line number Diff line number Diff line change @@ -2661,7 +2661,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
2661
2661
bool isHLSLSpecificType () const ; // Any HLSL specific type
2662
2662
bool isHLSLBuiltinIntangibleType () const ; // Any HLSL builtin intangible type
2663
2663
bool isHLSLAttributedResourceType () const ;
2664
- bool isHLSLResourceWrapper () const ;
2664
+ bool isHLSLResourceClass () const ;
2665
2665
bool isHLSLIntangibleType ()
2666
2666
const ; // Any HLSL intangible type (builtin, array, class)
2667
2667
Original file line number Diff line number Diff line change @@ -5114,31 +5114,8 @@ bool Type::hasSizedVLAType() const {
5114
5114
return false ;
5115
5115
}
5116
5116
5117
- bool Type::isHLSLResourceWrapper () const {
5118
- const Type *Ty = getUnqualifiedDesugaredType ();
5119
-
5120
- // check if it's a builtin type first
5121
- if (Ty->isBuiltinType ())
5122
- return Ty->isHLSLBuiltinIntangibleType ();
5123
-
5124
- // unwrap arrays
5125
- while (isa<ConstantArrayType>(Ty))
5126
- Ty = Ty->getArrayElementTypeNoTypeQual ();
5127
-
5128
- const RecordType *RT =
5129
- dyn_cast<RecordType>(Ty->getUnqualifiedDesugaredType ());
5130
- if (!RT)
5131
- return false ;
5132
-
5133
- CXXRecordDecl *RD = RT->getAsCXXRecordDecl ();
5134
- assert (RD != nullptr &&
5135
- " all HLSL structs and classes should be CXXRecordDecl" );
5136
- assert (RD->isCompleteDefinition () && " expecting complete type" );
5137
- if (RD->field_empty ()) {
5138
- return false ;
5139
- }
5140
- const FieldDecl *FirstField = *RD->field_begin ();
5141
- return FirstField->getType ()->isHLSLAttributedResourceType ();
5117
+ bool Type::isHLSLResourceClass () const {
5118
+ return HLSLAttributedResourceType::findHandleTypeOnResource (this ) != nullptr ;
5142
5119
}
5143
5120
5144
5121
bool Type::isHLSLIntangibleType () const {
Original file line number Diff line number Diff line change @@ -3065,7 +3065,11 @@ void SemaHLSL::ActOnVariableDeclarator(VarDecl *VD) {
3065
3065
if (VD->getType ()->isHLSLIntangibleType ())
3066
3066
collectResourceBindingsOnVarDecl (VD);
3067
3067
3068
- if (VD->getType ()->isHLSLResourceWrapper ()) {
3068
+ const Type *VarType = VD->getType ().getTypePtr ();
3069
+ if (VarType->isArrayType ()) {
3070
+ VarType = VarType->getArrayElementTypeNoTypeQual ();
3071
+ }
3072
+ if (VarType->isHLSLResourceClass ()) {
3069
3073
// Make the variable for resources static. The global externally visible
3070
3074
// storage is accessed through the handle, which is a member. The variable
3071
3075
// itself is not externally visible.
You can’t perform that action at this time.
0 commit comments