1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -fsyntax-only %s -verify
// RUN: not %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -fsyntax-only %s 2>&1 | FileCheck %s
// Attr test
[RootSignature()] // expected-error {{expected string literal as argument of 'RootSignature' attribute}}
void bad_root_signature_0() {}
// expected-error@+2 {{expected ')'}}
// expected-note@+1 {{to match this '('}}
[RootSignature("", "")]
void bad_root_signature_1() {}
[RootSignature(""), RootSignature("DescriptorTable()")] // expected-error {{attribute 'RootSignature' cannot appear more than once on a declaration}}
void bad_root_signature_2() {}
[RootSignature(""), RootSignature("")] // expected-warning {{attribute 'RootSignature' is already applied}}
void bad_root_signature_3() {}
// expected-error@+1 {{invalid parameter of RootSignature}}
[RootSignature("DescriptorTable(), invalid")]
void bad_root_signature_4() {}
// expected-error@+1 {{expected ')' or ','}}
[RootSignature("RootConstants(b0 num32BitConstants = 1)")]
void bad_root_signature_5() {}
#define MultiLineRootSignature \
"CBV(b0)," \
"RootConstants(num32BitConstants = 3, b0, invalid)"
// CHECK: [[@LINE-2]]:44: note: expanded from macro 'MultiLineRootSignature'
// CHECK-NEXT: [[@LINE-3]] | "RootConstants(num32BitConstants = 3, b0, invalid)"
// CHECK-NEXT: | ^
// expected-error@+1 {{invalid parameter of RootConstants}}
[RootSignature(MultiLineRootSignature)]
void bad_root_signature_6() {}
// expected-error@+1 {{expected end of stream or ','}}
[RootSignature("RootFlags() RootConstants(b0, num32BitConstants = 1)")]
void bad_root_signature_7() {}
// expected-error@+1 {{invalid parameter of RootConstants}}
[RootSignature("RootConstants(b0, num32BitConstantsTypo = 1))")]
void bad_root_signature_8() {}
// expected-error@+1 {{invalid parameter of UAV}}
[RootSignature("UAV(b3")]
void bad_root_signature_9() {}
// expected-error@+1 {{invalid parameter of SRV}}
[RootSignature("DescriptorTable(SRV(s1, invalid))")]
void bad_root_signature_10() {}
// expected-error@+1 {{invalid parameter of DescriptorTable}}
[RootSignature("DescriptorTable(invalid))")]
void bad_root_signature_11() {}
// expected-error@+1 {{expected integer literal after '+'}}
[RootSignature("CBV(space = +invalid))")]
void bad_root_signature_12() {}
// expected-error@+1 {{expected integer literal after '='}}
[RootSignature("CBV(space = invalid))")]
void bad_root_signature_13() {}
// expected-error@+1 {{expected '(' after UAV}}
[RootSignature("UAV invalid")]
void bad_root_signature_14() {}
// expected-error@+1 {{invalid value of visibility}}
[RootSignature("StaticSampler(s0, visibility = visibility_typo)")]
void bad_root_signature_15() {}
// expected-error@+1 {{invalid value of filter}}
[RootSignature("StaticSampler(s0, filter = filter_typo)")]
void bad_root_signature_16() {}
// expected-error@+1 {{invalid value of addressU}}
[RootSignature("StaticSampler(s0, addressU = addressU_typo)")]
void bad_root_signature_17() {}
// expected-error@+1 {{invalid value of addressV}}
[RootSignature("StaticSampler(s0, addressV = addressV_typo)")]
void bad_root_signature_18() {}
// expected-error@+1 {{invalid value of comparisonFunc}}
[RootSignature("StaticSampler(s0, comparisonFunc = comparisonFunc_typo)")]
void bad_root_signature_19() {}
// expected-error@+1 {{invalid value of borderColor}}
[RootSignature("StaticSampler(s0, borderColor = borderColor_typo)")]
void bad_root_signature_20() {}
// expected-error@+1 {{invalid value of flags}}
[RootSignature("CBV(b0, flags = DATA_VOLATILE | root_descriptor_flag_typo)")]
void bad_root_signature_21() {}
// expected-error@+1 {{invalid value of flags}}
[RootSignature("DescriptorTable(SRV(t0, flags = descriptor_range_flag_typo)")]
void bad_root_signature_22() {}
// expected-error@+1 {{invalid value of RootFlags}}
[RootSignature("RootFlags(local_root_signature | root_flag_typo)")]
void bad_root_signature_23() {}
#define DemoMultipleErrorsRootSignature \
"CBV(b0, space = invalid)," \
"StaticSampler()" \
"DescriptorTable(" \
" visibility = SHADER_VISIBILITY_ALL," \
" visibility = SHADER_VISIBILITY_DOMAIN," \
")," \
"SRV(t0, space = 28947298374912374098172)" \
"UAV(u0, flags = 3)" \
"DescriptorTable(Sampler(s0 flags = DATA_VOLATILE))," \
"CBV(b0),,"
// expected-error@+7 {{expected integer literal after '='}}
// expected-error@+6 {{did not specify mandatory parameter 's register'}}
// expected-error@+5 {{specified the same parameter 'visibility' multiple times}}
// expected-error@+4 {{integer literal is too large to be represented as a 32-bit signed integer type}}
// expected-error@+3 {{flag value is neither a literal 0 nor a named value}}
// expected-error@+2 {{expected ')' or ','}}
// expected-error@+1 {{invalid parameter of RootSignature}}
[RootSignature(DemoMultipleErrorsRootSignature)]
void multiple_errors() {}
#define DemoGranularityRootSignature \
"CBV(b0, reported_diag, flags = skipped_diag)," \
"DescriptorTable( " \
" UAV(u0, reported_diag), " \
" SRV(t0, skipped_diag), " \
")," \
"StaticSampler(s0, reported_diag, SRV(t0, reported_diag)" \
""
// expected-error@+4 {{invalid parameter of CBV}}
// expected-error@+3 {{invalid parameter of UAV}}
// expected-error@+2 {{invalid parameter of StaticSampler}}
// expected-error@+1 {{invalid parameter of SRV}}
[RootSignature(DemoGranularityRootSignature)]
void granularity_errors() {}
#define TestTableScope \
"DescriptorTable( " \
" UAV(u0, reported_diag), " \
" SRV(t0, skipped_diag), " \
" Sampler(s0, skipped_diag), " \
")," \
"CBV(s0, reported_diag)"
// expected-error@+2 {{invalid parameter of UAV}}
// expected-error@+1 {{invalid parameter of CBV}}
[RootSignature(TestTableScope)]
void recover_scope_errors() {}
// Basic validation of register value and space
// expected-error@+2 {{value must be in the range [0, 4294967294]}}
// expected-error@+1 {{value must be in the range [0, 4294967279]}}
[RootSignature("CBV(b4294967295, space = 4294967280)")]
void basic_validation_0() {}
// expected-error@+2 {{value must be in the range [0, 4294967294]}}
// expected-error@+1 {{value must be in the range [0, 4294967279]}}
[RootSignature("RootConstants(b4294967295, space = 4294967280, num32BitConstants = 1)")]
void basic_validation_1() {}
// expected-error@+2 {{value must be in the range [0, 4294967294]}}
// expected-error@+1 {{value must be in the range [0, 4294967279]}}
[RootSignature("StaticSampler(s4294967295, space = 4294967280)")]
void basic_validation_2() {}
// expected-error@+2 {{value must be in the range [0, 4294967294]}}
// expected-error@+1 {{value must be in the range [0, 4294967279]}}
[RootSignature("DescriptorTable(SRV(t4294967295, space = 4294967280))")]
void basic_validation_3() {}
// expected-error@+2 {{value must be in the range [1, 4294967294]}}
// expected-error@+1 {{value must be in the range [1, 4294967294]}}
[RootSignature("DescriptorTable(UAV(u0, numDescriptors = 0), Sampler(s0, numDescriptors = 0))")]
void basic_validation_4() {}
// expected-error@+2 {{value must be in the range [0, 16]}}
// expected-error@+1 {{value must be in the range [-16.00, 15.99]}}
[RootSignature("StaticSampler(s0, maxAnisotropy = 17, mipLODBias = -16.000001)")]
void basic_validation_5() {}
// expected-error@+1 {{value must be in the range [-16.00, 15.99]}}
[RootSignature("StaticSampler(s0, mipLODBias = 15.990001)")]
void basic_validation_6() {}
|