77// CHECK: @[[BufB:.*]] = private unnamed_addr constant [2 x i8] c"B\00", align 1
88// CHECK: @[[BufC:.*]] = private unnamed_addr constant [2 x i8] c"C\00", align 1
99// CHECK: @[[BufD:.*]] = private unnamed_addr constant [2 x i8] c"D\00", align 1
10+ // CHECK: @[[BufE:.*]] = private unnamed_addr constant [2 x i8] c"E\00", align 1
1011
1112// different explicit binding for DXIL and SPIR-V
1213[[vk::binding (12 , 2 )]]
@@ -22,6 +23,9 @@ RWBuffer<int> C[3] : register(u2);
2223// implicit binding for both DXIL and SPIR-V in space/set 0
2324RWBuffer <double > D[10 ];
2425
26+ // implicit binding for both DXIL and SPIR-V with specified space/set 0
27+ RWBuffer <uint > E[15 ] : register (space2);
28+
2529RWStructuredBuffer <float > Out;
2630
2731[numthreads (4 ,1 ,1 )]
@@ -31,6 +35,7 @@ void main() {
3135 // CHECK: %[[Tmp1:.*]] = alloca %"class.hlsl::RWBuffer
3236 // CHECK: %[[Tmp2:.*]] = alloca %"class.hlsl::RWBuffer
3337 // CHECK: %[[Tmp3:.*]] = alloca %"class.hlsl::RWBuffer
38+ // CHECK: %[[Tmp4:.*]] = alloca %"class.hlsl::RWBuffer
3439
3540 // NOTE:
3641 // Constructor call for explicit binding has "jjij" in the mangled name and the arguments are (register, space, range_size, index, name).
@@ -62,5 +67,9 @@ void main() {
6267 // for both DXIL and SPIR-V
6368 // DXIL: call void @_ZN4hlsl8RWBufferIdEC1EjijjPKc(ptr {{.*}} %[[Tmp3]], i32 noundef 0, i32 noundef 10, i32 noundef 7, i32 noundef 1, ptr noundef @[[BufD]])
6469 // SPV: call void @_ZN4hlsl8RWBufferIdEC1EjijjPKc(ptr {{.*}} %[[Tmp3]], i32 noundef 0, i32 noundef 10, i32 noundef 7, i32 noundef 0, ptr noundef @[[BufD]])
65- Out[0 ] = A[2 ][0 ] + (float )B[3 ][0 ] + (float )C[1 ][0 ] + (float )D[7 ][0 ];
70+
71+ // Make sure E[5][0] is translated to RWBuffer<uint> constructor call with implicit binding and specified space/set 2
72+ // DXIL: call void @_ZN4hlsl8RWBufferIjEC1EjijjPKc(ptr {{.*}} %[[Tmp4]], i32 noundef 2, i32 noundef 15, i32 noundef 5, i32 noundef 2, ptr noundef @[[BufE]])
73+ // SPV: call void @_ZN4hlsl8RWBufferIjEC1EjijjPKc(ptr {{.*}} %[[Tmp4]], i32 noundef 2, i32 noundef 15, i32 noundef 5, i32 noundef 1, ptr noundef @[[BufE]])
74+ Out[0 ] = A[2 ][0 ] + (float )B[3 ][0 ] + (float )C[1 ][0 ] + (float )D[7 ][0 ] + (float )E[5 ][0 ];
6675}
0 commit comments