Skip to content

Commit 2ce85d7

Browse files
committed
add plethora of tests
1 parent 3e54c9d commit 2ce85d7

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

clang/test/SemaHLSL/RootSignature-resource-ranges-err.hlsl

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,46 @@ void bad_root_signature_3() {}
1919
// expected-error@+1 {{resource ranges u[0;0] and u[0;0] overlap within space = 0 and visibility = Pixel}}
2020
[RootSignature("UAV(u0, visibility = SHADER_VISIBILITY_PIXEL), UAV(u0, visibility = SHADER_VISIBILITY_ALL)")]
2121
void bad_root_signature_4() {}
22+
23+
// expected-error@+1 {{resource ranges b[0;0] and b[0;0] overlap within space = 0 and visibility = All}}
24+
[RootSignature("RootConstants(num32BitConstants=4, b0), RootConstants(num32BitConstants=2, b0)")]
25+
void bad_root_signature_5() {}
26+
27+
// expected-error@+1 {{resource ranges s[3;3] and s[3;3] overlap within space = 0 and visibility = All}}
28+
[RootSignature("StaticSampler(s3), StaticSampler(s3)")]
29+
void bad_root_signature_6() {}
30+
31+
// expected-error@+1 {{resource ranges t[2;5] and t[0;3] overlap within space = 0 and visibility = All}}
32+
[RootSignature("DescriptorTable(SRV(t0, numDescriptors=4), SRV(t2, numDescriptors=4))")]
33+
void bad_root_signature_7() {}
34+
35+
// expected-error@+1 {{resource ranges u[2;5] and u[0;4294967295] overlap within space = 0 and visibility = Hull}}
36+
[RootSignature("DescriptorTable(UAV(u0, numDescriptors=unbounded), visibility = SHADER_VISIBILITY_HULL), DescriptorTable(UAV(u2, numDescriptors=4))")]
37+
void bad_root_signature_8() {}
38+
39+
// expected-error@+1 {{resource ranges b[0;2] and b[2;2] overlap within space = 0 and visibility = All}}
40+
[RootSignature("RootConstants(num32BitConstants=4, b2), DescriptorTable(CBV(b0, numDescriptors=3))")]
41+
void bad_root_signature_9() {}
42+
43+
// expected-error@+1 {{resource ranges s[4;4294967295] and s[17;17] overlap within space = 0 and visibility = All}}
44+
[RootSignature("StaticSampler(s17), DescriptorTable(Sampler(s0, numDescriptors=3),Sampler(s4, numDescriptors=unbounded))")]
45+
void bad_root_signature_10() {}
46+
47+
// expected-error@+1 {{resource ranges b[45;45] and b[4;4294967295] overlap within space = 0 and visibility = Geometry}}
48+
[RootSignature("DescriptorTable(CBV(b4, numDescriptors=unbounded)), CBV(b45, visibility = SHADER_VISIBILITY_GEOMETRY)")]
49+
void bad_root_signature_11() {}
50+
51+
#define ReportFirstOverlap \
52+
"DescriptorTable( " \
53+
" CBV(b4, numDescriptors = 4), " \
54+
" CBV(b1, numDescriptors = 2), " \
55+
" CBV(b0, numDescriptors = 8), " \
56+
")"
57+
58+
// expected-error@+1 {{resource ranges b[0;7] and b[1;2] overlap within space = 0 and visibility = All}}
59+
[RootSignature(ReportFirstOverlap)]
60+
void bad_root_signature_12() {}
61+
62+
// expected-error@+1 {{resource ranges s[2;2] and s[2;2] overlap within space = 0 and visibility = Vertex}}
63+
[RootSignature("StaticSampler(s2, visibility=SHADER_VISIBILITY_ALL), DescriptorTable(Sampler(s2), visibility=SHADER_VISIBILITY_VERTEX)")]
64+
void valid_root_signature_13() {}

clang/test/SemaHLSL/RootSignature-resource-ranges.hlsl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,12 @@ void valid_root_signature_2() {}
1313

1414
[RootSignature("CBV(b0), SRV(t0)")]
1515
void valid_root_signature_3() {}
16+
17+
[RootSignature("RootConstants(num32BitConstants=4, b0, space=0), DescriptorTable(CBV(b0, space=1))")]
18+
void valid_root_signature_4() {}
19+
20+
[RootSignature("StaticSampler(s2, visibility=SHADER_VISIBILITY_PIXEL), DescriptorTable(Sampler(s2), visibility=SHADER_VISIBILITY_VERTEX)")]
21+
void valid_root_signature_5() {}
22+
23+
[RootSignature("DescriptorTable(SRV(t5), UAV(u5, numDescriptors=2))")]
24+
void valid_root_signature_6() {}

0 commit comments

Comments
 (0)