Skip to content

Commit 4e8eb85

Browse files
authored
Split texture2d OperatorIndex test in two. (#958)
The Texture2D.OperatorIndex.test.yaml has tests for both operator[] and the mips member. They should be separate tests. Enable passing Texture2D tests that are passing with clang vulkan.
1 parent 2613627 commit 4e8eb85

3 files changed

Lines changed: 78 additions & 16 deletions

File tree

test/Feature/Textures/Texture2D.Gather.test.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ Results:
119119
#--- end
120120

121121
# Unimplemented: Clang + DX: https://github.com/llvm/llvm-project/issues/101558
122-
# Unimplemented: Clang + VK: https://github.com/llvm/llvm-project/issues/175630
123-
# XFAIL: DirectX || Metal
122+
# XFAIL: DirectX || Metal
124123

125124
# RUN: split-file %s %t
126125
# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl

test/Feature/Textures/Texture2D.OperatorIndex.test.yaml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ void main() {
99
Out[1] = Tex[int2(1, 0)]; // Green
1010
Out[2] = Tex[int2(0, 1)]; // Blue
1111
Out[3] = Tex[int2(1, 1)]; // White
12-
13-
// Texture2D::mips.operator[][]
14-
Out[4] = Tex.mips[0][int2(0, 0)]; // Red
15-
Out[5] = Tex.mips[0][int2(1, 1)]; // White
16-
17-
// Test mip 1 (1x1)
18-
Out[6] = Tex.mips[1][int2(0, 0)]; // Yellow
1912
}
2013

2114
//--- pipeline.yaml
@@ -39,18 +32,15 @@ Buffers:
3932
- Name: Out
4033
Format: Float32
4134
Channels: 4
42-
FillSize: 112 # 7 * sizeof(float4)
35+
FillSize: 64 # 4 * sizeof(float4)
4336

4437
- Name: Expected
4538
Format: Float32
4639
Channels: 4
4740
Data: [ 1.0, 0.0, 0.0, 1.0, # [0]
4841
0.0, 1.0, 0.0, 1.0, # [1]
4942
0.0, 0.0, 1.0, 1.0, # [2]
50-
1.0, 1.0, 1.0, 1.0, # [3]
51-
1.0, 0.0, 0.0, 1.0, # [4]
52-
1.0, 1.0, 1.0, 1.0, # [5]
53-
1.0, 1.0, 0.0, 1.0 ] # [6] Yellow (mip 1)
43+
1.0, 1.0, 1.0, 1.0 ] # [3]
5444

5545
DescriptorSets:
5646
- Resources:
@@ -72,8 +62,7 @@ Results:
7262
#--- end
7363

7464
# Unimplemented: Clang + DX: https://github.com/llvm/llvm-project/issues/101558
75-
# Unimplemented: Clang + VK: https://github.com/llvm/llvm-project/issues/175630
76-
# XFAIL: DirectX || Metal || Clang
65+
# XFAIL: DirectX || Metal
7766

7867
# RUN: split-file %s %t
7968
# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#--- source.hlsl
2+
[[vk::binding(0, 0)]] Texture2D<float4> Tex : register(t0);
3+
[[vk::binding(1, 0)]] RWBuffer<float4> Out : register(u0);
4+
5+
[numthreads(1, 1, 1)]
6+
void main() {
7+
// Texture2D::mips.operator[][]
8+
Out[0] = Tex.mips[0][int2(0, 0)]; // Red
9+
Out[1] = Tex.mips[0][int2(1, 1)]; // White
10+
11+
// Test mip 1 (1x1)
12+
Out[2] = Tex.mips[1][int2(0, 0)]; // Yellow
13+
}
14+
15+
//--- pipeline.yaml
16+
---
17+
Shaders:
18+
- Stage: Compute
19+
Entry: main
20+
DispatchSize: [1, 1, 1]
21+
22+
Buffers:
23+
- Name: Tex
24+
Format: Float32
25+
Channels: 4
26+
OutputProps: { Width: 2, Height: 2, Depth: 1, MipLevels: 2 }
27+
Data: [ 1.0, 0.0, 0.0, 1.0, # Mip 0 (2x2)
28+
0.0, 1.0, 0.0, 1.0,
29+
0.0, 0.0, 1.0, 1.0,
30+
1.0, 1.0, 1.0, 1.0,
31+
1.0, 1.0, 0.0, 1.0 ] # Mip 1 (1x1) - Yellow
32+
33+
- Name: Out
34+
Format: Float32
35+
Channels: 4
36+
FillSize: 48 # 3 * sizeof(float4)
37+
38+
- Name: Expected
39+
Format: Float32
40+
Channels: 4
41+
Data: [ 1.0, 0.0, 0.0, 1.0, # [0] Red
42+
1.0, 1.0, 1.0, 1.0, # [1] White
43+
1.0, 1.0, 0.0, 1.0 ] # [2] Yellow (mip 1)
44+
45+
DescriptorSets:
46+
- Resources:
47+
- Name: Tex
48+
Kind: Texture2D
49+
DirectXBinding: { Register: 0, Space: 0 }
50+
VulkanBinding: { Binding: 0 }
51+
- Name: Out
52+
Kind: RWBuffer
53+
DirectXBinding: { Register: 0, Space: 0 }
54+
VulkanBinding: { Binding: 1 }
55+
56+
Results:
57+
- Result: MipsOperatorIndexTest
58+
Rule: BufferExact
59+
Actual: Out
60+
Expected: Expected
61+
...
62+
#--- end
63+
64+
# Unimplemented: https://github.com/llvm/llvm-project/issues/101558
65+
# XFAIL: Clang && DirectX
66+
67+
# Unimplemented: https://github.com/llvm/offload-test-suite/issues/1039
68+
# XFAIL: DirectX
69+
70+
# XFAIL: Metal
71+
72+
# RUN: split-file %s %t
73+
# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl
74+
# RUN: %offloader %t/pipeline.yaml %t.o

0 commit comments

Comments
 (0)