@@ -29,31 +29,36 @@ bool RootSignatureParser::parse() {
29
29
// end of the stream
30
30
while (!peekExpectedToken (TokenKind::end_of_stream)) {
31
31
if (tryConsumeExpectedToken (TokenKind::kw_RootFlags)) {
32
+ SourceLocation ElementLoc = getTokenLocation (CurToken);
32
33
auto Flags = parseRootFlags ();
33
34
if (!Flags.has_value ())
34
35
return true ;
35
- Elements.emplace_back (RootSignatureElement (*Flags));
36
+ Elements.emplace_back (RootSignatureElement (ElementLoc, *Flags));
36
37
} else if (tryConsumeExpectedToken (TokenKind::kw_RootConstants)) {
38
+ SourceLocation ElementLoc = getTokenLocation (CurToken);
37
39
auto Constants = parseRootConstants ();
38
40
if (!Constants.has_value ())
39
41
return true ;
40
- Elements.emplace_back (RootSignatureElement (*Constants));
42
+ Elements.emplace_back (RootSignatureElement (ElementLoc, *Constants));
41
43
} else if (tryConsumeExpectedToken (TokenKind::kw_DescriptorTable)) {
44
+ SourceLocation ElementLoc = getTokenLocation (CurToken);
42
45
auto Table = parseDescriptorTable ();
43
46
if (!Table.has_value ())
44
47
return true ;
45
- Elements.emplace_back (RootSignatureElement (*Table));
48
+ Elements.emplace_back (RootSignatureElement (ElementLoc, *Table));
46
49
} else if (tryConsumeExpectedToken (
47
50
{TokenKind::kw_CBV, TokenKind::kw_SRV, TokenKind::kw_UAV})) {
51
+ SourceLocation ElementLoc = getTokenLocation (CurToken);
48
52
auto Descriptor = parseRootDescriptor ();
49
53
if (!Descriptor.has_value ())
50
54
return true ;
51
- Elements.emplace_back (RootSignatureElement (*Descriptor));
55
+ Elements.emplace_back (RootSignatureElement (ElementLoc, *Descriptor));
52
56
} else if (tryConsumeExpectedToken (TokenKind::kw_StaticSampler)) {
57
+ SourceLocation ElementLoc = getTokenLocation (CurToken);
53
58
auto Sampler = parseStaticSampler ();
54
59
if (!Sampler.has_value ())
55
60
return true ;
56
- Elements.emplace_back (RootSignatureElement (*Sampler));
61
+ Elements.emplace_back (RootSignatureElement (ElementLoc, *Sampler));
57
62
}
58
63
59
64
// ',' denotes another element, otherwise, expected to be at end of stream
@@ -245,10 +250,11 @@ std::optional<DescriptorTable> RootSignatureParser::parseDescriptorTable() {
245
250
if (tryConsumeExpectedToken ({TokenKind::kw_CBV, TokenKind::kw_SRV,
246
251
TokenKind::kw_UAV, TokenKind::kw_Sampler})) {
247
252
// DescriptorTableClause - CBV, SRV, UAV, or Sampler
253
+ SourceLocation ElementLoc = getTokenLocation (CurToken);
248
254
auto Clause = parseDescriptorTableClause ();
249
255
if (!Clause.has_value ())
250
256
return std::nullopt;
251
- Elements.push_back (RootSignatureElement (*Clause));
257
+ Elements.push_back (RootSignatureElement (ElementLoc, *Clause));
252
258
Table.NumClauses ++;
253
259
} else if (tryConsumeExpectedToken (TokenKind::kw_visibility)) {
254
260
// visibility = SHADER_VISIBILITY
0 commit comments