|
4 | 4 | // CHECK: %"class.hlsl::RWBuffer.0" = type { target("dx.TypedBuffer", float, 1, 0, 0) } |
5 | 5 | // CHECK: %"class.hlsl::StructuredBuffer" = type { target("dx.RawBuffer", i32, 0, 0) } |
6 | 6 | // CHECK: %"class.hlsl::RWStructuredBuffer" = type { target("dx.RawBuffer", %struct.S, 1, 0) } |
| 7 | +// CHECK: %"class.hlsl::RWBuffer.1" = type { target("dx.TypedBuffer", double, 1, 0, 0) } |
7 | 8 |
|
8 | 9 | // CHECK: @_ZL4U0S0 = internal global %"class.hlsl::RWBuffer" poison, align 4 |
9 | 10 | // CHECK: @_ZL4U5S3 = internal global %"class.hlsl::RWBuffer.0" poison, align 4 |
10 | 11 | // CHECK: @_ZL4T2S2 = internal global %"class.hlsl::StructuredBuffer" poison, align 4 |
11 | 12 | // CHECK: @_ZL4T3S0 = internal global %"class.hlsl::RWStructuredBuffer" poison, align 4 |
| 13 | +// CHECK: @_ZL5Array = internal global [10 x %"class.hlsl::RWBuffer.1"] poison, align 4 |
12 | 14 |
|
13 | 15 | // CHECK: %[[HANDLE:.*]] = call target("dx.TypedBuffer", <4 x float>, 1, 0, 0) |
14 | 16 | // CHECK-SAME: @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_v4f32_1_0_0t( |
@@ -42,5 +44,15 @@ struct S { |
42 | 44 | }; |
43 | 45 | RWStructuredBuffer<S> T3S0 : register(u3); |
44 | 46 |
|
| 47 | +// Resource array elements are initialized on access; make sure there is not call |
| 48 | +// to initialize RWBuffer<double>. |
| 49 | +// CHECK-NOT: call target("dx.TypedBuffer", double, 1, 0, 0) @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_f64_1_0_0t( |
| 50 | +RWBuffer<double> Array[10] : register(u4, space0); |
| 51 | + |
45 | 52 | [numthreads(4,1,1)] |
46 | | -void main() {} |
| 53 | +void main() { |
| 54 | + // Reference Array to ensure it is emitted and we can test that it is initialized |
| 55 | + // to poison, but do not index it. |
| 56 | + // Non-array resources are always emitted because they have a constructor initializer. |
| 57 | + (void)Array; |
| 58 | +} |
0 commit comments