Skip to content

Commit 1d6a221

Browse files
committed
add AST test verifying an implicit binding attribute is added to resource arrays (and cbuffers)
1 parent 703caca commit 1d6a221

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

clang/test/AST/HLSL/resource_binding_attr.hlsl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ RWBuffer<float> UAV1 : register(u2), UAV2 : register(u4);
3434
// CHECK: HLSLResourceBindingAttr {{.*}} "" "space5"
3535
RWBuffer<float> UAV3 : register(space5);
3636

37+
// CHECK: VarDecl {{.*}} UAV_Array 'RWBuffer<float>[10]'
38+
// CHECK: HLSLResourceBindingAttr {{.*}} "u10" "space6"
39+
RWBuffer<float> UAV_Array[10] : register(u10, space6);
40+
3741
//
3842
// Default constants ($Globals) layout annotations
3943

@@ -56,3 +60,19 @@ struct S {
5660
// CHECK: VarDecl {{.*}} s 'hlsl_constant S'
5761
// CHECK: HLSLResourceBindingAttr {{.*}} "c10" "space0
5862
S s : register(c10);
63+
64+
//
65+
// Implicit binding
66+
67+
// Constant buffers should have implicit binding attribute added by SemaHLSL
68+
// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 3]]:9 cbuffer CB2
69+
// CHECK-NEXT: HLSLResourceClassAttr {{.*}} Implicit CBuffer
70+
// CHECK-NEXT: HLSLResourceBindingAttr {{.*}} Implicit "" "0"
71+
cbuffer CB2 {
72+
float4 c;
73+
}
74+
75+
// Resource arrays should have implicit binding attribute added by SemaHLSL
76+
// CHECK: VarDecl {{.*}} SB 'StructuredBuffer<float>[10]'
77+
// CHECK: HLSLResourceBindingAttr {{.*}} Implicit "" "0"
78+
StructuredBuffer<float> SB[10];

0 commit comments

Comments
 (0)