Skip to content

Add test for and #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions test/Feature/HLSLLib/and.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#--- source.hlsl

StructuredBuffer<bool4> In1 : register(t0);
StructuredBuffer<bool4> In2 : register(t1);
RWStructuredBuffer<bool4> Out : register(u1);

[numthreads(1,1,1)]
void main() {
Out[0] = and(In1[0], In2[0]);
Out[1].xyz = and(In1[0].xyz, In2[0].xyz);
Out[1].w = and(In1[0].w, In2[0].w);
Out[2].xy = and(In1[0].xy, In2[0].xy);
}

//--- pipeline.yaml

---
Shaders:
- Stage: Compute
Entry: main
DispatchSize: [1, 1, 1]
Buffers:
- Name: In1
Format: Bool
Stride: 16
Data: [1, 0, 1, 0]
- Name: In2
Format: Bool
Stride: 16
Data: [1, 0, 0, 1]
- Name: Out
Format: Bool
Stride: 16
ZeroInitSize: 48
- Name: ExpectedOut # The result we expect
Format: Bool
Stride: 16
Data: [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0] # Last two are filler
Results:
- Result: Test1
Rule: BufferExact
Actual: Out
Expected: ExpectedOut
DescriptorSets:
- Resources:
- Name: In1
Kind: StructuredBuffer
DirectXBinding:
Register: 0
Space: 0
VulkanBinding:
Binding: 0
- Name: In2
Kind: StructuredBuffer
DirectXBinding:
Register: 1
Space: 0
VulkanBinding:
Binding: 1
- Name: Out
Kind: RWStructuredBuffer
DirectXBinding:
Register: 1
Space: 0
VulkanBinding:
Binding: 1
...
#--- end

# UNSUPPORTED: Clang
# RUN: split-file %s %t
# RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl
# RUN: %offloader %t/pipeline.yaml %t.o
Loading