forked from KhronosGroup/Vulkan-Hpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VulkanHppGenerator.hpp
792 lines (749 loc) · 52.6 KB
/
VulkanHppGenerator.hpp
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
// Copyright(c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <iostream>
#include <map>
#include <set>
#include <tinyxml2.h>
#include <vector>
class VulkanHppGenerator
{
public:
VulkanHppGenerator( tinyxml2::XMLDocument const & document );
void appendBaseTypes( std::string & str ) const;
void appendBitmasks( std::string & str ) const;
void appendDispatchLoaderDynamic( std::string & str ); // use vkGet*ProcAddress to get function pointers
void appendDispatchLoaderStatic( std::string & str ); // use exported symbols from loader
void appendDispatchLoaderDefault(
std::string & str ); // typedef to DispatchLoaderStatic or undefined type, based on VK_NO_PROTOTYPES
void appendEnums( std::string & str ) const;
void appendHandles( std::string & str );
void appendHandlesCommandDefinitions( std::string & str ) const;
void appendHashStructures( std::string & str ) const;
void appendResultExceptions( std::string & str ) const;
void appendStructs( std::string & str );
void appendStructureChainValidation( std::string & str );
void appendThrowExceptions( std::string & str ) const;
void appendIndexTypeTraits( std::string & str ) const;
std::string const & getTypesafeCheck() const;
std::string const & getVersion() const;
std::string const & getVulkanLicenseHeader() const;
private:
struct BaseTypeData
{
BaseTypeData( std::string const & type_, int line ) : type( type_ ), xmlLine( line ) {}
std::string type;
int xmlLine;
};
struct BitmaskData
{
BitmaskData( std::string const & r, std::string const & t, int line )
: requirements( r ), type( t ), xmlLine( line )
{}
std::string requirements;
std::string type;
std::string alias;
int xmlLine;
};
struct NameData
{
std::string name;
std::vector<std::string> arraySizes;
std::string bitCount;
};
struct TypeInfo
{
std::string compose( bool inNamespace = true ) const;
bool operator==( TypeInfo const & rhs ) const
{
return ( prefix == rhs.prefix ) && ( type == rhs.type ) && ( postfix == rhs.postfix );
}
bool isConstPointer() const
{
return ( prefix.find( "const" ) != std::string::npos ) && ( postfix.find( '*' ) != std::string::npos );
}
bool isNonConstPointer() const
{
return ( prefix.find( "const" ) == std::string::npos ) && ( postfix.find( '*' ) != std::string::npos );
}
bool isValue() const
{
return ( ( prefix.find( '*' ) == std::string::npos ) && ( postfix.find( '*' ) == std::string::npos ) );
}
std::string prefix;
std::string type;
std::string postfix;
};
struct ParamData
{
ParamData( int line ) : optional( false ), xmlLine( line ) {}
TypeInfo type;
std::string name;
std::vector<std::string> arraySizes;
std::string len;
bool optional;
int xmlLine;
};
struct CommandAliasData
{
CommandAliasData( int line ) : xmlLine( line ) {}
std::set<std::string> extensions;
std::string feature;
int xmlLine;
};
struct CommandData
{
CommandData( int line ) : xmlLine( line ) {}
std::map<std::string, CommandAliasData> aliasData;
std::vector<std::string> errorCodes;
std::set<std::string> extensions;
std::string feature;
std::string handle;
std::vector<ParamData> params;
std::string returnType;
std::vector<std::string> successCodes;
int xmlLine;
};
struct EnumValueData
{
EnumValueData( int line, std::string const & vulkan, std::string const & vk, bool singleBit_ )
: vulkanValue( vulkan ), vkValue( vk ), singleBit( singleBit_ ), xmlLine( line )
{}
std::string vulkanValue;
std::string vkValue;
bool singleBit;
int xmlLine;
};
struct EnumData
{
void addEnumAlias( int line, std::string const & name, std::string const & alias, std::string const & vkName );
void addEnumValue( int line,
std::string const & valueName,
bool bitmask,
bool bitpos,
std::string const & prefix,
std::string const & postfix,
std::string const & tag );
std::string alias; // alias for this enum
std::map<std::string, std::pair<std::string, std::string>> aliases; // map from name to alias and vk-name
bool isBitmask = false;
std::vector<EnumValueData> values;
};
struct ExtensionData
{
ExtensionData( int line,
std::string const & deprecatedBy_,
std::string const & obsoletedBy_,
std::string const & platform_,
std::string const & promotedTo_ )
: deprecatedBy( deprecatedBy_ )
, obsoletedBy( obsoletedBy_ )
, platform( platform_ )
, promotedTo( promotedTo_ )
, xmlLine( line )
{}
std::string deprecatedBy;
std::string obsoletedBy;
std::string platform;
std::string promotedTo;
std::map<std::string, int> requirements;
int xmlLine;
};
struct FuncPointerData
{
FuncPointerData( std::string const & r, int line ) : requirements( r ), xmlLine( line ) {}
std::string requirements;
int xmlLine;
};
struct HandleData
{
HandleData( std::vector<std::string> const & p, std::string const & objType, int line )
: objTypeEnum( objType ), parents( p ), xmlLine( line )
{}
std::string alias;
std::set<std::string> childrenHandles;
std::set<std::string> commands;
std::string deleteCommand;
std::string deletePool;
std::string objTypeEnum;
std::vector<std::string> parents;
int xmlLine;
};
struct MemberData
{
MemberData( int line ) : xmlLine( line ) {}
TypeInfo type;
std::string name;
std::vector<std::string> arraySizes;
std::string bitCount;
std::vector<std::string> len;
bool noAutoValidity = false;
std::vector<bool> optional;
std::string selection;
std::string selector;
std::vector<std::string> values;
std::string usedConstant;
int xmlLine;
};
struct PlatformData
{
PlatformData( std::string const & protect_ ) : protect( protect_ ) {}
std::string protect;
};
struct StructureData
{
StructureData( std::vector<std::string> const & extends, int line ) : structExtends( extends ), xmlLine( line ) {}
bool allowDuplicate = false;
bool isUnion = false;
bool returnedOnly = false;
bool mutualExclusiveLens = false;
std::vector<MemberData> members;
std::vector<std::string> structExtends;
std::set<std::string> aliases;
std::string subStruct;
int xmlLine;
};
enum class TypeCategory
{
Bitmask,
BaseType,
Define,
Enum,
FuncPointer,
Handle,
Requires,
Struct,
Union,
Unknown
};
struct TypeData
{
TypeData( TypeCategory category_ ) : category( category_ ) {}
TypeCategory category;
std::set<std::string> extensions;
std::string feature;
};
private:
void appendArgumentPlainType( std::string & str, ParamData const & paramData ) const;
void appendArguments( std::string & str,
CommandData const & commandData,
size_t returnParamIndex,
size_t templateParamIndex,
std::map<size_t, size_t> const & vectorParamIndices,
bool twoStep,
bool firstCall,
size_t from,
size_t to ) const;
void appendArgumentVector( std::string & str,
size_t paramIndex,
ParamData const & paramData,
size_t returnParamIndex,
size_t templateParamIndex,
bool twoStep,
bool firstCall ) const;
void appendBitmask( std::string & os,
std::string const & bitmaskName,
std::string const & bitmaskType,
std::string const & bitmaskAlias,
std::string const & enumName,
std::vector<EnumValueData> const & enumValues ) const;
void appendBitmaskToStringFunction( std::string & str,
std::string const & flagsName,
std::string const & enumName,
std::vector<EnumValueData> const & enumValues ) const;
void appendCall( std::string & str,
std::string const & name,
CommandData const & commandData,
size_t returnParamIndex,
size_t templateParamIndex,
std::map<size_t, size_t> const & vectorParamIndices,
bool twoStep,
bool firstCall ) const;
void appendCommand( std::string & str,
std::string const & name,
CommandData const & commandData,
bool definition ) const;
void appendCommandChained( std::string & str,
std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
size_t nonConstPointerIndex ) const;
void appendCommandSingular( std::string & str,
std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex ) const;
void appendCommandStandard( std::string & str,
std::string const & name,
CommandData const & commandData,
bool definition ) const;
void appendCommandStandardAndEnhanced( std::string & str,
std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices ) const;
void
appendCommandStandardEnhancedDeprecatedAllocator( std::string & str,
std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & nonConstPointerParamIndices ) const;
void appendCommandStandardOrEnhanced( std::string & str,
std::string const & name,
CommandData const & commandData,
bool definition ) const;
void appendCommandUnique( std::string & str,
std::string const & name,
CommandData const & commandData,
size_t nonConstPointerIndex,
bool definition ) const;
void appendCommandVector( std::string & str,
std::string const & name,
CommandData const & commandData,
bool definition,
std::pair<size_t, size_t> const & vectorParamIndex,
std::vector<size_t> const & returnParamIndices ) const;
void appendCommandVectorChained( std::string & str,
std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & returnParamIndices ) const;
void appendCommandVectorDeprecated( std::string & str,
std::string const & name,
CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & returnParamIndices,
bool definition ) const;
void appendCommandVectorSingularUnique( std::string & str,
std::string const & name,
CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition ) const;
void appendCommandVectorUnique( std::string & str,
std::string const & name,
CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool definition ) const;
void appendDispatchLoaderDynamicCommand( std::string & str,
std::string & emptyFunctions,
std::string & deviceFunctions,
std::string & deviceFunctionsInstance,
std::string & instanceFunctions,
std::string const & commandName,
CommandData const & commandData );
void appendEnum( std::string & str, std::pair<std::string, EnumData> const & enumData ) const;
void appendEnumInitializer( std::string & str,
TypeInfo const & type,
std::vector<std::string> const & arraySizes,
std::vector<EnumValueData> const & values ) const;
void appendEnumToString( std::string & str, std::pair<std::string, EnumData> const & enumData ) const;
std::string appendFunctionBodyEnhancedLocalReturnVariable( std::string & str,
std::string const & indentation,
CommandData const & commandData,
size_t returnParamIndex,
std::string const & enhancedReturnType,
bool withAllocator ) const;
void appendFunctionBodyEnhancedMultiVectorSizeCheck( std::string & str,
std::string const & indentation,
std::string const & name,
CommandData const & commandData,
size_t returnParamIndex,
std::map<size_t, size_t> const & vectorParamIndices ) const;
void appendFunctionBodyEnhancedReturnResultValue( std::string & str,
std::string const & indentation,
std::string const & returnName,
std::string const & name,
CommandData const & commandData,
size_t returnParamIndex,
bool twoStep ) const;
void appendFunctionBodyEnhancedTwoStep( std::string & str,
std::string const & indentation,
std::string const & name,
CommandData const & commandData,
size_t returnParamIndex,
size_t templateParamIndex,
std::map<size_t, size_t> const & vectorParamIndices,
std::string const & returnName ) const;
bool appendFunctionHeaderArgumentEnhanced( std::string & str,
ParamData const & param,
size_t paramIndex,
std::map<size_t, size_t> const & vectorParamIndices,
bool skip,
bool argEncountered,
bool isTemplateParam ) const;
void appendFunctionHeaderArgumentEnhancedVector( std::string & str,
ParamData const & param,
std::string const & strippedParameterName,
bool hasSizeParam,
bool isTemplateParam ) const;
void appendHandle( std::string & str, std::pair<std::string, HandleData> const & handle );
void appendStruct( std::string & str, std::pair<std::string, StructureData> const & structure );
void appendStructAssignmentOperators( std::string & str,
std::pair<std::string, StructureData> const & structure,
std::string const & prefix ) const;
void appendStructCompareOperators( std::string & str, std::pair<std::string, StructureData> const & structure ) const;
void appendStructConstructors( std::string & str,
std::pair<std::string, StructureData> const & structData,
std::string const & prefix ) const;
void appendStructConstructorsEnhanced( std::string & str,
std::pair<std::string, StructureData> const & structData,
std::string const & prefix ) const;
bool appendStructConstructorArgument( std::string & str,
bool listedArgument,
MemberData const & memberData,
bool withDefault ) const;
std::string appendStructMembers( std::string & str,
std::pair<std::string, StructureData> const & structData,
std::string const & prefix ) const;
void appendStructSetter( std::string & str,
std::string const & structureName,
std::vector<MemberData> const & memberData,
size_t index ) const;
void appendStructSubConstructor( std::string & str,
std::pair<std::string, StructureData> const & structData,
std::string const & prefix ) const;
void appendStructure( std::string & str, std::pair<std::string, StructureData> const & structure ) const;
void appendType( std::string & str, std::string const & typeName );
void appendUnion( std::string & str, std::pair<std::string, StructureData> const & structure ) const;
void appendUniqueTypes( std::string & str,
std::string const & parentType,
std::set<std::string> const & childrenTypes ) const;
std::string constructArgumentListEnhanced( std::vector<ParamData> const & params,
std::set<size_t> const & skippedParams,
size_t singularParam,
bool definition,
bool withAllocators,
bool structureChain ) const;
std::string constructArgumentListStandard( std::vector<ParamData> const & params,
std::set<size_t> const & skippedParams ) const;
std::string constructCallArgumentsEnhanced( std::string const & handle,
std::vector<ParamData> const & params,
bool nonConstPointerAsNullptr,
size_t singularParamIndex ) const;
std::string constructCallArgumentsStandard( std::string const & handle, std::vector<ParamData> const & params ) const;
std::string constructCommandResult( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices ) const;
std::string constructCommandResultEnumerate( std::string const & name,
CommandData const & commandData,
bool definition,
std::pair<size_t, size_t> const & vectorParamIndices,
bool withAllocators ) const;
std::string constructCommandResultEnumerateChained( std::string const & name,
CommandData const & commandData,
bool definition,
std::pair<size_t, size_t> const & vectorParamIndex,
std::vector<size_t> const & returnParamIndices,
bool withAllocator ) const;
std::string constructCommandResultEnumerateTwoVectors( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & returnParamIndices,
bool withAllocators ) const;
std::string constructCommandResultEnumerateTwoVectorsDeprecated( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
bool withAllocators ) const;
std::string constructCommandResultGetChain( std::string const & name,
CommandData const & commandData,
bool definition,
size_t nonConstPointerIndex ) const;
std::string constructCommandResultGetHandleUnique( std::string const & name,
CommandData const & commandData,
bool definition,
size_t nonConstPointerIndex ) const;
std::string constructCommandResultGetTwoVectors( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices ) const;
std::string constructCommandResultGetValue( std::string const & name,
CommandData const & commandData,
bool definition,
size_t nonConstPointerIndex ) const;
std::string constructCommandResultGetValueDeprecated( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex ) const;
std::string constructCommandResultGetVector( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex ) const;
std::string constructCommandResultGetVectorAndValue( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & returnParamIndex,
bool withAllocator ) const;
std::string constructCommandResultGetVectorDeprecated( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex ) const;
std::string constructCommandResultGetVectorOfHandles( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool withAllocator ) const;
std::string constructCommandResultGetVectorOfHandlesSingular( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex ) const;
std::string constructCommandResultGetVectorOfHandlesUnique( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex,
bool withAllocator ) const;
std::string
constructCommandResultGetVectorOfHandlesUniqueSingular( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex ) const;
std::string constructCommandResultGetVectorSingular( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex ) const;
std::string
constructCommandStandard( std::string const & name, CommandData const & commandData, bool definition ) const;
std::string constructCommandType( std::string const & name, CommandData const & commandData, bool definition ) const;
std::string constructCommandVoid( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices ) const;
std::string constructCommandVoidEnumerate( std::string const & name,
CommandData const & commandData,
bool definition,
std::pair<size_t, size_t> const & vectorParamIndex,
std::vector<size_t> const & returnParamIndices,
bool withAllocators ) const;
std::string constructCommandVoidEnumerateChained( std::string const & name,
CommandData const & commandData,
bool definition,
std::pair<size_t, size_t> const & vectorParamIndex,
std::vector<size_t> const & returnParamIndices,
bool withAllocators ) const;
std::string constructCommandVoidGetChain( std::string const & name,
CommandData const & commandData,
bool definition,
size_t nonConstPointerIndex ) const;
std::string constructCommandVoidGetValue( std::string const & name,
CommandData const & commandData,
bool definition,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex ) const;
std::string constructConstexprString( std::pair<std::string, StructureData> const & structData ) const;
std::string constructFunctionBodyEnhanced( std::string const & indentation,
std::string const & name,
CommandData const & commandData,
size_t returnParamIndex,
size_t templateParamIndex,
std::map<size_t, size_t> const & vectorParamIndices,
bool twoStep,
std::string const & enhancedReturnType,
bool withAllocator ) const;
std::string constructFunctionBodyEnhancedSingleStep( std::string const & indentation,
std::string const & name,
CommandData const & commandData,
size_t returnParamIndex,
size_t templateParamIndex,
std::map<size_t, size_t> const & vectorParamIndices ) const;
std::string constructFunctionHeaderArgumentsEnhanced( CommandData const & commandData,
size_t returnParamIndex,
size_t templateParamIndex,
std::map<size_t, size_t> const & vectorParamIndices,
bool withDefaults,
bool withAllocator ) const;
std::string constructNoDiscardStandard( CommandData const & commandData ) const;
std::string constructReturnType( CommandData const & commandData, std::string const & baseType ) const;
std::string constructSuccessCheck( std::vector<std::string> const & successCodes ) const;
std::string constructSuccessCodeList( std::vector<std::string> const & successCodes ) const;
std::string constructVectorSizeCheck( std::string const & name,
CommandData const & commandData,
std::map<size_t, std::vector<size_t>> const & countToVectorMap,
std::set<size_t> const & skippedParams ) const;
void checkCorrectness();
bool containsArray( std::string const & type ) const;
bool containsUnion( std::string const & type ) const;
size_t determineDefaultStartIndex( std::vector<ParamData> const & params,
std::set<size_t> const & skippedParams ) const;
std::string determineEnhancedReturnType( CommandData const & commandData,
size_t returnParamIndex,
bool isStructureChain ) const;
size_t determineReturnParamIndex( CommandData const & commandData,
std::map<size_t, size_t> const & vectorParamIndices,
bool twoStep ) const;
std::set<size_t> determineSkippedParams( std::string const & handleType,
std::vector<ParamData> const & params,
std::map<size_t, size_t> const & vectorParamIndices,
std::vector<size_t> const & returnParamIndex,
bool singular ) const;
std::string determineSubStruct( std::pair<std::string, StructureData> const & structure ) const;
std::vector<size_t> determineConstPointerParamIndices( std::vector<ParamData> const & params ) const;
std::vector<size_t> determineNonConstPointerParamIndices( std::vector<ParamData> const & params ) const;
std::map<size_t, size_t> determineVectorParamIndicesNew( std::vector<ParamData> const & params ) const;
std::string
generateLenInitializer( std::vector<MemberData>::const_iterator mit,
std::map<std::vector<MemberData>::const_iterator,
std::vector<std::vector<MemberData>::const_iterator>>::const_iterator litit,
bool mutualExclusiveLens ) const;
std::pair<std::string, std::string> generateProtection( std::string const & feature,
std::set<std::string> const & extension ) const;
std::pair<std::string, std::string> generateProtection( std::string const & type, bool isAliased ) const;
std::string generateSizeCheck( std::vector<std::vector<MemberData>::const_iterator> const & arrayIts,
std::string const & structName,
std::string const & prefix,
bool mutualExclusiveLens ) const;
std::set<std::string> getPlatforms( std::set<std::string> const & extensions ) const;
std::pair<std::string, std::string> getPoolTypeAndName( std::string const & type ) const;
std::string getVectorSize( std::vector<ParamData> const & params,
std::map<size_t, size_t> const & vectorParamIndices,
size_t returnParamIndex ) const;
bool isHandleType( std::string const & type ) const;
bool isLenByStructMember( std::string const & name, std::vector<ParamData> const & params ) const;
bool isLenByStructMember( std::string const & name, ParamData const & param ) const;
bool isParam( std::string const & name, std::vector<ParamData> const & params ) const;
bool isStructureChainAnchor( std::string const & type ) const;
bool needsComplexBody( CommandData const & commandData ) const;
std::pair<bool, std::map<size_t, std::vector<size_t>>>
needsVectorSizeCheck( std::map<size_t, size_t> const & vectorParamIndices ) const;
void readBaseType( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readBitmask( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readBitmaskAlias( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readCommand( tinyxml2::XMLElement const * element );
void readCommand( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributess );
void readCommandAlias( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
ParamData readCommandParam( tinyxml2::XMLElement const * element, std::vector<ParamData> const & params );
std::pair<std::string, std::string> readCommandProto( tinyxml2::XMLElement const * element );
void readCommands( tinyxml2::XMLElement const * element );
std::string readComment( tinyxml2::XMLElement const * element );
void readDefine( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readEnum( tinyxml2::XMLElement const * element,
EnumData & enumData,
bool bitmask,
std::string const & prefix,
std::string const & postfix );
void readEnum( tinyxml2::XMLElement const * element,
std::map<std::string, std::string> const & attributes,
EnumData & enumData,
bool bitmask,
std::string const & prefix,
std::string const & postfix );
void readEnumAlias( tinyxml2::XMLElement const * element,
std::map<std::string, std::string> const & attributes,
EnumData & enumData,
bool bitmask,
std::string const & prefix,
std::string const & postfix );
void readEnumConstant( tinyxml2::XMLElement const * element );
void readEnums( tinyxml2::XMLElement const * element );
void readExtension( tinyxml2::XMLElement const * element );
void readExtensionDisabledCommand( tinyxml2::XMLElement const * element );
void readExtensionDisabledEnum( std::string const & extensionName, tinyxml2::XMLElement const * element );
void readExtensionDisabledRequire( std::string const & extensionName, tinyxml2::XMLElement const * element );
void readExtensionDisabledType( tinyxml2::XMLElement const * element );
void readExtensionRequire( tinyxml2::XMLElement const * element,
std::string const & extension,
std::string const & tag,
std::map<std::string, int> & requirements );
void readExtensionRequireCommand( tinyxml2::XMLElement const * element, std::string const & extension );
void readExtensionRequireType( tinyxml2::XMLElement const * element, std::string const & extension );
void readExtensions( tinyxml2::XMLElement const * element );
void readFeature( tinyxml2::XMLElement const * element );
void readFeatureRequire( tinyxml2::XMLElement const * element, std::string const & feature );
void readFeatureRequireCommand( tinyxml2::XMLElement const * element, std::string const & feature );
void readFeatureRequireType( tinyxml2::XMLElement const * element, std::string const & feature );
void readFuncpointer( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readHandle( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
std::pair<NameData, TypeInfo> readNameAndType( tinyxml2::XMLElement const * elements );
void readPlatform( tinyxml2::XMLElement const * element );
void readPlatforms( tinyxml2::XMLElement const * element );
void readRegistry( tinyxml2::XMLElement const * element );
void readRequireEnum( tinyxml2::XMLElement const * element, std::string const & tag );
void readRequireEnum( tinyxml2::XMLElement const * element,
std::map<std::string, std::string> const & attributes,
std::string const & tag );
void readRequireEnumAlias( tinyxml2::XMLElement const * element,
std::map<std::string, std::string> const & attributes,
std::string const & tag );
void readRequires( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readSPIRVCapability( tinyxml2::XMLElement const * element );
void readSPIRVCapabilityEnable( tinyxml2::XMLElement const * element );
void readSPIRVCapabilityEnableExtension( int xmlLine, std::map<std::string, std::string> const & attributes );
void readSPIRVCapabilityEnableProperty( int xmlLine, std::map<std::string, std::string> const & attributes );
void readSPIRVCapabilityEnableStruct( int xmlLine, std::map<std::string, std::string> const & attributes );
void readSPIRVCapabilityEnableVersion( int xmlLine, std::map<std::string, std::string> const & attributes );
void readSPIRVCapabilities( tinyxml2::XMLElement const * element );
void readSPIRVExtension( tinyxml2::XMLElement const * element );
void readSPIRVExtensionEnable( tinyxml2::XMLElement const * element );
void readSPIRVExtensions( tinyxml2::XMLElement const * element );
void readStruct( tinyxml2::XMLElement const * element,
bool isUnion,
std::map<std::string, std::string> const & attributes );
void readStructAlias( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readStructMember( tinyxml2::XMLElement const * element, std::vector<MemberData> & members, bool isUnion );
void readStructMemberEnum( tinyxml2::XMLElement const * element, MemberData & memberData );
void readStructMemberName( tinyxml2::XMLElement const * element,
MemberData & memberData,
std::vector<MemberData> const & members );
void readStructMemberType( tinyxml2::XMLElement const * element, MemberData & memberData );
void readTag( tinyxml2::XMLElement const * element );
void readTags( tinyxml2::XMLElement const * element );
void readType( tinyxml2::XMLElement const * element );
void readTypeEnum( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypeInclude( tinyxml2::XMLElement const * element, std::map<std::string, std::string> const & attributes );
void readTypes( tinyxml2::XMLElement const * element );
void registerDeleter( std::string const & name, std::pair<std::string, CommandData> const & commandData );
void setVulkanLicenseHeader( int line, std::string const & comment );
std::string toString( TypeCategory category );
private:
std::map<std::string, BaseTypeData> m_baseTypes;
std::map<std::string, BitmaskData> m_bitmasks;
std::map<std::string, CommandData> m_commands;
std::set<std::string> m_constants;
std::set<std::string> m_defines;
std::map<std::string, EnumData> m_enums;
std::set<std::string> m_extendedStructs; // structs which are referenced by the structextends tag
std::map<std::string, ExtensionData> m_extensions;
std::map<std::string, std::string> m_features;
std::map<std::string, FuncPointerData> m_funcPointers;
std::map<std::string, HandleData> m_handles;
std::set<std::string> m_includes;
std::set<std::string> m_listedTypes;
std::set<std::string> m_listingTypes;
std::map<std::string, PlatformData> m_platforms;
std::map<std::string, std::string> m_structureAliases;
std::map<std::string, StructureData> m_structures;
std::set<std::string> m_tags;
std::map<std::string, TypeData> m_types;
std::string m_typesafeCheck;
std::string m_version;
std::string m_vulkanLicenseHeader;
};
const size_t INVALID_INDEX = (size_t)~0;