|
| 1 | +#--- source.hlsl |
| 2 | +StructuredBuffer<float4> M0 : register(t0); |
| 3 | +StructuredBuffer<float4> A0 : register(t1); |
| 4 | +StructuredBuffer<float4> B0 : register(t2); |
| 5 | +StructuredBuffer<int4> M1 : register(t3); |
| 6 | +StructuredBuffer<int4> A1 : register(t4); |
| 7 | +StructuredBuffer<int4> B1 : register(t5); |
| 8 | +StructuredBuffer<uint4> M2 : register(t6); |
| 9 | +StructuredBuffer<uint4> A2 : register(t7); |
| 10 | +StructuredBuffer<uint4> B2 : register(t8); |
| 11 | + |
| 12 | +RWStructuredBuffer<float4> Out0 : register(u9); |
| 13 | +RWStructuredBuffer<int4> Out1 : register(u10); |
| 14 | +RWStructuredBuffer<uint4> Out2 : register(u11); |
| 15 | + |
| 16 | + |
| 17 | +[numthreads(1,1,1)] |
| 18 | +void main() { |
| 19 | + // float |
| 20 | + Out0[0] = mad(M0[0], A0[0], B0[0]); |
| 21 | + Out0[1] = float4(mad(M0[1].xyz, A0[1].xyz, B0[1].xyz), mad(M0[1].w, A0[1].w, B0[1].w)); |
| 22 | + Out0[2] = float4(mad(M0[2].xy, A0[2].xy, B0[2].xy), mad(M0[2].zw, A0[2].zw, B0[2].zw)); |
| 23 | + Out0[3] = mad(float4(1.0, 1.5, 1e+38, -1e+38), float4(1.0, 10, 4, 4), float4(1.0, -5.5, 0, 0)); |
| 24 | + |
| 25 | + // int |
| 26 | + Out1[0] = mad(M1[0], A1[0], B1[0]); |
| 27 | + Out1[1] = int4(mad(M1[1].xyz, A1[1].xyz, B1[1].xyz), mad(M1[1].w, A1[1].w, B1[1].w)); |
| 28 | + Out1[2] = int4(mad(M1[2].xy, A1[2].xy, B1[2].xy), mad(M1[2].zw, A1[2].zw, B1[2].zw)); |
| 29 | + Out1[3] = mad(int4(-2147483647, -256, 2147483647, -2147483648), int4(1, -256, 1, 1), int4(0, 0, 1, -1)); |
| 30 | + |
| 31 | + // uint |
| 32 | + Out2[0] = mad(M2[0], A2[0], B2[0]); |
| 33 | + Out2[1] = uint4(mad(M2[1].xyz, A2[1].xyz, B2[1].xyz), mad(M2[1].w, A2[1].w, B2[1].w)); |
| 34 | + Out2[2] = uint4(mad(M2[2].xy, A2[2].xy, B2[2].xy), mad(M2[2].zw, A2[2].zw, B2[2].zw)); |
| 35 | + Out2[3] = mad(uint4(2, 16, 65536, 4294967295), uint4(2, 16, 65536, 1), uint4(1, 15, 1, 1)); |
| 36 | +} |
| 37 | +//--- pipeline.yaml |
| 38 | + |
| 39 | +--- |
| 40 | +Shaders: |
| 41 | + - Stage: Compute |
| 42 | + Entry: main |
| 43 | + DispatchSize: [1, 1, 1] |
| 44 | +Buffers: |
| 45 | + - Name: M0 |
| 46 | + Format: Float32 |
| 47 | + Stride: 16 |
| 48 | + Data: [ NaN, -Inf, -0x1.e7d42cp-127, -0, 0, 0x1.e7d42cp-127, Inf, 1.0, -1.0, 0, 1, 1.5 ] |
| 49 | + # NaN, -Inf, -denorm, -0, 0, denorm, Inf, 1.0, -1.0, 0, 1, 1.5 |
| 50 | + - Name: A0 |
| 51 | + Format: Float32 |
| 52 | + Stride: 16 |
| 53 | + Data: [ NaN, -Inf, -0x1.e7d42cp-127, -0, 0, 0x1.e7d42cp-127, Inf, 1.0, -1.0, 0, 1, 10 ] |
| 54 | + # NaN, -Inf, -denorm, -0, 0, denorm, Inf, 1.0, -1.0, 0, 1, 10 |
| 55 | + - Name: B0 |
| 56 | + Format: Float32 |
| 57 | + Stride: 16 |
| 58 | + Data: [ NaN, -Inf, -0x1.e7d42cp-127, -0, 0, 0x1.e7d42cp-127, Inf, 1.0, -1.0, 1, 0, -5.5 ] |
| 59 | + # NaN, -Inf, -denorm, -0, 0, denorm, Inf, 1.0, -1.0, 1, 0, -5.5 |
| 60 | + - Name: M1 |
| 61 | + Format: Int32 |
| 62 | + Stride: 16 |
| 63 | + Data: [ -2147483647, -256, -1, 0, 1, 2, 16, 2147483647, 1, -1, 1, 10 ] |
| 64 | + - Name: A1 |
| 65 | + Format: Int32 |
| 66 | + Stride: 16 |
| 67 | + Data: [ 1, -256, -1, 0, 1, 3, 16, 0, 1, -1, 10, 100 ] |
| 68 | + - Name: B1 |
| 69 | + Format: Int32 |
| 70 | + Stride: 16 |
| 71 | + Data: [ 0, 0, 0, 0, 1, 3, 1, 255, 2147483646, -2147483647, -10, -2000 ] |
| 72 | + - Name: M2 |
| 73 | + Format: UInt32 |
| 74 | + Stride: 16 |
| 75 | + Data: [ 0, 1, 2, 16, 2147483647, 0, 10, 0, 100, 1000, 65536, 4294967295 ] |
| 76 | + - Name: A2 |
| 77 | + Format: UInt32 |
| 78 | + Stride: 16 |
| 79 | + Data: [ 0, 1, 2, 16, 1, 0, 10, 1, 2, 5, 65536, 1 ] |
| 80 | + - Name: B2 |
| 81 | + Format: UInt32 |
| 82 | + Stride: 16 |
| 83 | + Data: [ 0, 0, 1, 15, 0, 10, 10, 1, 50, 100, 1, 1 ] |
| 84 | + - Name: Out0 |
| 85 | + Format: Float32 |
| 86 | + Stride: 16 |
| 87 | + ZeroInitSize: 64 |
| 88 | + - Name: ExpectedOut0 |
| 89 | + Format: Float32 |
| 90 | + Stride: 16 |
| 91 | + Data: [ NaN, NaN, 0, 0, 0, 0, Inf, 2, 0, 1, 1, 9.5, 2, 9.5, Inf, -Inf ] |
| 92 | + - Name: Out1 |
| 93 | + Format: Int32 |
| 94 | + Stride: 16 |
| 95 | + ZeroInitSize: 64 |
| 96 | + - Name: ExpectedOut1 |
| 97 | + Format: Int32 |
| 98 | + Stride: 16 |
| 99 | + Data: [ -2147483647, 65536, 1, 0, 2, 9, 257, 255, 2147483647, -2147483646, 0, -1000, -2147483647, 65536, -2147483648, 2147483647 ] |
| 100 | + - Name: Out2 |
| 101 | + Format: UInt32 |
| 102 | + Stride: 16 |
| 103 | + ZeroInitSize: 64 |
| 104 | + - Name: ExpectedOut2 |
| 105 | + Format: UInt32 |
| 106 | + Stride: 16 |
| 107 | + Data: [ 0, 1, 5, 271, 2147483647, 10, 110, 1, 250, 5100, 1, 0, 5, 271, 1, 0 ] |
| 108 | +Results: |
| 109 | + - Result: Test0 |
| 110 | + Rule: BufferFloatULP |
| 111 | + ULPT: 1 |
| 112 | + Actual: Out0 |
| 113 | + Expected: ExpectedOut0 |
| 114 | + - Result: Test1 |
| 115 | + Rule: BufferExact |
| 116 | + Actual: Out1 |
| 117 | + Expected: ExpectedOut1 |
| 118 | + - Result: Test2 |
| 119 | + Rule: BufferExact |
| 120 | + Actual: Out2 |
| 121 | + Expected: ExpectedOut2 |
| 122 | +DescriptorSets: |
| 123 | + - Resources: |
| 124 | + - Name: M0 |
| 125 | + Kind: StructuredBuffer |
| 126 | + DirectXBinding: |
| 127 | + Register: 0 |
| 128 | + Space: 0 |
| 129 | + VulkanBinding: |
| 130 | + Binding: 0 |
| 131 | + - Name: A0 |
| 132 | + Kind: StructuredBuffer |
| 133 | + DirectXBinding: |
| 134 | + Register: 1 |
| 135 | + Space: 0 |
| 136 | + VulkanBinding: |
| 137 | + Binding: 1 |
| 138 | + - Name: B0 |
| 139 | + Kind: StructuredBuffer |
| 140 | + DirectXBinding: |
| 141 | + Register: 2 |
| 142 | + Space: 0 |
| 143 | + VulkanBinding: |
| 144 | + Binding: 2 |
| 145 | + - Name: M1 |
| 146 | + Kind: StructuredBuffer |
| 147 | + DirectXBinding: |
| 148 | + Register: 3 |
| 149 | + Space: 0 |
| 150 | + VulkanBinding: |
| 151 | + Binding: 3 |
| 152 | + - Name: A1 |
| 153 | + Kind: StructuredBuffer |
| 154 | + DirectXBinding: |
| 155 | + Register: 4 |
| 156 | + Space: 0 |
| 157 | + VulkanBinding: |
| 158 | + Binding: 4 |
| 159 | + - Name: B1 |
| 160 | + Kind: StructuredBuffer |
| 161 | + DirectXBinding: |
| 162 | + Register: 5 |
| 163 | + Space: 0 |
| 164 | + VulkanBinding: |
| 165 | + Binding: 5 |
| 166 | + - Name: M2 |
| 167 | + Kind: StructuredBuffer |
| 168 | + DirectXBinding: |
| 169 | + Register: 6 |
| 170 | + Space: 0 |
| 171 | + VulkanBinding: |
| 172 | + Binding: 6 |
| 173 | + - Name: A2 |
| 174 | + Kind: StructuredBuffer |
| 175 | + DirectXBinding: |
| 176 | + Register: 7 |
| 177 | + Space: 0 |
| 178 | + VulkanBinding: |
| 179 | + Binding: 7 |
| 180 | + - Name: B2 |
| 181 | + Kind: StructuredBuffer |
| 182 | + DirectXBinding: |
| 183 | + Register: 8 |
| 184 | + Space: 0 |
| 185 | + VulkanBinding: |
| 186 | + Binding: 8 |
| 187 | + - Name: Out0 |
| 188 | + Kind: RWStructuredBuffer |
| 189 | + DirectXBinding: |
| 190 | + Register: 9 |
| 191 | + Space: 0 |
| 192 | + VulkanBinding: |
| 193 | + Binding: 9 |
| 194 | + - Name: Out1 |
| 195 | + Kind: RWStructuredBuffer |
| 196 | + DirectXBinding: |
| 197 | + Register: 10 |
| 198 | + Space: 0 |
| 199 | + VulkanBinding: |
| 200 | + Binding: 10 |
| 201 | + - Name: Out2 |
| 202 | + Kind: RWStructuredBuffer |
| 203 | + DirectXBinding: |
| 204 | + Register: 11 |
| 205 | + Space: 0 |
| 206 | + VulkanBinding: |
| 207 | + Binding: 11 |
| 208 | +#--- end |
| 209 | + |
| 210 | +# TODO: File bug and link here |
| 211 | +# XFAIL: Clang-DirectX |
| 212 | + |
| 213 | +# RUN: split-file %s %t |
| 214 | +# RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl |
| 215 | +# RUN: %offloader %t/pipeline.yaml %t.o |
0 commit comments