|
| 1 | +#--- source.hlsl |
| 2 | +RWStructuredBuffer<uint> WOut : register(u1); |
| 3 | +RWStructuredBuffer<uint> QOut : register(u2); |
| 4 | +RWStructuredBuffer<float> XOut : register(u3); |
| 5 | + |
| 6 | +struct S { |
| 7 | + float x[2]; |
| 8 | + uint q; |
| 9 | +}; |
| 10 | + |
| 11 | +cbuffer cb0 : register(b0) { |
| 12 | + uint32_t3 w[4]; |
| 13 | + S v[4]; |
| 14 | +} |
| 15 | + |
| 16 | +[numthreads(4, 1, 1)] |
| 17 | +void main(uint GI : SV_GroupIndex) { |
| 18 | + WOut[GI] = w[GI].z; |
| 19 | + QOut[GI] = v[GI].q; |
| 20 | + XOut[GI] = v[GI].x[1]; |
| 21 | +} |
| 22 | + |
| 23 | +//--- pipeline.yaml |
| 24 | +--- |
| 25 | +Shaders: |
| 26 | + - Stage: Compute |
| 27 | + Entry: main |
| 28 | + DispatchSize: [1, 1, 1] |
| 29 | +Buffers: |
| 30 | + - Name: Constants |
| 31 | + Format: Hex32 |
| 32 | + Data: [ |
| 33 | + 0x1, 0x2, 0x3, 0x5A5A5A5A, |
| 34 | + 0x4, 0x5, 0x6, 0x5A5A5A5A, |
| 35 | + 0x7, 0x8, 0x9, 0x5A5A5A5A, |
| 36 | + 0xA, 0xB, 0xC, 0x5A5A5A5A, |
| 37 | + 0x7f7fffff, 0x5A5A5A5A, 0x5A5A5A5A, 0x5A5A5A5A, |
| 38 | + 0x3f800000, 0x20, 0x5A5A5A5A, 0x5A5A5A5A, |
| 39 | + 0xc0000000, 0x5A5A5A5A, 0x5A5A5A5A, 0x5A5A5A5A, |
| 40 | + 0x40000000, 0x21, 0x5A5A5A5A, 0x5A5A5A5A, |
| 41 | + 0x40490fdb, 0x5A5A5A5A, 0x5A5A5A5A, 0x5A5A5A5A, |
| 42 | + 0x40400000, 0x22, 0x5A5A5A5A, 0x5A5A5A5A, |
| 43 | + 0x3eaaaaab, 0x5A5A5A5A, 0x5A5A5A5A, 0x5A5A5A5A, |
| 44 | + 0x40800000, 0x23, 0x5A5A5A5A, 0x5A5A5A5A, |
| 45 | + ] |
| 46 | + - Name: WOut |
| 47 | + Format: UInt32 |
| 48 | + FillSize: 16 |
| 49 | + - Name: QOut |
| 50 | + Format: UInt32 |
| 51 | + FillSize: 16 |
| 52 | + - Name: XOut |
| 53 | + Format: Float32 |
| 54 | + FillSize: 16 |
| 55 | + - Name: ExpectedWOut |
| 56 | + Format: UInt32 |
| 57 | + Data: [ 3, 6, 9, 12 ] |
| 58 | + - Name: ExpectedQOut |
| 59 | + Format: UInt32 |
| 60 | + Data: [ 32, 33, 34, 35 ] |
| 61 | + - Name: ExpectedXOut |
| 62 | + Format: Float32 |
| 63 | + Data: [ 1.0, 2.0, 3.0, 4.0 ] |
| 64 | +Results: |
| 65 | + - Result: CheckW |
| 66 | + Rule: BufferExact |
| 67 | + Actual: WOut |
| 68 | + Expected: ExpectedWOut |
| 69 | + - Result: CheckQ |
| 70 | + Rule: BufferExact |
| 71 | + Actual: QOut |
| 72 | + Expected: ExpectedQOut |
| 73 | + - Result: CheckX |
| 74 | + Rule: BufferExact |
| 75 | + Actual: XOut |
| 76 | + Expected: ExpectedXOut |
| 77 | +DescriptorSets: |
| 78 | + - Resources: |
| 79 | + - Name: Constants |
| 80 | + Kind: ConstantBuffer |
| 81 | + DirectXBinding: |
| 82 | + Register: 0 |
| 83 | + Space: 0 |
| 84 | + VulkanBinding: |
| 85 | + Binding: 0 |
| 86 | + - Name: WOut |
| 87 | + Kind: RWStructuredBuffer |
| 88 | + DirectXBinding: |
| 89 | + Register: 1 |
| 90 | + Space: 0 |
| 91 | + VulkanBinding: |
| 92 | + Binding: 1 |
| 93 | + - Name: QOut |
| 94 | + Kind: RWStructuredBuffer |
| 95 | + DirectXBinding: |
| 96 | + Register: 2 |
| 97 | + Space: 0 |
| 98 | + VulkanBinding: |
| 99 | + Binding: 2 |
| 100 | + - Name: XOut |
| 101 | + Kind: RWStructuredBuffer |
| 102 | + DirectXBinding: |
| 103 | + Register: 3 |
| 104 | + Space: 0 |
| 105 | + VulkanBinding: |
| 106 | + Binding: 3 |
| 107 | +... |
| 108 | +#--- end |
| 109 | + |
| 110 | +# Bug https://github.com/llvm/llvm-project/issues/164517 |
| 111 | +# XFAIL: Clang |
| 112 | + |
| 113 | +# RUN: split-file %s %t |
| 114 | +# RUN: %dxc_target -fvk-use-dx-layout -T cs_6_5 -Fo %t.o %t/source.hlsl |
| 115 | +# RUN: %offloader %t/pipeline.yaml %t.o |
0 commit comments