|
| 1 | +#--- source.hlsl |
| 2 | +StructuredBuffer<half4> X : register(t0); |
| 3 | +StructuredBuffer<half4> Y : register(t1); |
| 4 | +StructuredBuffer<half4> S : register(t2); |
| 5 | + |
| 6 | +RWStructuredBuffer<half4> Out : register(u3); |
| 7 | + |
| 8 | + |
| 9 | +[numthreads(1,1,1)] |
| 10 | +void main() { |
| 11 | + Out[0] = lerp(X[0], Y[0], S[0]); |
| 12 | + Out[1] = half4(lerp(X[1].xyz, Y[1].xyz, S[1].xyz), lerp(X[1].w, Y[1].w, S[1].w)); |
| 13 | + Out[2] = half4(lerp(X[2].xy, Y[2].xy, S[2].xy), lerp(X[2].zw, Y[2].zw, S[2].zw)); |
| 14 | + Out[3] = lerp(half4(1, 2, -3, 4), half4(8, -7, 6, 5), half4(0.25, 0.5, 0.75, 0)); |
| 15 | +} |
| 16 | +//--- pipeline.yaml |
| 17 | + |
| 18 | +--- |
| 19 | +Shaders: |
| 20 | + - Stage: Compute |
| 21 | + Entry: main |
| 22 | + DispatchSize: [1, 1, 1] |
| 23 | +Buffers: |
| 24 | + - Name: X |
| 25 | + Format: Float16 |
| 26 | + Stride: 8 |
| 27 | + Data: [ 0x3c00, 0x4000, 0xc200, 0x4400, 0x0000, 0x4d13, 0x4fa0, 0x4500, 0xc500, 0xcc00, 0x3c00, 0x4000 ] |
| 28 | + # 1, 2, -3, 4, 0, 20.3, 30.5, 5, -5, -16, 1, 2 |
| 29 | + - Name: Y |
| 30 | + Format: Float16 |
| 31 | + Stride: 8 |
| 32 | + Data: [ 0x4800, 0xc700, 0x4600, 0x4500, 0x0000, 0x538a, 0x4fa0, 0x4b80, 0xcb80, 0xc800, 0x5640, 0x5a40 ] |
| 33 | + # 8, -7, 6, 5, 0, 60.3, 30.5, 15, -15, -8, 100, 200 |
| 34 | + - Name: S |
| 35 | + Format: Float16 |
| 36 | + Stride: 8 |
| 37 | + Data: [ 0x3400, 0x3800, 0x3a00, 0x0000, 0x3800, 0x3666, 0x3a66, 0x3a66, 0x3666, 0x38cd, 0x2e66, 0x3b33 ] |
| 38 | + # 0.25, 0.5, 0.75, 0, 0.5, 0.4, 0.8, 0.8, 0.4, 0.6, 0.1, 0.9 |
| 39 | + - Name: Out |
| 40 | + Format: Float16 |
| 41 | + Stride: 8 |
| 42 | + ZeroInitSize: 32 |
| 43 | + - Name: ExpectedOut |
| 44 | + Format: Float16 |
| 45 | + Stride: 8 |
| 46 | + Data: [ 0x4180, 0xc100, 0x4380, 0x4400, 0x0000, 0x508a, 0x4fa0, 0x4a80, 0xc880, 0xc99a, 0x4973, 0x59a2, 0x4180, 0xc100, 0x4380, 0x4400 ] |
| 47 | + # 2.75, -2.5, 3.75, 4, 0, 36.3, 30.5, 13, -9, -11.2, 10.9, 180.2, 2.75, -2.5, 3.75, 4 |
| 48 | +Results: |
| 49 | + - Result: Test0 |
| 50 | + Rule: BufferFloatULP |
| 51 | + ULPT: 1 |
| 52 | + Actual: Out |
| 53 | + Expected: ExpectedOut |
| 54 | +DescriptorSets: |
| 55 | + - Resources: |
| 56 | + - Name: X |
| 57 | + Kind: StructuredBuffer |
| 58 | + DirectXBinding: |
| 59 | + Register: 0 |
| 60 | + Space: 0 |
| 61 | + VulkanBinding: |
| 62 | + Binding: 0 |
| 63 | + - Name: Y |
| 64 | + Kind: StructuredBuffer |
| 65 | + DirectXBinding: |
| 66 | + Register: 1 |
| 67 | + Space: 0 |
| 68 | + VulkanBinding: |
| 69 | + Binding: 1 |
| 70 | + - Name: S |
| 71 | + Kind: StructuredBuffer |
| 72 | + DirectXBinding: |
| 73 | + Register: 2 |
| 74 | + Space: 0 |
| 75 | + VulkanBinding: |
| 76 | + Binding: 2 |
| 77 | + - Name: Out |
| 78 | + Kind: RWStructuredBuffer |
| 79 | + DirectXBinding: |
| 80 | + Register: 3 |
| 81 | + Space: 0 |
| 82 | + VulkanBinding: |
| 83 | + Binding: 3 |
| 84 | +#--- end |
| 85 | + |
| 86 | +# Bug https://github.com/microsoft/DirectXShaderCompiler/issues/7710 |
| 87 | +# XFAIL: DXC-Vulkan |
| 88 | + |
| 89 | +# REQUIRES: Half |
| 90 | +# RUN: split-file %s %t |
| 91 | +# RUN: %dxc_target -enable-16bit-types -HV 202x -T cs_6_5 -Fo %t.o %t/source.hlsl |
| 92 | +# RUN: %offloader %t/pipeline.yaml %t.o |
0 commit comments