|
| 1 | +#--- source.hlsl |
| 2 | + |
| 3 | +cbuffer CBArrays : register(b0) { |
| 4 | + double2 c1[2]; |
| 5 | + uint64_t3 c2[2]; |
| 6 | + int64_t c3[2]; |
| 7 | +} |
| 8 | + |
| 9 | +struct Arrays { |
| 10 | + double2 c1[2]; |
| 11 | + uint64_t3 c2[2]; |
| 12 | + int64_t c3[2]; |
| 13 | +}; |
| 14 | + |
| 15 | +RWStructuredBuffer<Arrays> Out : register(u0); |
| 16 | + |
| 17 | +[numthreads(1,1,1)] |
| 18 | +void main() { |
| 19 | + Out[0].c1 = c1; |
| 20 | + Out[0].c2 = c2; |
| 21 | + Out[0].c3 = c3; |
| 22 | +} |
| 23 | + |
| 24 | +//--- pipeline.yaml |
| 25 | + |
| 26 | +--- |
| 27 | +Shaders: |
| 28 | + - Stage: Compute |
| 29 | + Entry: main |
| 30 | + DispatchSize: [1, 1, 1] |
| 31 | +Buffers: |
| 32 | + - Name: CBArrays |
| 33 | + Format: Hex64 |
| 34 | + Data: [ |
| 35 | + 0x3ff0000000000000, 0x4008000000000000, |
| 36 | + 0x5ff0000000000000, 0x6008000000000000, |
| 37 | + 0x1234123412341234, 0x4321432143214321, |
| 38 | + 0x0000000000000001, 0x5A5A5A5A5A5A5A5A, |
| 39 | + 0x0000000000000001, 0x1234123412341234, |
| 40 | + 0x4321432143214321, 0x5A5A5A5A5A5A5A5A, |
| 41 | + 0x0000000000000001, 0x5A5A5A5A5A5A5A5A, |
| 42 | + 0x0000000000000002, 0x5A5A5A5A5A5A5A5A |
| 43 | + ] |
| 44 | + - Name: Out |
| 45 | + Format: Hex64 |
| 46 | + Stride: 96 |
| 47 | + ZeroInitSize: 96 |
| 48 | +DescriptorSets: |
| 49 | + - Resources: |
| 50 | + - Name: CBArrays |
| 51 | + Kind: ConstantBuffer |
| 52 | + DirectXBinding: |
| 53 | + Register: 0 |
| 54 | + Space: 0 |
| 55 | + - Name: Out |
| 56 | + Kind: RWStructuredBuffer |
| 57 | + DirectXBinding: |
| 58 | + Register: 0 |
| 59 | + Space: 0 |
| 60 | +... |
| 61 | +#--- end |
| 62 | + |
| 63 | +# DXC's vulkan support does not layout cbuffers compatibly with DXIL |
| 64 | +# UNSUPPORTED: Vulkan |
| 65 | + |
| 66 | +# RUN: split-file %s %t |
| 67 | +# RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl |
| 68 | +# RUN: %offloader %t/pipeline.yaml %t.o | FileCheck %s |
| 69 | + |
| 70 | +# CHECK: - Name: CBArrays |
| 71 | +# CHECK: Format: Hex64 |
| 72 | + |
| 73 | +# CHECK: - Name: Out |
| 74 | +# CHECK: Format: Hex64 |
| 75 | +# CHECK: Data: [ |
| 76 | + |
| 77 | +# CHECK: 0x3FF0000000000000, |
| 78 | +# CHECK: 0x4008000000000000, |
| 79 | +# CHECK: 0x5FF0000000000000, |
| 80 | +# CHECK: 0x6008000000000000, |
| 81 | + |
| 82 | +# CHECK: 0x1234123412341234, |
| 83 | +# CHECK: 0x4321432143214321, |
| 84 | +# CHECK: 0x1, |
| 85 | +# CHECK-NOT: 0x5A5A5A5A5A5A5A5A, |
| 86 | +# CHECK: 0x1, |
| 87 | +# CHECK: 0x1234123412341234, |
| 88 | +# CHECK: 0x4321432143214321, |
| 89 | +# CHECK-NOT: 0x5A5A5A5A5A5A5A5A, |
| 90 | + |
| 91 | +# CHECK: 0x1, |
| 92 | +# CHECK: 0x2 |
| 93 | +# CHECK-NOT: 0x5A5A5A5A5A5A5A5A |
| 94 | + |
| 95 | +# CHECK: ] |
0 commit comments