forked from KhronosGroup/Vulkan-Hpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VulkanHppGenerator.hpp
1183 lines (1121 loc) · 83.3 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
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// 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 "XMLHelper.hpp"
#include <iostream>
#include <map>
#include <set>
#include <tinyxml2.h>
#include <vector>
constexpr size_t INVALID_INDEX = static_cast<size_t>( ~0 );
template <typename BitType>
class Flags
{
public:
using MaskType = typename std::underlying_type<BitType>::type;
constexpr Flags() noexcept : m_mask( 0 ) {}
constexpr Flags( BitType bit ) noexcept : m_mask( static_cast<MaskType>( bit ) ) {}
constexpr explicit Flags( MaskType flags ) noexcept : m_mask( flags ) {}
constexpr Flags<BitType> & operator|=( Flags<BitType> const & rhs ) noexcept
{
m_mask |= rhs.m_mask;
return *this;
}
constexpr bool operator!() const noexcept
{
return !m_mask;
}
constexpr bool operator&( BitType const & rhs ) const noexcept
{
return m_mask & static_cast<MaskType>( rhs );
}
constexpr Flags<BitType> operator&( Flags<BitType> const & rhs ) const noexcept
{
return Flags<BitType>( m_mask & rhs.m_mask );
}
constexpr Flags<BitType> operator|( Flags<BitType> const & rhs ) const noexcept
{
return Flags<BitType>( m_mask | rhs.m_mask );
}
private:
MaskType m_mask;
};
enum class CommandFlavourFlagBits : uint8_t
{
enhanced = 1 << 0,
chained = 1 << 1,
singular = 1 << 2,
unique = 1 << 3,
withAllocator = 1 << 4,
noReturn = 1 << 5,
keepVoidPtr = 1 << 6
};
using CommandFlavourFlags = Flags<CommandFlavourFlagBits>;
constexpr CommandFlavourFlags operator|( CommandFlavourFlagBits const & lhs, CommandFlavourFlagBits const & rhs ) noexcept
{
return CommandFlavourFlags( lhs ) | CommandFlavourFlags( rhs );
}
class VulkanHppGenerator
{
public:
VulkanHppGenerator( tinyxml2::XMLDocument const & document, std::string const & api );
void generateEnumsHppFile() const;
void generateExtensionInspectionFile() const;
void generateFormatTraitsHppFile() const;
void generateFuncsHppFile() const;
void generateHandlesHppFile() const;
void generateHashHppFile() const;
void generateHppFile() const;
void generateMacrosFile() const;
void generateRAIIHppFile() const;
void generateSharedHppFile() const;
void generateStaticAssertionsHppFile() const;
void generateStructsHppFile() const;
void generateToStringHppFile() const;
void generateCppModuleFile() const;
void prepareRAIIHandles();
void prepareVulkanFuncs();
struct MacroData
{
std::string deprecatedComment = {};
std::string calleeMacro = {};
std::vector<std::string> params = {};
std::string definition = {};
};
private:
struct NameLine
{
std::string name = {};
int xmlLine = {};
};
struct BaseTypeData
{
TypeInfo typeInfo = {};
int xmlLine = {};
};
struct BitmaskData
{
std::map<std::string, int> aliases = {};
std::string require = {};
std::string type = {};
int xmlLine = {};
};
struct EnumValueAlias
{
std::string alias = {};
std::string name = {};
std::string protect = {};
bool supported = {};
int xmlLine = {};
};
struct EnumValueData
{
std::map<std::string, int> aliases = {};
std::string bitpos = {};
bool deprecated = {};
std::string name = {};
std::string protect = {};
bool supported = {};
std::string value = {};
int xmlLine = {};
};
struct EnumData
{
void addEnumAlias( int line, std::string const & name, std::string const & alias, std::string const & protect, bool supported );
void addEnumValue( int line,
std::string const & valueName,
std::string const & protect,
std::string const & bitpos,
std::string const & value,
bool supported,
bool deprecated );
std::map<std::string, int> aliases = {};
std::string bitwidth = {};
bool isBitmask = false;
std::vector<EnumValueAlias> valueAliases = {}; // temporary storage for aliases, as they might be specified before the actual value is specified
std::vector<EnumValueData> values = {};
int xmlLine = {};
};
struct EnumExtendData
{
std::string alias = {};
std::string api = {};
std::string name = {};
std::string platform = {};
std::set<std::string> requiredBy = {};
bool supported = {};
int xmlLine = {};
};
struct NameData
{
std::string name = {};
std::vector<std::string> arraySizes = {};
};
struct ParamData
{
TypeInfo type = {};
std::string name = {};
std::vector<std::string> arraySizes = {};
std::string lenExpression = {};
std::vector<std::pair<std::string, size_t>> lenParams = {};
bool optional = false;
std::pair<std::string, size_t> strideParam = {};
int xmlLine = {};
};
struct CommandData
{
std::map<std::string, int> aliases = {};
std::vector<std::string> errorCodes = {};
std::string handle = {};
std::vector<ParamData> params = {};
std::set<std::string> requiredBy = {};
std::string returnType = {};
std::vector<std::string> successCodes = {};
int xmlLine = {};
};
struct ConstantData
{
std::string type = {};
std::string value = {};
int xmlLine = {};
};
struct DefineData
{
bool deprecated = false;
std::string require = {};
int xmlLine = {};
std::string deprecationReason = {};
std::string possibleCallee = {};
std::vector<std::string> params = {};
std::string possibleDefinition = {};
};
struct DefinesPartition
{
std::map<std::string, DefineData> callees = {};
std::map<std::string, DefineData> callers = {};
std::map<std::string, DefineData> values = {};
};
struct RequireFeature
{
std::vector<std::string> name = {};
std::string structure = {};
int xmlLine = {};
};
struct RemoveData
{
std::vector<std::string> commands = {};
std::vector<std::string> enums = {};
std::vector<RequireFeature> features = {};
std::vector<std::string> types = {};
int xmlLine = {};
};
struct RequireData
{
std::string depends = {};
std::vector<NameLine> commands = {};
std::map<std::string, std::string> enumConstants = {};
std::vector<std::string> constants = {};
std::vector<RequireFeature> features = {};
std::vector<NameLine> types = {};
int xmlLine = {};
};
struct ExtensionData
{
std::string deprecatedBy = {};
bool isDeprecated = false;
std::string name = {};
std::string number = {};
std::string obsoletedBy = {};
std::string platform = {};
std::string promotedTo = {};
std::map<std::string, std::vector<std::vector<std::string>>> depends = {};
std::vector<std::string> ratified = {};
std::vector<RemoveData> removeData = {};
std::vector<RequireData> requireData = {};
std::vector<std::string> supported = {};
std::string type = {};
std::vector<RequireData> unsupportedRequireData = {};
int xmlLine = 0;
};
struct FeatureData
{
std::string name = {};
std::string number = {};
std::vector<RemoveData> removeData = {};
std::vector<RequireData> requireData = {};
int xmlLine = {};
};
struct ExternalTypeData
{
std::string require = {};
int xmlLine = 0;
};
struct ComponentData
{
std::string bits = {};
std::string name = {};
std::string numericFormat = {};
std::string planeIndex = {};
int xmlLine = {};
};
struct PlaneData
{
std::string compatible = {};
std::string heightDivisor = {};
std::string widthDivisor = {};
int xmlLine = {};
};
struct FormatData
{
std::string blockExtent = {};
std::string blockSize = {};
std::string chroma = {};
std::string classAttribute = {};
std::vector<ComponentData> components = {};
std::string compressed = {};
std::string packed = {};
std::vector<PlaneData> planes = {};
std::string spirvImageFormat = {};
std::string texelsPerBlock = {};
int xmlLine = {};
};
struct FuncPointerArgumentData
{
std::string name = {};
std::string type = {};
int xmlLine = {};
};
struct FuncPointerData
{
std::vector<FuncPointerArgumentData> arguments = {};
std::string require = {};
int xmlLine = {};
};
struct HandleData
{
std::map<std::string, int> aliases = {};
std::set<std::string> childrenHandles = {};
std::set<std::string> commands = {};
std::string deleteCommand = {};
std::string deletePool = {};
std::string destructorType = {};
std::string objTypeEnum = {};
std::string parent = {};
std::set<std::string> secondLevelCommands = {};
bool isDispatchable = {};
int xmlLine = {};
// RAII data
std::map<std::string, CommandData>::const_iterator destructorIt = {};
std::vector<std::map<std::string, CommandData>::const_iterator> constructorIts = {};
};
struct PlatformData
{
std::string protect = {};
int xmlLine = {};
};
struct MemberData
{
std::string defaultValue = {};
TypeInfo type = {};
std::string name = {};
std::vector<std::string> arraySizes = {};
std::string bitCount = {};
std::vector<std::string> lenExpressions = {};
std::vector<std::pair<std::string, size_t>> lenMembers = {};
bool noAutoValidity = {};
std::vector<bool> optional = {};
std::vector<std::string> selection = {};
std::string selector = {};
std::string value = {};
int xmlLine = {};
};
struct SpirVCapabilityData
{
std::map<std::string, std::map<std::string, int>> structs = {}; // map from structure to map from member to xmlLine
int xmlLine = {};
};
struct StructureData
{
std::map<std::string, int> aliases = {};
bool allowDuplicate = {};
bool isExtended = {};
bool isUnion = {};
bool returnedOnly = {};
bool mutualExclusiveLens = {};
std::vector<MemberData> members = {};
std::vector<std::string> structExtends = {};
std::string subStruct = {};
int xmlLine = {};
};
struct TagData
{
int xmlLine = {};
};
struct VectorParamData
{
size_t lenParam = INVALID_INDEX;
size_t strideParam = INVALID_INDEX;
bool byStructure = false;
};
struct VideoRequireCapabilities
{
int xmlLine = {};
std::string name;
std::string member;
std::string value;
};
struct VideoFormat
{
int xmlLine = {};
std::vector<std::string> formatProperties;
std::string name;
std::vector<std::string> usage;
std::vector<VideoRequireCapabilities> requireCapabilities;
};
struct VideoProfile
{
int xmlLine = {};
std::string name;
std::string value;
};
struct VideoProfileMember
{
int xmlLine = {};
std::string name;
std::vector<VideoProfile> profiles;
};
struct VideoProfiles
{
int xmlLine = {};
std::string name;
std::vector<VideoProfileMember> members;
};
struct VideoCodec
{
int xmlLine = {};
std::string name;
std::vector<std::string> capabilities;
std::string extend;
std::string value;
std::vector<VideoFormat> formats;
std::vector<VideoProfiles> profiles;
};
struct MacroVisitor final : tinyxml2::XMLVisitor
{
// comments, then name, then parameters and definition together, because that's how they appear in the xml!
// guaranteed to be 3 elements long
std::vector<std::string> macro;
bool Visit( tinyxml2::XMLText const & text ) override
{
if ( auto const nodeText = text.Value(); nodeText != nullptr )
{
macro.emplace_back( nodeText );
}
return true;
}
};
private:
void addCommand( std::string const & name, CommandData & commandData );
void addCommandsToHandle( std::vector<RequireData> const & requireData );
void addMissingFlagBits( std::vector<RequireData> & requireData, std::string const & requiredBy );
std::string addTitleAndProtection( std::string const & title, std::string const & strIf, std::string const & strElse = {} ) const;
bool allVectorSizesSupported( std::vector<ParamData> const & params, std::map<size_t, VectorParamData> const & vectorParams ) const;
void appendDispatchLoaderDynamicCommands( std::vector<RequireData> const & requireData,
std::set<std::string> & listedCommands,
std::string const & title,
std::string & commandMembers,
std::string & initialCommandAssignments,
std::string & instanceCommandAssignments,
std::string & deviceCommandAssignments ) const;
void appendRAIIDispatcherCommands( std::vector<RequireData> const & requireData,
std::set<std::string> & listedCommands,
std::string const & title,
std::string & contextInitializers,
std::string & contextMembers,
std::string & deviceAssignments,
std::string & deviceMembers,
std::string & instanceAssignments,
std::string & instanceMembers ) const;
void checkBitmaskCorrectness() const;
void checkCommandCorrectness() const;
void checkCorrectness() const;
void checkDefineCorrectness() const;
void checkEnumCorrectness() const;
void checkEnumCorrectness( std::vector<RequireData> const & requireData ) const;
bool checkEquivalentSingularConstructor( std::vector<std::map<std::string, CommandData>::const_iterator> const & constructorIts,
std::map<std::string, CommandData>::const_iterator constructorIt,
std::vector<ParamData>::const_iterator lenIt ) const;
void checkExtensionCorrectness() const;
void checkFeatureCorrectness() const;
void checkFuncPointerCorrectness() const;
void checkHandleCorrectness() const;
void checkSpirVCapabilityCorrectness() const;
void checkStructCorrectness() const;
void checkStructMemberCorrectness( std::string const & structureName, std::vector<MemberData> const & members, std::set<std::string> & sTypeValues ) const;
void checkSyncAccessCorrectness() const;
void checkSyncStageCorrectness() const;
std::string combineDataTypes( std::map<size_t, VectorParamData> const & vectorParams,
std::vector<size_t> const & returnParams,
bool enumerating,
std::vector<std::string> const & dataTypes,
CommandFlavourFlags flavourFlags,
bool raii ) const;
bool contains( std::vector<EnumValueData> const & enumValues, std::string const & name ) const;
bool containsArray( std::string const & type ) const;
bool containsFuncPointer( std::string const & type ) const;
bool containsFloatingPoints( std::vector<MemberData> const & members ) const;
bool containsUnion( std::string const & type ) const;
bool describesVector( StructureData const & structure, std::string const & type = "" ) const;
std::vector<size_t> determineChainedReturnParams( std::vector<ParamData> const & params, std::vector<size_t> const & returnParams ) const;
std::vector<size_t> determineConstPointerParams( std::vector<ParamData> const & params ) const;
std::vector<std::string> determineDataTypes( std::vector<VulkanHppGenerator::ParamData> const & params,
std::map<size_t, VectorParamData> const & vectorParams,
std::vector<size_t> const & returnParams,
std::set<size_t> const & templatedParams ) const;
size_t determineDefaultStartIndex( std::vector<ParamData> const & params, std::set<size_t> const & skippedParams ) const;
bool determineEnumeration( std::map<size_t, VectorParamData> const & vectorParams, std::vector<size_t> const & returnParams ) const;
size_t determineInitialSkipCount( std::string const & command ) const;
std::vector<size_t> determineReturnParams( std::vector<ParamData> const & params ) const;
std::vector<std::map<std::string, CommandData>::const_iterator>
determineRAIIHandleConstructors( std::string const & handleType, std::map<std::string, CommandData>::const_iterator destructorIt ) const;
std::map<std::string, CommandData>::const_iterator determineRAIIHandleDestructor( std::string const & handleType ) const;
std::set<size_t> determineSingularParams( size_t returnParam, std::map<size_t, VectorParamData> const & vectorParams ) const;
std::set<size_t> determineSkippedParams( std::vector<ParamData> const & params,
size_t initialSkipCount,
std::map<size_t, VectorParamData> const & vectorParams,
std::vector<size_t> const & returnParam,
bool singular ) const;
std::string determineSubStruct( std::pair<std::string, StructureData> const & structure ) const;
std::map<size_t, VectorParamData> determineVectorParams( std::vector<ParamData> const & params ) const;
std::set<size_t> determineVoidPointerParams( std::vector<ParamData> const & params ) const;
void distributeEnumExtends();
void distributeEnumValueAliases();
void distributeSecondLevelCommands( std::set<std::string> const & specialFunctions );
void distributeRequirements();
void distributeRequirements( std::vector<RequireData> const & requireData, std::string const & requiredBy );
void distributeStructAliases();
void filterLenMembers();
std::map<std::string, NameLine>::const_iterator findAlias( std::string const & name, std::map<std::string, NameLine> const & aliases ) const;
std::string findBaseName( std::string aliasName, std::map<std::string, NameLine> const & aliases ) const;
std::vector<FeatureData>::const_iterator findFeature( std::string const & name ) const;
std::vector<ParamData>::const_iterator findParamIt( std::string const & name, std::vector<ParamData> const & paramData ) const;
std::vector<MemberData>::const_iterator findStructMemberIt( std::string const & name, std::vector<MemberData> const & memberData ) const;
std::vector<MemberData>::const_iterator findStructMemberItByType( std::string const & type, std::vector<MemberData> const & memberData ) const;
std::vector<ExtensionData>::const_iterator findSupportedExtension( std::string const & name ) const;
std::string findTag( std::string const & name, std::string const & postfix = "" ) const;
std::pair<std::string, std::string> generateAllocatorTemplates( std::vector<size_t> const & returnParams,
std::vector<std::string> const & returnDataTypes,
std::map<size_t, VectorParamData> const & vectorParams,
std::vector<size_t> const & chainedReturnParams,
CommandFlavourFlags flavourFlags,
bool definition ) const;
std::string generateArgumentListEnhanced( std::vector<ParamData> const & params,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
std::set<size_t> const & skippedParams,
std::set<size_t> const & singularParams,
std::set<size_t> const & templatedParams,
std::vector<size_t> const & chainedReturnParams,
bool definition,
CommandFlavourFlags flavourFlags,
bool withDispatcher ) const;
std::string generateArgumentListStandard( std::vector<ParamData> const & params, std::set<size_t> const & skippedParams, bool withDispatcher ) const;
std::string generateArgumentTemplates( std::vector<ParamData> const & params,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
std::set<size_t> const & templatedParams,
std::vector<size_t> const & chainedReturnParams,
bool raii ) const;
std::string generateBaseTypes() const;
std::string generateBitmask( std::map<std::string, BitmaskData>::const_iterator bitmaskIt, std::string const & surroundingProtect ) const;
std::string generateBitmasksToString() const;
std::string generateBitmasksToString( std::vector<RequireData> const & requireData, std::set<std::string> & listedBitmasks, std::string const & title ) const;
std::string generateBitmaskToString( std::map<std::string, BitmaskData>::const_iterator bitmaskIt ) const;
std::string generateCallArgumentsEnhanced( CommandData const & commandData,
size_t initialSkipCount,
bool nonConstPointerAsNullptr,
std::set<size_t> const & singularParams,
std::set<size_t> const & templatedParams,
bool raii,
bool raiiFactory,
CommandFlavourFlags flavourFlags ) const;
std::string generateCallArgumentsStandard( std::vector<ParamData> const & params, size_t initialSkipCount ) const;
std::string generateCallArgumentEnhanced( std::vector<ParamData> const & params,
size_t paramIndex,
bool nonConstPointerAsNullptr,
std::set<size_t> const & singularParams,
std::set<size_t> const & templatedParams,
CommandFlavourFlags flavourFlags,
bool raiiFactory ) const;
std::string generateCallArgumentEnhancedConstPointer( ParamData const & param,
size_t paramIndex,
std::set<size_t> const & singularParams,
std::set<size_t> const & templatedParams ) const;
std::string generateCallArgumentEnhancedNonConstPointer( ParamData const & param,
size_t paramIndex,
bool nonConstPointerAsNullptr,
std::set<size_t> const & singularParams ) const;
std::string generateCallArgumentEnhancedValue( std::vector<ParamData> const & params,
size_t paramIndex,
std::set<size_t> const & singularParams,
CommandFlavourFlags flavourFlags,
bool raiiFactory ) const;
std::string generateCallSequence( std::string const & name,
CommandData const & commandData,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
size_t initialSkipCount,
std::set<size_t> const & singularParams,
std::set<size_t> const & templatedParams,
std::vector<size_t> const & chainedReturnParams,
CommandFlavourFlags flavourFlags,
bool raii,
bool raiiFactory ) const;
std::string generateChainTemplates( std::vector<size_t> const & returnParams, bool chained ) const;
std::string generateCommand( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, bool raii ) const;
std::string generateCommandDefinitions() const;
std::string
generateCommandDefinitions( std::vector<RequireData> const & requireData, std::set<std::string> & listedCommands, std::string const & title ) const;
std::string generateCommandDefinitions( std::string const & command, std::string const & handle ) const;
std::string generateCommandEnhanced( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::map<size_t, VectorParamData> const & vectorParams,
std::vector<size_t> const & returnParams,
CommandFlavourFlags flavourFlags ) const;
std::string generateCommandName( std::string const & vulkanCommandName,
std::vector<ParamData> const & params,
size_t initialSkipCount,
CommandFlavourFlags flavourFlags = {} ) const;
std::string generateCommandResult( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, bool raii ) const;
std::string generateCommandResultMultiSuccessNoErrors(
std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, bool raii ) const;
std::string generateCommandResultMultiSuccessWithErrors(
std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, bool raii ) const;
std::string generateCommandResultMultiSuccessWithErrors1Return(
std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParam, bool raii ) const;
std::string generateCommandResultMultiSuccessWithErrors2Return( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::vector<size_t> const & returnParamIndices,
bool raii ) const;
std::string generateCommandResultMultiSuccessWithErrors3Return( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::vector<size_t> const & returnParamIndices,
bool raii ) const;
std::string
generateCommandResultSingleSuccess( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, bool raii ) const;
std::string generateCommandResultSingleSuccessNoErrors(
std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, bool raii ) const;
std::string generateCommandResultSingleSuccessWithErrors(
std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, bool raii ) const;
std::string generateCommandResultSingleSuccessWithErrors1Return(
std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParam, bool raii ) const;
std::string generateCommandResultSingleSuccessWithErrors1ReturnChain(
std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParam, bool raii ) const;
std::string generateCommandResultSingleSuccessWithErrors1ReturnHandle(
std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParam, bool raii ) const;
std::string generateCommandResultSingleSuccessWithErrors1ReturnValue(
std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParam, bool raii ) const;
std::string generateCommandResultSingleSuccessWithErrors1ReturnVoid(
std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParam, bool raii ) const;
std::string generateCommandResultSingleSuccessWithErrors2Return( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::vector<size_t> const & returnParamIndices,
bool raii ) const;
std::string generateCommandResultSingleSuccessWithErrors3Return( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::vector<size_t> const & returnParamIndices,
bool raii ) const;
std::string generateCommandResultWithErrors0Return(
std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, bool raii ) const;
std::string generateCommandSet( bool definition,
std::string const & standard,
std::vector<std::string> const & enhanced = {},
std::vector<std::string> const & unique = {} ) const;
std::string generateCommandSet( std::string const & standard, std::string const & enhanced ) const;
std::string generateCommandSetInclusive( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::vector<size_t> returnParams,
std::map<size_t, VectorParamData> vectorParams,
bool unique,
std::vector<CommandFlavourFlags> const & flags,
bool raii,
bool raiiFactory,
std::vector<CommandFlavourFlags> const & raiiFlags ) const;
std::string
generateCommandSetExclusive( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, bool raii ) const;
std::string generateCommandStandard( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const;
std::string generateCommandVoid( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, bool raii ) const;
std::string generateCommandValue( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, bool raii ) const;
std::string
generateCommandVoid0Return( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, bool raii ) const;
std::string generateCommandVoid1Return(
std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParam, bool raii ) const;
std::string generateCommandVoid2Return( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
bool definition,
std::vector<size_t> const & returnParamIndices,
bool raii ) const;
std::string generateConstexprString( std::string const & structName ) const;
std::string generateConstexprDefines() const;
std::string generateConstexprUsings() const;
std::string generateCppModuleHandleUsings() const;
std::string generateCppModuleStructUsings() const;
std::string generateCppModuleUniqueHandleUsings() const;
std::string generateCppModuleFuncsUsings() const;
std::string generateCppModuleEnumUsings() const;
std::string generateCppModuleFormatTraitsUsings() const;
std::string generateCppModuleExtensionInspectionUsings() const;
std::string generateCppModuleUsings() const;
std::string generateCppModuleRaiiUsings() const;
std::string generateCppModuleSharedHandleUsings() const;
std::string generateDataDeclarations( CommandData const & commandData,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
std::set<size_t> const & templatedParams,
CommandFlavourFlags flavourFlags,
bool raii,
std::vector<std::string> const & dataTypes,
std::string const & dataType,
std::string const & returnType,
std::string const & returnVariable ) const;
std::string generateDataDeclarations1Return( CommandData const & commandData,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
std::set<size_t> const & templatedParams,
CommandFlavourFlags flavourFlags,
std::vector<std::string> const & dataTypes,
std::string const & dataType,
std::string const & returnType,
std::string const & returnVariable ) const;
std::string generateDataDeclarations2Returns( CommandData const & commandData,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
CommandFlavourFlags flavourFlags,
bool raii,
std::vector<std::string> const & dataTypes,
std::string const & returnType,
std::string const & returnVariable ) const;
std::string generateDataDeclarations3Returns( CommandData const & commandData,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
CommandFlavourFlags flavourFlags,
bool raii,
std::vector<std::string> const & dataTypes ) const;
std::string generateDataPreparation( CommandData const & commandData,
size_t initialSkipCount,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
std::set<size_t> const & templatedParams,
CommandFlavourFlags flavourFlags,
bool enumerating,
std::vector<std::string> const & dataTypes ) const;
std::string generateDataSizeChecks( CommandData const & commandData,
std::vector<size_t> const & returnParams,
std::vector<std::string> const & returnParamTypes,
std::map<size_t, VectorParamData> const & vectorParams,
std::set<size_t> const & templatedParams,
bool singular ) const;
std::string generateDebugReportObjectType( std::string const & objectType ) const;
std::string generateDecoratedReturnType( CommandData const & commandData,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
CommandFlavourFlags flavourFlags,
bool raii,
std::string const & returnType ) const;
std::string generateDispatchLoaderDynamic() const; // uses vkGet*ProcAddress to get function pointers
std::string generateDispatchLoaderStatic() const; // uses exported symbols from loader
std::string generateDestroyCommand( std::string const & name, CommandData const & commandData ) const;
std::string
generateDispatchLoaderDynamicCommandAssignment( std::string const & commandName, std::string const & aliasName, std::string const & firstArg ) const;
std::string generateDispatchLoaderStaticCommands( std::vector<RequireData> const & requireData,
std::set<std::string> & listedCommands,
std::string const & title ) const;
std::string generateEnum( std::pair<std::string, EnumData> const & enumData, std::string const & surroundingProtect ) const;
std::string generateEnumInitializer( TypeInfo const & type,
std::vector<std::string> const & arraySizes,
std::vector<EnumValueData> const & values,
bool bitmask ) const;
std::string generateEnums() const;
std::string generateEnums( std::vector<RequireData> const & requireData, std::set<std::string> & listedEnums, std::string const & title ) const;
std::string generateEnumsToString() const;
std::string generateEnumsToString( std::vector<RequireData> const & requireData, std::set<std::string> & listedEnums, std::string const & title ) const;
std::string generateEnumToString( std::pair<std::string, EnumData> const & enumData ) const;
std::pair<std::string, std::string> generateEnumSuffixes( std::string const & name, bool bitmask ) const;
std::string generateEnumValueName( std::string const & enumName, std::string const & valueName, bool bitmask ) const;
std::string generateExtensionDependencies() const;
std::string generateExtensionDependsByVersion( bool definition ) const;
template <class Predicate, class Extraction>
std::string generateExtensionReplacedBy( Predicate p, Extraction e ) const;
template <class Predicate>
std::string generateExtensionReplacedTest( Predicate p ) const;
std::string generateExtensionsList( std::string const & type ) const;
std::string generateExtensionTypeTest( std::string const & type ) const;
std::string generateFormatTraits() const;
std::string generateFunctionPointerCheck( std::string const & function, std::set<std::string> const & requiredBy, bool raii ) const;
std::string generateHandle( std::pair<std::string, HandleData> const & handle, std::set<std::string> & listedHandles ) const;
std::string generateHandleCommandDeclarations( std::set<std::string> const & commands ) const;
std::string generateHandleDependencies( std::pair<std::string, HandleData> const & handle, std::set<std::string> & listedHandles ) const;
std::string generateHandleEmpty( HandleData const & handleData ) const;
std::string generateHandleForwardDeclarations() const;
std::string generateHandleForwardDeclarations( std::vector<RequireData> const & requireData, std::string const & title ) const;
std::string generateHandleHashStructures( std::vector<RequireData> const & requireData, std::string const & title ) const;
std::string generateHandleHashStructures() const;
std::string generateHandles() const;
std::string generateIndexTypeTraits( std::pair<std::string, EnumData> const & enumData ) const;
std::string generateLayerSettingTypeTraits() 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::string generateName( TypeInfo const & typeInfo ) const;
std::string generateNoExcept( std::vector<std::string> const & errorCodes,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
CommandFlavourFlags flavourFlags,
bool vectorSizeCheck,
bool raii ) const;
std::string generateObjectDeleter( std::string const & commandName, CommandData const & commandData, size_t initialSkipCount, size_t returnParam ) const;
std::string generateObjectTypeToDebugReportObjectType() const;
std::pair<std::string, std::string> generateProtection( std::string const & protect, bool defined = true ) const;
std::string generateRAIICommandDefinitions() const;
std::string
generateRAIICommandDefinitions( std::vector<RequireData> const & requireData, std::set<std::string> & listedCommands, std::string const & title ) const;
std::string generateRAIIDispatchers() const;
std::string generateRAIIFactoryReturnStatements( std::vector<ParamData> const & params,
std::vector<std::string> const & successCodes,
std::string const & vkType,
bool enumerating,
std::string const & returnType,
std::string const & returnVariable,
bool singular ) const;
std::string generateRAIIHandle( std::pair<std::string, HandleData> const & handle,
std::set<std::string> & listedHandles,
std::set<std::string> const & specialFunctions ) const;
std::string generateRAIIHandleCommand( std::string const & command, size_t initialSkipCount, bool definition ) const;
std::string generateRAIIHandleCommandDeclarations( std::pair<std::string, HandleData> const & handle, std::set<std::string> const & specialFunctions ) const;
std::string generateRAIIHandleCommandEnhanced( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParamIndices,
bool definition,
CommandFlavourFlags flavourFlags = {} ) const;
std::string generateRAIIHandleCommandFactory( std::string const & name,
CommandData const & commandData,
size_t initialSkipCount,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
bool definition,
CommandFlavourFlags flavourFlags = {} ) const;
std::string generateRAIIHandleCommandFactoryArgumentList( std::vector<ParamData> const & params,
std::set<size_t> const & skippedParams,
bool definition,
bool singular ) const;
std::string generateRAIIHandleCommandStandard( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const;
std::pair<std::string, std::string> generateRAIIHandleConstructor( std::pair<std::string, HandleData> const & handle,
std::map<std::string, CommandData>::const_iterator constructorIt,
std::string const & enter,
std::string const & leave ) const;
std::string generateRAIIHandleConstructorByCall( std::pair<std::string, HandleData> const & handle,
std::map<std::string, CommandData>::const_iterator constructorIt,
std::string const & enter,
std::string const & leave,
bool isPlural,
bool forceSingular ) const;
std::pair<std::string, std::string> generateRAIIHandleConstructor1Return2Vector( std::pair<std::string, HandleData> const & handle,
std::map<std::string, CommandData>::const_iterator constructorIt,
std::string const & enter,
std::string const & leave,
size_t returnParam,
std::map<size_t, VectorParamData> const & vectorParamIndices ) const;
std::pair<std::string, std::string> generateRAIIHandleConstructors( std::pair<std::string, HandleData> const & handle ) const;
std::string generateRAIIHandleConstructorArgument( ParamData const & param, bool definition, bool singular, bool takesOwnership ) const;
std::string generateRAIIHandleConstructorArguments( std::pair<std::string, HandleData> const & handle,
std::map<std::string, VulkanHppGenerator::CommandData>::const_iterator constructorIt,
bool singular,
bool takesOwnership ) const;
std::string generateRAIIHandleConstructorInitializationList( std::pair<std::string, HandleData> const & handle,
std::map<std::string, CommandData>::const_iterator constructorIt,
std::map<std::string, CommandData>::const_iterator destructorIt,
bool takesOwnership ) const;
std::string generateRAIIHandleConstructorParamName( std::string const & type, std::map<std::string, CommandData>::const_iterator destructorIt ) const;
std::pair<std::string, std::string> generateRAIIHandleConstructorResult( std::pair<std::string, HandleData> const & handle,
std::map<std::string, CommandData>::const_iterator constructorIt,
std::string const & enter,
std::string const & leave ) const;
std::string generateRAIIHandleConstructorTakeOwnership( std::pair<std::string, HandleData> const & handle ) const;
std::pair<std::string, std::string> generateRAIIHandleConstructorVoid( std::pair<std::string, HandleData> const & handle,
std::map<std::string, CommandData>::const_iterator constructorIt,
std::string const & enter,
std::string const & leave ) const;
std::string generateRAIIHandleContext( std::pair<std::string, HandleData> const & handle, std::set<std::string> const & specialFunctions ) const;
std::string generateRAIIHandleDestructorCallArguments( std::string const & handleType,
std::map<std::string, CommandData>::const_iterator destructorIt ) const;
std::tuple<std::string, std::string, std::string, std::string, std::string, std::string, std::string>
generateRAIIHandleDetails( std::pair<std::string, HandleData> const & handle ) const;
std::string generateRAIIHandleForwardDeclarations( std::vector<RequireData> const & requireData, std::string const & title ) const;
std::string generateRAIIHandles() const;
std::string generateRAIIHandleSingularConstructorArguments( std::pair<std::string, HandleData> const & handle,
std::vector<ParamData> const & params,
std::string const & argumentType,
std::string const & argumentName ) const;
template <class Predicate, class Extraction>
std::string generateReplacedExtensionsList( Predicate p, Extraction e ) const;
std::string generateResultAssignment( CommandData const & commandData ) const;
std::string generateResultCheck(
CommandData const & commandData, std::string const & className, std::string const & classSeparator, std::string commandName, bool enumerating ) const;
std::string
generateResultCheckExpected( std::vector<std::string> const & successCodes, std::string const & className, std::string const & commandName ) const;
std::string generateResultExceptions() const;
std::string generateReturnStatement( std::string const & commandName,
CommandData const & commandData,
std::string const & returnVariable,
std::string const & returnType,
std::string const & decoratedReturnType,
std::string const & dataType,
size_t initialSkipCount,
size_t returnParam,
CommandFlavourFlags flavourFlags,
bool enumerating,
bool raii ) const;
std::string generateReturnType( std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
CommandFlavourFlags flavourFlags,
bool raii,
std::vector<std::string> const & dataTypes ) const;
std::string generateReturnVariable( CommandData const & commandData,
std::vector<size_t> const & returnParams,
std::map<size_t, VectorParamData> const & vectorParams,
CommandFlavourFlags flavourFlags ) const;
std::string
generateSizeCheck( std::vector<std::vector<MemberData>::const_iterator> const & arrayIts, std::string const & structName, bool mutualExclusiveLens ) const;
std::string generateStaticAssertions() const;
std::string generateStaticAssertions( std::vector<RequireData> const & requireData, std::string const & title, std::set<std::string> & listedStructs ) const;
std::string generateStruct( std::pair<std::string, StructureData> const & structure, std::set<std::string> & listedStructs ) const;
std::string generateStructCompareOperators( std::pair<std::string, StructureData> const & structure ) const;
std::string generateStructConstructors( std::pair<std::string, StructureData> const & structData ) const;
std::string generateStructConstructorsEnhanced( std::pair<std::string, StructureData> const & structData ) const;
std::string generateStructConstructorArgument( MemberData const & memberData, bool withDefault ) const;
std::string generateStructHashStructure( std::pair<std::string, StructureData> const & structure, std::set<std::string> & listedStructs ) const;
std::string generateStructHashStructures() const;
std::string generateStructHashSum( std::string const & structName, std::vector<MemberData> const & members ) const;
std::string generateStructs() const;
std::string generateStructure( std::pair<std::string, StructureData> const & structure ) const;
std::string generateStructExtendsStructs() const;
std::string
generateStructExtendsStructs( std::vector<RequireData> const & requireData, std::set<std::string> & listedStructs, std::string const & title ) const;
std::string generateStructForwardDeclarations() const;
std::string
generateStructForwardDeclarations( std::vector<RequireData> const & requireData, std::string const & title, std::set<std::string> & listedStructs ) const;
std::tuple<std::string, std::string, std::string, std::string> generateStructMembers( std::pair<std::string, StructureData> const & structData ) const;
std::string generateStructSetter( std::string const & structureName, std::vector<MemberData> const & memberData, size_t index ) const;
std::string generateStructSubConstructor( std::pair<std::string, StructureData> const & structData ) const;
std::string generateSuccessCheck( std::vector<std::string> const & successCodes ) const;
std::string generateSuccessCode( std::string const & code ) const;
std::string generateSuccessCodeList( std::vector<std::string> const & successCodes, bool enumerating ) const;