|
| 1 | +#--- source.hlsl |
| 2 | +StructuredBuffer<float4> X0 : register(t0); |
| 3 | +StructuredBuffer<float4> Y0 : register(t1); |
| 4 | +StructuredBuffer<int4> X1 : register(t2); |
| 5 | +StructuredBuffer<int4> Y1 : register(t3); |
| 6 | +StructuredBuffer<uint4> X2 : register(t4); |
| 7 | +StructuredBuffer<uint4> Y2 : register(t5); |
| 8 | + |
| 9 | +RWStructuredBuffer<float4> Out0 : register(u6); |
| 10 | +RWStructuredBuffer<int4> Out1 : register(u7); |
| 11 | +RWStructuredBuffer<uint4> Out2 : register(u8); |
| 12 | + |
| 13 | + |
| 14 | +[numthreads(1,1,1)] |
| 15 | +void main() { |
| 16 | + // float |
| 17 | + Out0[0] = min(X0[0], Y0[0]); |
| 18 | + Out0[1] = float4(min(X0[1].xyz, Y0[1].xyz), min(X0[1].w, Y0[1].w)); |
| 19 | + Out0[2] = float4(min(X0[2].xy, Y0[2].xy), min(X0[2].zw, Y0[2].zw)); |
| 20 | + Out0[3] = min(X0[3], Y0[3]); |
| 21 | + Out0[4] = min(half4(1.0, -1.0, 31408, -415), half4(-1.0, 1.0, 1.5, 129.5)); |
| 22 | + |
| 23 | + // int |
| 24 | + Out1[0] = min(X1[0], Y1[0]); |
| 25 | + Out1[1] = int4(min(X1[1].xyz, Y1[1].xyz), min(X1[1].w, Y1[1].w)); |
| 26 | + Out1[2] = int4(min(X1[2].xy, Y1[2].xy), min(X1[2].zw, Y1[2].zw)); |
| 27 | + Out1[3] = min(X1[3], Y1[3]); |
| 28 | + Out1[3] = min(int4(-2147483648, -10, 10, 2147483647), int4(0, 10, 10, 0));; |
| 29 | + |
| 30 | + // uint |
| 31 | + Out2[0] = min(X2[0], Y2[0]); |
| 32 | + Out2[1] = uint4(min(X2[1].xyz, Y2[1].xyz), min(X2[1].w, Y2[1].w)); |
| 33 | + Out2[2] = uint4(min(X2[2].xy, Y2[2].xy), min(X2[2].zw, Y2[2].zw)); |
| 34 | + Out2[3] = min(X2[3], Y2[3]); |
| 35 | + Out2[3] = min(uint4(0, 0, 10, 10000), uint4(0, 256, 4, 10001)); |
| 36 | +} |
| 37 | +//--- pipeline.yaml |
| 38 | + |
| 39 | +--- |
| 40 | +Shaders: |
| 41 | + - Stage: Compute |
| 42 | + Entry: main |
| 43 | + DispatchSize: [1, 1, 1] |
| 44 | +Buffers: |
| 45 | + - Name: X0 |
| 46 | + Format: Float32 |
| 47 | + Stride: 16 |
| 48 | + Data: [ -inf, -inf, -inf, -inf, inf, inf, inf, inf, NaN, NaN, NaN, NaN, 1.0, 1.0, -1.0, -1.0 ] |
| 49 | + - Name: Y0 |
| 50 | + Format: Float32 |
| 51 | + Stride: 16 |
| 52 | + Data: [ -inf, inf, 1.0, NaN, -inf, inf, 1.0, NaN, -inf, inf, 1.0, NaN, -inf, inf, 1.0, NaN ] |
| 53 | + - Name: X1 |
| 54 | + Format: Int32 |
| 55 | + Stride: 16 |
| 56 | + Data: [ -2147483648, -10, 0, 0, 10, 2147483647, 1000, 2500, 1, -1, 512, -2048 ] |
| 57 | + - Name: Y1 |
| 58 | + Format: Int32 |
| 59 | + Stride: 16 |
| 60 | + Data: [ 0, 10, -10, 10, 10, 0, 1500, 2000, -1, 1, 511, -2047 ] |
| 61 | + - Name: X2 |
| 62 | + Format: UInt32 |
| 63 | + Stride: 16 |
| 64 | + Data: [ 0, 0, 10, 10000, 2147483647, 4294967295, 1000, 2500, 1, 256, 512, 2048 ] |
| 65 | + - Name: Y2 |
| 66 | + Format: UInt32 |
| 67 | + Stride: 16 |
| 68 | + Data: [ 0, 256, 4, 10001, 0, 4294967295, 1500, 2000, 0, 200, 511, 2047 ] |
| 69 | + - Name: Out0 |
| 70 | + Format: Float32 |
| 71 | + Stride: 16 |
| 72 | + ZeroInitSize: 80 |
| 73 | + - Name: ExpectedOut0 |
| 74 | + Format: Float32 |
| 75 | + Stride: 16 |
| 76 | + Data: [ -inf, -inf, -inf, -inf, -inf, inf, 1.0, inf, -inf, inf, 1.0, NaN, -inf, 1.0, -1.0, -1.0, -1.0, -1.0, 1.5, -415 ] |
| 77 | + - Name: Out1 |
| 78 | + Format: Int32 |
| 79 | + Stride: 16 |
| 80 | + ZeroInitSize: 64 |
| 81 | + - Name: ExpectedOut1 |
| 82 | + Format: Int32 |
| 83 | + Stride: 16 |
| 84 | + Data: [ -2147483648, -10, -10, 0, 10, 0, 1000, 2000, -1, -1, 511, -2048, -2147483648, -10, 10, 0 ] |
| 85 | + - Name: Out2 |
| 86 | + Format: UInt32 |
| 87 | + Stride: 16 |
| 88 | + ZeroInitSize: 64 |
| 89 | + - Name: ExpectedOut2 |
| 90 | + Format: UInt32 |
| 91 | + Stride: 16 |
| 92 | + Data: [ 0, 0, 4, 10000, 0, 4294967295, 1000, 2000, 0, 200, 511, 2047, 0, 0, 4, 10000 ] |
| 93 | +Results: |
| 94 | + - Result: Test0 |
| 95 | + Rule: BufferFloatEpsilon |
| 96 | + Epsilon: 0 |
| 97 | + Actual: Out0 |
| 98 | + Expected: ExpectedOut0 |
| 99 | + - Result: Test1 |
| 100 | + Rule: BufferExact |
| 101 | + Actual: Out1 |
| 102 | + Expected: ExpectedOut1 |
| 103 | + - Result: Test2 |
| 104 | + Rule: BufferExact |
| 105 | + Actual: Out2 |
| 106 | + Expected: ExpectedOut2 |
| 107 | +DescriptorSets: |
| 108 | + - Resources: |
| 109 | + - Name: X0 |
| 110 | + Kind: StructuredBuffer |
| 111 | + DirectXBinding: |
| 112 | + Register: 0 |
| 113 | + Space: 0 |
| 114 | + VulkanBinding: |
| 115 | + Binding: 0 |
| 116 | + - Name: Y0 |
| 117 | + Kind: StructuredBuffer |
| 118 | + DirectXBinding: |
| 119 | + Register: 1 |
| 120 | + Space: 0 |
| 121 | + VulkanBinding: |
| 122 | + Binding: 1 |
| 123 | + - Name: X1 |
| 124 | + Kind: StructuredBuffer |
| 125 | + DirectXBinding: |
| 126 | + Register: 2 |
| 127 | + Space: 0 |
| 128 | + VulkanBinding: |
| 129 | + Binding: 2 |
| 130 | + - Name: Y1 |
| 131 | + Kind: StructuredBuffer |
| 132 | + DirectXBinding: |
| 133 | + Register: 3 |
| 134 | + Space: 0 |
| 135 | + VulkanBinding: |
| 136 | + Binding: 3 |
| 137 | + - Name: X2 |
| 138 | + Kind: StructuredBuffer |
| 139 | + DirectXBinding: |
| 140 | + Register: 4 |
| 141 | + Space: 0 |
| 142 | + VulkanBinding: |
| 143 | + Binding: 4 |
| 144 | + - Name: Y2 |
| 145 | + Kind: StructuredBuffer |
| 146 | + DirectXBinding: |
| 147 | + Register: 5 |
| 148 | + Space: 0 |
| 149 | + VulkanBinding: |
| 150 | + Binding: 5 |
| 151 | + - Name: Out0 |
| 152 | + Kind: RWStructuredBuffer |
| 153 | + DirectXBinding: |
| 154 | + Register: 6 |
| 155 | + Space: 0 |
| 156 | + VulkanBinding: |
| 157 | + Binding: 6 |
| 158 | + - Name: Out1 |
| 159 | + Kind: RWStructuredBuffer |
| 160 | + DirectXBinding: |
| 161 | + Register: 7 |
| 162 | + Space: 0 |
| 163 | + VulkanBinding: |
| 164 | + Binding: 7 |
| 165 | + - Name: Out2 |
| 166 | + Kind: RWStructuredBuffer |
| 167 | + DirectXBinding: |
| 168 | + Register: 8 |
| 169 | + Space: 0 |
| 170 | + VulkanBinding: |
| 171 | + Binding: 8 |
| 172 | +#--- end |
| 173 | + |
| 174 | + |
| 175 | +# RUN: split-file %s %t |
| 176 | +# RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl |
| 177 | +# RUN: %offloader %t/pipeline.yaml %t.o |
0 commit comments