|
| 1 | +#--- source.hlsl |
| 2 | +StructuredBuffer<half4> Y : register(t0); |
| 3 | +StructuredBuffer<half4> X : register(t1); |
| 4 | + |
| 5 | +RWStructuredBuffer<half4> Out : register(u2); |
| 6 | + |
| 7 | + |
| 8 | +[numthreads(1,1,1)] |
| 9 | +void main() { |
| 10 | + Out[0] = step(Y[0], X[0]); |
| 11 | + Out[1] = half4(step(Y[1].xyz, X[1].xyz), step(Y[1].w, X[1].w)); |
| 12 | + Out[2] = half4(step(Y[2].xy, X[2].xy), step(Y[2].zw, X[2].zw)); |
| 13 | + Out[3] = step(half4(0.0, 1.0, 2.0, -2.0), half4(0.0, 1.0, 1.999, -1.999)); |
| 14 | +} |
| 15 | +//--- pipeline.yaml |
| 16 | + |
| 17 | +--- |
| 18 | +Shaders: |
| 19 | + - Stage: Compute |
| 20 | + Entry: main |
| 21 | + DispatchSize: [1, 1, 1] |
| 22 | +Buffers: |
| 23 | + - Name: Y |
| 24 | + Format: Float16 |
| 25 | + Stride: 8 |
| 26 | + Data: [ 0x0000, 0x3c00, 0x4000, 0xc000, 0x429a, 0x489a, 0x7207, 0xd971, 0xc44d, 0x4248, 0x0011, 0x7bff ] |
| 27 | + # 0.0, 1.0, 2.0, -2.0, 3.3, 9.2, 12344, -174.12, -4.3, 3.14159, 0.000001, 65504 |
| 28 | + - Name: X |
| 29 | + Format: Float16 |
| 30 | + Stride: 8 |
| 31 | + Data: [ 0x0000, 0x3c00, 0x3fff, 0xbfff, 0x474d, 0x419a, 0x7207, 0xe00a, 0x444d, 0x4170, 0x0022, 0x7bff ] |
| 32 | + # 0.0, 1.0, 1.999, -1.999, 7.3, 2.8, 12345, -517.23, 4.3, 2.71828, 0.000002, 65504 |
| 33 | + - Name: Out |
| 34 | + Format: Float16 |
| 35 | + Stride: 8 |
| 36 | + ZeroInitSize: 32 |
| 37 | + - Name: ExpectedOut |
| 38 | + Format: Float16 |
| 39 | + Stride: 8 |
| 40 | + Data: [ 0x3c00, 0x3c00, 0, 0x3c00, 0x3c00, 0, 0x3c00, 0, 0x3c00, 0, 0x3c00, 0x3c00, 0x3c00, 0x3c00, 0, 0x3c00 ] |
| 41 | + # 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1 |
| 42 | +Results: |
| 43 | + - Result: Test |
| 44 | + Rule: BufferExact |
| 45 | + Actual: Out |
| 46 | + Expected: ExpectedOut |
| 47 | +DescriptorSets: |
| 48 | + - Resources: |
| 49 | + - Name: Y |
| 50 | + Kind: StructuredBuffer |
| 51 | + DirectXBinding: |
| 52 | + Register: 0 |
| 53 | + Space: 0 |
| 54 | + VulkanBinding: |
| 55 | + Binding: 0 |
| 56 | + - Name: X |
| 57 | + Kind: StructuredBuffer |
| 58 | + DirectXBinding: |
| 59 | + Register: 1 |
| 60 | + Space: 0 |
| 61 | + VulkanBinding: |
| 62 | + Binding: 1 |
| 63 | + - Name: Out |
| 64 | + Kind: RWStructuredBuffer |
| 65 | + DirectXBinding: |
| 66 | + Register: 2 |
| 67 | + Space: 0 |
| 68 | + VulkanBinding: |
| 69 | + Binding: 2 |
| 70 | +#--- end |
| 71 | + |
| 72 | +# REQUIRES: Half |
| 73 | +# RUN: split-file %s %t |
| 74 | +# RUN: %dxc_target -enable-16bit-types -T cs_6_5 -Fo %t.o %t/source.hlsl |
| 75 | +# RUN: %offloader %t/pipeline.yaml %t.o |
0 commit comments