|
1 |
| -#--- source.hlsl |
2 |
| -RWStructuredBuffer<int> Buf : register(u0); |
3 |
| -RWStructuredBuffer<int> Zeros : register(u1); |
4 |
| -RWStructuredBuffer<int> NegOnes : register(u2); |
5 |
| - |
6 |
| -[numthreads(8,1,1)] |
7 |
| -void main(uint3 TID : SV_GroupThreadID) { |
8 |
| - if (TID.x >= 5) |
9 |
| - return; |
10 |
| - |
11 |
| - Zeros[TID.x] = Buf[TID.x] / Zeros[TID.x]; |
12 |
| - NegOnes[TID.x] = Buf[TID.x] / NegOnes[TID.x]; |
13 |
| -} |
14 |
| -//--- pipeline.yaml |
15 |
| ---- |
16 |
| -DispatchSize: [1, 1, 1] |
17 |
| -DescriptorSets: |
18 |
| - - Resources: |
19 |
| - - Access: ReadWrite |
20 |
| - Format: Int32 |
21 |
| - RawSize: 4 |
22 |
| - Data: [ 1, -1, 2147483647, -2147483648, 0] |
23 |
| - DirectXBinding: |
24 |
| - Register: 0 |
25 |
| - Space: 0 |
26 |
| - - Access: ReadWrite |
27 |
| - Format: Int32 |
28 |
| - RawSize: 4 |
29 |
| - Data: [ 0, 0, 0, 0, 0] |
30 |
| - DirectXBinding: |
31 |
| - Register: 1 |
32 |
| - Space: 0 |
33 |
| - - Access: ReadWrite |
34 |
| - Format: Int32 |
35 |
| - RawSize: 4 |
36 |
| - Data: [ -1, -1, -1, -1, -1] |
37 |
| - DirectXBinding: |
38 |
| - Register: 2 |
39 |
| - Space: 0 |
40 |
| -... |
41 |
| -#--- end |
42 |
| - |
43 |
| -# UNSUPPORTED: Clang |
44 |
| -# XFAIL: DirectX-WARP |
45 |
| -# RUN: split-file %s %t |
46 |
| -# RUN: %if DirectX %{ dxc -T cs_6_0 -Fo %t.dxil %t/source.hlsl %} |
47 |
| -# RUN: %if DirectX %{ %gpu-exec %t/pipeline.yaml %t.dxil | FileCheck %s %} |
48 |
| -# RUN: %if Vulkan %{ dxc -T cs_6_0 -spirv -Fo %t.spv %t/source.hlsl %} |
49 |
| -# RUN: %if Vulkan %{ %gpu-exec %t/pipeline.yaml %t.spv | FileCheck %s %} |
50 |
| -# RUN: %if Metal %{ dxc -T cs_6_0 -Fo %t.dxil %t/source.hlsl %} |
51 |
| -# RUN: %if Metal %{ metal-shaderconverter %t.dxil -o=%t.metallib %} |
52 |
| -# RUN: %if Metal %{ %gpu-exec %t/pipeline.yaml %t.metallib | FileCheck %s %} |
53 |
| - |
54 |
| -# XFAIL: DirectX-Intel |
55 |
| -# On Intel drivers N/0 returns INT_MAX for N >= 0, and INT_MIN for N < 0. |
56 |
| -# Oddly enough, Vulkan-Intel works just fine... |
57 |
| - |
58 |
| -# XFAIL: Metal |
59 |
| -# On Metal 0/0 = 0, but other platforms n/0 = -1. |
60 |
| - |
61 |
| -# CHECK: Access: ReadWrite |
62 |
| -# CHECK: Access: ReadWrite |
63 |
| -# CHECK-NEXT: Format: Int32 |
64 |
| -# CHECK-NEXT: RawSize: 4 |
65 |
| -# CHECK-NEXT: Data: [ -1, -1, -1, -1, -1 ] |
66 |
| -# CHECK: Access: ReadWrite |
67 |
| -# CHECK-NEXT: Format: Int32 |
68 |
| -# CHECK-NEXT: RawSize: 4 |
69 |
| -# CHECK-NEXT: Data: [ -1, 1, -2147483647, -2147483648, 0 ] |
| 1 | +#--- source.hlsl |
| 2 | +RWStructuredBuffer<int> Buf : register(u0); |
| 3 | +RWStructuredBuffer<int> Zeros : register(u1); |
| 4 | +RWStructuredBuffer<int> NegOnes : register(u2); |
| 5 | + |
| 6 | +[numthreads(8,1,1)] |
| 7 | +void main(uint3 TID : SV_GroupThreadID) { |
| 8 | + if (TID.x >= 5) |
| 9 | + return; |
| 10 | + |
| 11 | + Zeros[TID.x] = Buf[TID.x] / Zeros[TID.x]; |
| 12 | + NegOnes[TID.x] = Buf[TID.x] / NegOnes[TID.x]; |
| 13 | +} |
| 14 | +//--- pipeline.yaml |
| 15 | +--- |
| 16 | +DispatchSize: [1, 1, 1] |
| 17 | +DescriptorSets: |
| 18 | + - Resources: |
| 19 | + - Access: ReadWrite |
| 20 | + Format: Int32 |
| 21 | + RawSize: 4 |
| 22 | + Data: [ 1, -1, 2147483647, -2147483648, 0] |
| 23 | + DirectXBinding: |
| 24 | + Register: 0 |
| 25 | + Space: 0 |
| 26 | + - Access: ReadWrite |
| 27 | + Format: Int32 |
| 28 | + RawSize: 4 |
| 29 | + Data: [ 0, 0, 0, 0, 0] |
| 30 | + DirectXBinding: |
| 31 | + Register: 1 |
| 32 | + Space: 0 |
| 33 | + - Access: ReadWrite |
| 34 | + Format: Int32 |
| 35 | + RawSize: 4 |
| 36 | + Data: [ -1, -1, -1, -1, -1] |
| 37 | + DirectXBinding: |
| 38 | + Register: 2 |
| 39 | + Space: 0 |
| 40 | +... |
| 41 | +#--- end |
| 42 | + |
| 43 | +# UNSUPPORTED: Clang |
| 44 | +# RUN: split-file %s %t |
| 45 | +# RUN: %if DirectX %{ dxc -T cs_6_0 -Fo %t.dxil %t/source.hlsl %} |
| 46 | +# RUN: %if DirectX %{ %gpu-exec %t/pipeline.yaml %t.dxil | FileCheck %s %} |
| 47 | +# RUN: %if Vulkan %{ dxc -T cs_6_0 -spirv -Fo %t.spv %t/source.hlsl %} |
| 48 | +# RUN: %if Vulkan %{ %gpu-exec %t/pipeline.yaml %t.spv | FileCheck %s %} |
| 49 | +# RUN: %if Metal %{ dxc -T cs_6_0 -Fo %t.dxil %t/source.hlsl %} |
| 50 | +# RUN: %if Metal %{ metal-shaderconverter %t.dxil -o=%t.metallib %} |
| 51 | +# RUN: %if Metal %{ %gpu-exec %t/pipeline.yaml %t.metallib | FileCheck %s %} |
| 52 | + |
| 53 | +# Divide by-zero behavior seems to be erradic enough to call it undefined... |
| 54 | + |
| 55 | +# CHECK: Access: ReadWrite |
| 56 | +# CHECK: Access: ReadWrite |
| 57 | +# CHECK: Access: ReadWrite |
| 58 | +# CHECK-NEXT: Format: Int32 |
| 59 | +# CHECK-NEXT: RawSize: 4 |
| 60 | +# CHECK-NEXT: Data: [ -1, 1, -2147483647, 2147483647, 0 ] |
0 commit comments