Skip to content

Commit d2bae19

Browse files
authored
add test for or (#198)
* add test for or * add xfail,add tmp
1 parent 6d23f0c commit d2bae19

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

test/Feature/HLSLLib/or.test

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#--- source.hlsl
2+
3+
StructuredBuffer<bool4> In1 : register(t0);
4+
StructuredBuffer<bool4> In2 : register(t1);
5+
RWStructuredBuffer<bool4> Out : register(u1);
6+
7+
[numthreads(1,1,1)]
8+
void main() {
9+
Out[0] = or(In1[0], In2[0]);
10+
bool4 Tmp = {or(In1[0].xyz, In2[0].xyz), or(In1[0].w, In2[0].w)};
11+
Out[1] = Tmp;
12+
Out[2].xy = or(In1[0].xy, In2[0].xy);
13+
}
14+
15+
//--- pipeline.yaml
16+
17+
---
18+
Shaders:
19+
- Stage: Compute
20+
Entry: main
21+
DispatchSize: [1, 1, 1]
22+
Buffers:
23+
- Name: In1
24+
Format: Bool
25+
Stride: 16
26+
Data: [1, 0, 1, 0]
27+
- Name: In2
28+
Format: Bool
29+
Stride: 16
30+
Data: [1, 0, 0, 1]
31+
- Name: Out
32+
Format: Bool
33+
Stride: 16
34+
ZeroInitSize: 48
35+
- Name: ExpectedOut # The result we expect
36+
Format: Bool
37+
Stride: 16
38+
Data: [1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0] # Last two are filler
39+
Results:
40+
- Result: Test1
41+
Rule: BufferExact
42+
Actual: Out
43+
Expected: ExpectedOut
44+
DescriptorSets:
45+
- Resources:
46+
- Name: In1
47+
Kind: StructuredBuffer
48+
DirectXBinding:
49+
Register: 0
50+
Space: 0
51+
VulkanBinding:
52+
Binding: 0
53+
- Name: In2
54+
Kind: StructuredBuffer
55+
DirectXBinding:
56+
Register: 1
57+
Space: 0
58+
VulkanBinding:
59+
Binding: 1
60+
- Name: Out
61+
Kind: RWStructuredBuffer
62+
DirectXBinding:
63+
Register: 1
64+
Space: 0
65+
VulkanBinding:
66+
Binding: 1
67+
...
68+
#--- end
69+
70+
# https://github.com/llvm/llvm-project/issues/140824
71+
# XFAIL: Clang
72+
# https://github.com/microsoft/DirectXShaderCompiler/issues/7475
73+
# XFAIL: DXC-Vulkan
74+
# RUN: split-file %s %t
75+
# RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl
76+
# RUN: %offloader %t/pipeline.yaml %t.o

0 commit comments

Comments
 (0)