|
| 1 | +#--- source.hlsl |
| 2 | +RWStructuredBuffer<uint> Out1 : register(u1); |
| 3 | +RWStructuredBuffer<uint> Out2 : register(u2); |
| 4 | + |
| 5 | +[WaveSize(128)] |
| 6 | +[numthreads(128, 1, 1)] |
| 7 | +void main(uint3 tid : SV_GroupThreadID) { |
| 8 | + |
| 9 | + // this should be an ascending sequence of numbers |
| 10 | + Out1[tid.x] = WavePrefixCountBits(true); |
| 11 | + // this should look more like 0, 1, 1, 2, 2, 3, 3, etc. |
| 12 | + Out2[tid.x] = WavePrefixCountBits(tid.x % 2 == 0); |
| 13 | +} |
| 14 | + |
| 15 | +//--- pipeline.yaml |
| 16 | + |
| 17 | +--- |
| 18 | +Shaders: |
| 19 | + - Stage: Compute |
| 20 | + Entry: main |
| 21 | + DispatchSize: [1, 1, 1] |
| 22 | +Buffers: |
| 23 | + - Name: Out1 |
| 24 | + Format: UInt32 |
| 25 | + Stride: 4 |
| 26 | + FillSize: 512 |
| 27 | + - Name: ExpectedOut1 |
| 28 | + Format: UInt32 |
| 29 | + Stride: 4 |
| 30 | + Data: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
| 31 | + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, |
| 32 | + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, |
| 33 | + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, |
| 34 | + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
| 35 | + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, |
| 36 | + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, |
| 37 | + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127] |
| 38 | + |
| 39 | + - Name: Out2 |
| 40 | + Format: UInt32 |
| 41 | + Stride: 4 |
| 42 | + FillSize: 512 |
| 43 | + - Name: ExpectedOut2 |
| 44 | + Format: UInt32 |
| 45 | + Stride: 4 |
| 46 | + Data: [0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, |
| 47 | + 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, |
| 48 | + 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, |
| 49 | + 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, |
| 50 | + 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, |
| 51 | + 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, |
| 52 | + 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, |
| 53 | + 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64] |
| 54 | +Results: |
| 55 | + - Result: Test1 |
| 56 | + Rule: BufferExact |
| 57 | + Actual: Out1 |
| 58 | + Expected: ExpectedOut1 |
| 59 | + - Result: Test2 |
| 60 | + Rule: BufferExact |
| 61 | + Actual: Out2 |
| 62 | + Expected: ExpectedOut2 |
| 63 | +DescriptorSets: |
| 64 | + - Resources: |
| 65 | + - Name: Out1 |
| 66 | + Kind: RWStructuredBuffer |
| 67 | + DirectXBinding: |
| 68 | + Register: 1 |
| 69 | + Space: 0 |
| 70 | + VulkanBinding: |
| 71 | + Binding: 2 |
| 72 | + - Name: Out2 |
| 73 | + Kind: RWStructuredBuffer |
| 74 | + DirectXBinding: |
| 75 | + Register: 2 |
| 76 | + Space: 0 |
| 77 | + VulkanBinding: |
| 78 | + Binding: 2 |
| 79 | +... |
| 80 | +#--- end |
| 81 | + |
| 82 | +# REQUIRES: WaveSize_128 |
| 83 | + |
| 84 | +# RUN: split-file %s %t |
| 85 | +# RUN: %dxc_target -T cs_6_6 -Fo %t.o %t/source.hlsl |
| 86 | +# RUN: %offloader %t/pipeline.yaml %t.o |
0 commit comments