1313// CHECK: %C = type <{ i32, target("dx.Layout", %A, 8, 0) }>
1414// CHECK: %__cblayout_D = type <{ [2 x [3 x target("dx.Layout", %B, 14, 0, 8)]] }>
1515
16+ // CHECK: %__cblayout_CBClasses = type <{ target("dx.Layout", %K, 4, 0), target("dx.Layout", %L, 8, 0, 4),
17+ // CHECK-SAME: target("dx.Layout", %M, 68, 0), [10 x target("dx.Layout", %K, 4, 0)] }>
18+ // CHECK: %K = type <{ float }>
19+ // CHECK: %L = type <{ float, float }>
20+ // CHECK: %M = type <{ [5 x target("dx.Layout", %K, 4, 0)] }>
21+
1622// CHECK: %__cblayout_CBMix = type <{ [2 x target("dx.Layout", %Test, 8, 0, 4)], float, [3 x [2 x <2 x float>]], float,
1723// CHECK-SAME: target("dx.Layout", %anon, 4, 0), double, target("dx.Layout", %anon.0, 8, 0), float, <1 x double>, i16 }>
1824
@@ -133,6 +139,33 @@ cbuffer CBStructs {
133139 uint16_t3 f;
134140};
135141
142+
143+ class K {
144+ float i;
145+ };
146+
147+ class L : K {
148+ float j;
149+ };
150+
151+ class M {
152+ K array[5 ];
153+ };
154+
155+ cbuffer CBClasses {
156+ K k;
157+ L l;
158+ M m;
159+ K ka[10 ];
160+ };
161+
162+ // CHECK: @CBClasses.cb = global target("dx.CBuffer", target("dx.Layout", %__cblayout_CBClasses,
163+ // CHECK-SAME: 260, 0, 16, 32, 112))
164+ // CHECK: @k = external addrspace(2) global target("dx.Layout", %K, 4, 0), align 4
165+ // CHECK: @l = external addrspace(2) global target("dx.Layout", %L, 8, 0, 4), align 4
166+ // CHECK: @m = external addrspace(2) global target("dx.Layout", %M, 68, 0), align 4
167+ // CHECK: @ka = external addrspace(2) global [10 x target("dx.Layout", %K, 4, 0)], align 4
168+
136169struct Test {
137170 float a, b;
138171};
@@ -237,16 +270,16 @@ RWBuffer<float> Buf;
237270
238271[numthreads (4 ,1 ,1 )]
239272void main () {
240- Buf[0 ] = a1 + b1.z + c1[2 ] + a.f1.y + f1 + B1[0 ].x + B10.z + D1.B2;
273+ Buf[0 ] = a1 + b1.z + c1[2 ] + a.f1.y + f1 + B1[0 ].x + ka[ 2 ].i + B10.z + D1.B2;
241274}
242275
243276// CHECK: define internal void @_GLOBAL__sub_I_cbuffer.hlsl()
244277// CHECK-NEXT: entry:
245278// CHECK-NEXT: call void @_init_resource_CBScalars.cb()
246279// CHECK-NEXT: call void @_init_resource_CBArrays.cb()
247280
248- // CHECK: !hlsl.cbs = !{![[CBSCALARS:[0-9]+]], ![[CBVECTORS:[0-9]+]], ![[CBARRAYS:[0-9]+]], ![[CBSTRUCTS:[0-9]+]], ![[CBMIX :[0-9]+]],
249- // CHECK-SAME: ![[CB_A:[0-9]+]], ![[CB_B:[0-9]+]], ![[CB_C:[0-9]+]]}
281+ // CHECK: !hlsl.cbs = !{![[CBSCALARS:[0-9]+]], ![[CBVECTORS:[0-9]+]], ![[CBARRAYS:[0-9]+]], ![[CBSTRUCTS:[0-9]+]], ![[CBCLASSES :[0-9]+]],
282+ // CHECK-SAME: ![[CBMIX:[0-9]+]], ![[ CB_A:[0-9]+]], ![[CB_B:[0-9]+]], ![[CB_C:[0-9]+]]}
250283
251284// CHECK: ![[CBSCALARS]] = !{ptr @CBScalars.cb, ptr addrspace(2) @a1, ptr addrspace(2) @a2, ptr addrspace(2) @a3, ptr addrspace(2) @a4,
252285// CHECK-SAME: ptr addrspace(2) @a5, ptr addrspace(2) @a6, ptr addrspace(2) @a7, ptr addrspace(2) @a8}
@@ -260,6 +293,8 @@ void main() {
260293// CHECK: ![[CBSTRUCTS]] = !{ptr @CBStructs.cb, ptr addrspace(2) @a, ptr addrspace(2) @b, ptr addrspace(2) @c, ptr addrspace(2) @array_of_A,
261294// CHECK-SAME: ptr addrspace(2) @d, ptr addrspace(2) @e, ptr addrspace(2) @f}
262295
296+ // CHECK: ![[CBCLASSES]] = !{ptr @CBClasses.cb, ptr addrspace(2) @k, ptr addrspace(2) @l, ptr addrspace(2) @m, ptr addrspace(2) @ka}
297+
263298// CHECK: ![[CBMIX]] = !{ptr @CBMix.cb, ptr addrspace(2) @test, ptr addrspace(2) @f1, ptr addrspace(2) @f2, ptr addrspace(2) @f3,
264299// CHECK-SAME: ptr addrspace(2) @f4, ptr addrspace(2) @f5, ptr addrspace(2) @f6, ptr addrspace(2) @f7, ptr addrspace(2) @f8, ptr addrspace(2) @f9}
265300
0 commit comments