| 1 |
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -fsyntax-only %s -verify |
| 2 |
// RUN: not %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -fsyntax-only %s 2>&1 | FileCheck %s |
| 3 |
|
| 4 |
// expected-error@+2 {{resource ranges b[42;42] and b[42;42] overlap within space = 0 and visibility = All}} |
| 5 |
// expected-note@+1 {{overlapping resource range here}} |
| 6 |
[RootSignature("CBV(b42), CBV(b42)")] |
| 7 |
void bad_root_signature_0() {} |
| 8 |
|
| 9 |
// expected-error@+2 {{resource ranges t[0;0] and t[0;0] overlap within space = 3 and visibility = All}} |
| 10 |
// expected-note@+1 {{overlapping resource range here}} |
| 11 |
[RootSignature("SRV(t0, space = 3), SRV(t0, space = 3)")] |
| 12 |
void bad_root_signature_1() {} |
| 13 |
|
| 14 |
// expected-error@+2 {{resource ranges u[0;0] and u[0;0] overlap within space = 0 and visibility = Pixel}} |
| 15 |
// expected-note@+1 {{overlapping resource range here}} |
| 16 |
[RootSignature("UAV(u0, visibility = SHADER_VISIBILITY_PIXEL), UAV(u0, visibility = SHADER_VISIBILITY_PIXEL)")] |
| 17 |
void bad_root_signature_2() {} |
| 18 |
|
| 19 |
// expected-error@+2 {{resource ranges u[0;0] and u[0;0] overlap within space = 0 and visibility = Pixel}} |
| 20 |
// expected-note@+1 {{overlapping resource range here}} |
| 21 |
[RootSignature("UAV(u0, visibility = SHADER_VISIBILITY_ALL), UAV(u0, visibility = SHADER_VISIBILITY_PIXEL)")] |
| 22 |
void bad_root_signature_3() {} |
| 23 |
|
| 24 |
// expected-error@+2 {{resource ranges u[0;0] and u[0;0] overlap within space = 0 and visibility = Pixel}} |
| 25 |
// expected-note@+1 {{overlapping resource range here}} |
| 26 |
[RootSignature("UAV(u0, visibility = SHADER_VISIBILITY_PIXEL), UAV(u0, visibility = SHADER_VISIBILITY_ALL)")] |
| 27 |
void bad_root_signature_4() {} |
| 28 |
|
| 29 |
// expected-error@+2 {{resource ranges b[0;0] and b[0;0] overlap within space = 0 and visibility = All}} |
| 30 |
// expected-note@+1 {{overlapping resource range here}} |
| 31 |
[RootSignature("RootConstants(num32BitConstants=4, b0), RootConstants(num32BitConstants=2, b0)")] |
| 32 |
void bad_root_signature_5() {} |
| 33 |
|
| 34 |
// expected-error@+2 {{resource ranges s[3;3] and s[3;3] overlap within space = 0 and visibility = All}} |
| 35 |
// expected-note@+1 {{overlapping resource range here}} |
| 36 |
[RootSignature("StaticSampler(s3), StaticSampler(s3)")] |
| 37 |
void bad_root_signature_6() {} |
| 38 |
|
| 39 |
// expected-error@+2 {{resource ranges t[2;5] and t[0;3] overlap within space = 0 and visibility = All}} |
| 40 |
// expected-note@+1 {{overlapping resource range here}} |
| 41 |
[RootSignature("DescriptorTable(SRV(t0, numDescriptors=4), SRV(t2, numDescriptors=4))")] |
| 42 |
void bad_root_signature_7() {} |
| 43 |
|
| 44 |
// expected-error@+2 {{resource ranges u[2;5] and u[0;unbounded) overlap within space = 0 and visibility = Hull}} |
| 45 |
// expected-note@+1 {{overlapping resource range here}} |
| 46 |
[RootSignature("DescriptorTable(UAV(u0, numDescriptors=unbounded), visibility = SHADER_VISIBILITY_HULL), DescriptorTable(UAV(u2, numDescriptors=4))")] |
| 47 |
void bad_root_signature_8() {} |
| 48 |
|
| 49 |
// expected-error@+2 {{resource ranges b[2;2] and b[0;2] overlap within space = 0 and visibility = All}} |
| 50 |
// expected-note@+1 {{overlapping resource range here}} |
| 51 |
[RootSignature("RootConstants(num32BitConstants=4, b2), DescriptorTable(CBV(b0, numDescriptors=3))")] |
| 52 |
void bad_root_signature_9() {} |
| 53 |
|
| 54 |
// expected-error@+2 {{resource ranges s[17;17] and s[4;unbounded) overlap within space = 0 and visibility = All}} |
| 55 |
// expected-note@+1 {{overlapping resource range here}} |
| 56 |
[RootSignature("StaticSampler(s17), DescriptorTable(Sampler(s0, numDescriptors=3),Sampler(s4, numDescriptors=unbounded))")] |
| 57 |
void bad_root_signature_10() {} |
| 58 |
|
| 59 |
// expected-error@+2 {{resource ranges b[45;45] and b[4;unbounded) overlap within space = 0 and visibility = Geometry}} |
| 60 |
// expected-note@+1 {{overlapping resource range here}} |
| 61 |
[RootSignature("DescriptorTable(CBV(b4, numDescriptors=unbounded)), CBV(b45, visibility = SHADER_VISIBILITY_GEOMETRY)")] |
| 62 |
void bad_root_signature_11() {} |
| 63 |
|
| 64 |
#define ReportFirstOverlap \ |
| 65 |
"DescriptorTable( " \ |
| 66 |
" CBV(b4, numDescriptors = 4), " \ |
| 67 |
" CBV(b1, numDescriptors = 2), " \ |
| 68 |
" CBV(b0, numDescriptors = 8), " \ |
| 69 |
")" |
| 70 |
|
| 71 |
// expected-error@+4 {{resource ranges b[4;7] and b[0;7] overlap within space = 0 and visibility = All}} |
| 72 |
// expected-error@+3 {{resource ranges b[1;2] and b[0;7] overlap within space = 0 and visibility = All}} |
| 73 |
// expected-note@+2 {{overlapping resource range here}} |
| 74 |
// expected-note@+1 {{overlapping resource range here}} |
| 75 |
[RootSignature(ReportFirstOverlap)] |
| 76 |
void bad_root_signature_12() {} |
| 77 |
|
| 78 |
// expected-error@+2 {{resource ranges s[2;2] and s[2;2] overlap within space = 0 and visibility = Vertex}} |
| 79 |
// expected-note@+1 {{overlapping resource range here}} |
| 80 |
[RootSignature("StaticSampler(s2, visibility=SHADER_VISIBILITY_ALL), DescriptorTable(Sampler(s2), visibility=SHADER_VISIBILITY_VERTEX)")] |
| 81 |
void valid_root_signature_13() {} |
| 82 |
|
| 83 |
#define DemoNoteSourceLocations \ |
| 84 |
"DescriptorTable( " \ |
| 85 |
" CBV(b4, numDescriptors = 4), " \ |
| 86 |
" SRV(t22, numDescriptors = 1), " \ |
| 87 |
" UAV(u42, numDescriptors = 2), " \ |
| 88 |
" CBV(b9, numDescriptors = 8), " \ |
| 89 |
" SRV(t12, numDescriptors = 3), " \ |
| 90 |
" UAV(u3, numDescriptors = 16), " \ |
| 91 |
" SRV(t9, numDescriptors = 1), " \ |
| 92 |
" CBV(b1, numDescriptors = 2), " \ |
| 93 |
" SRV(t17, numDescriptors = 7), " \ |
| 94 |
" UAV(u0, numDescriptors = 3), " \ |
| 95 |
")" |
| 96 |
|
| 97 |
// CHECK: [[@LINE-11]]:5: note: expanded from macro 'DemoNoteSourceLocations' |
| 98 |
// CHECK-NEXT: [[@LINE-12]] | " SRV(t22, numDescriptors = 1), " |
| 99 |
// CHECK-NEXT: | ^ |
| 100 |
// CHECK: [[@LINE-7]]:5: note: expanded from macro 'DemoNoteSourceLocations' |
| 101 |
// CHECK-NEXT: [[@LINE-8]] | " SRV(t17, numDescriptors = 7), " \ |
| 102 |
// CHECK-NEXT: | ^ |
| 103 |
|
| 104 |
// expected-error@+2 {{resource ranges t[22;22] and t[17;23] overlap within space = 0 and visibility = All}} |
| 105 |
// expected-note@+1 {{overlapping resource range here}} |
| 106 |
[RootSignature(DemoNoteSourceLocations)] |
| 107 |
void bad_root_signature_14() {} |
| 108 |
|
| 109 |
#define DuplicatesRootSignature \ |
| 110 |
"CBV(b0), CBV(b0), CBV(b0), DescriptorTable(CBV(b0, numDescriptors = 2))" |
| 111 |
|
| 112 |
// expected-error@+6 {{resource ranges b[0;0] and b[0;0] overlap within space = 0 and visibility = All}} |
| 113 |
// expected-note@+5 {{overlapping resource range here}} |
| 114 |
// expected-error@+4 {{resource ranges b[0;0] and b[0;0] overlap within space = 0 and visibility = All}} |
| 115 |
// expected-note@+3 {{overlapping resource range here}} |
| 116 |
// expected-error@+2 {{resource ranges b[0;1] and b[0;0] overlap within space = 0 and visibility = All}} |
| 117 |
// expected-note@+1 {{overlapping resource range here}} |
| 118 |
[RootSignature(DuplicatesRootSignature)] |
| 119 |
void valid_root_signature_15() {} |
| 120 |
|
| 121 |
#define AppendingToUnbound \ |
| 122 |
"DescriptorTable(CBV(b1, numDescriptors = unbounded), CBV(b0))" |
| 123 |
|
| 124 |
// expected-error@+1 {{offset appends to unbounded descriptor range}} |
| 125 |
[RootSignature(AppendingToUnbound)] |
| 126 |
void append_to_unbound_signature() {} |
| 127 |
|
| 128 |
#define DirectOffsetOverflow \ |
| 129 |
"DescriptorTable(CBV(b0, offset = 4294967294 , numDescriptors = 6))" |
| 130 |
|
| 131 |
// expected-error@+1 {{descriptor range offset overflows [4294967294, 4294967299]}} |
| 132 |
[RootSignature(DirectOffsetOverflow)] |
| 133 |
void direct_offset_overflow_signature() {} |
| 134 |
|
| 135 |
#define AppendOffsetOverflow \ |
| 136 |
"DescriptorTable(CBV(b0, offset = 4294967292), CBV(b1, numDescriptors = 7))" |
| 137 |
|
| 138 |
// expected-error@+1 {{descriptor range offset overflows [4294967293, 4294967299]}} |
| 139 |
[RootSignature(AppendOffsetOverflow)] |
| 140 |
void append_offset_overflow_signature() {} |
| 141 |
|
| 142 |
// expected-error@+1 {{descriptor range offset overflows [4294967292, 4294967296]}} |
| 143 |
[RootSignature("DescriptorTable(CBV(b0, offset = 4294967292, numDescriptors = 5))")] |
| 144 |
void offset_overflow() {} |
| 145 |
|
| 146 |
// expected-error@+1 {{descriptor range offset overflows [4294967295, 4294967296]}} |
| 147 |
[RootSignature("DescriptorTable(CBV(b0, offset = 4294967294), CBV(b1, numDescriptors = 2))")] |
| 148 |
void appended_offset_overflow() {} |
| 149 |
|
| 150 |
// expected-error@+1 {{descriptor range offset overflows [4294967296, 4294967296]}} |
| 151 |
[RootSignature("DescriptorTable(CBV(b0, offset = 4294967294), CBV(b1), CBV(b2))")] |
| 152 |
void multiple_appended_offset_overflow() {} |