// 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 #include #include #include #include class VulkanHppGenerator { public: VulkanHppGenerator( tinyxml2::XMLDocument const & document ); std::string generateBaseTypes() const; std::string generateBitmasks() const; std::string generateCommandDefinitions() const; std::string generateDispatchLoaderDynamic() const; // uses vkGet*ProcAddress to get function pointers std::string generateDispatchLoaderStatic() const; // uses exported symbols from loader std::string generateEnums() const; std::string generateHandles() const; std::string generateHashStructures() const; std::string generateIndexTypeTraits() const; std::string generateRAIICommandDefinitions() const; std::string generateRAIIDispatchers() const; std::string generateRAIIHandles() const; std::string generateResultExceptions() const; std::string generateStructExtendsStructs() const; std::string generateStructForwardDeclarations() const; std::string generateStructs() const; std::string generateThrowResultException() const; std::string const & getTypesafeCheck() const; std::string const & getVersion() const; std::string const & getVulkanLicenseHeader() const; void prepareRAIIHandles(); private: 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 operator!=( TypeInfo const & rhs ) const { return !operator==( rhs ); } bool operator<( TypeInfo const & rhs ) const { return ( prefix < rhs.prefix ) || ( ( prefix == rhs.prefix ) && ( ( type < rhs.type ) || ( ( 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 BaseTypeData { BaseTypeData( TypeInfo const & typeInfo_, int line ) : typeInfo( typeInfo_ ), xmlLine( line ) {} TypeInfo typeInfo; 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 arraySizes; }; struct ParamData { ParamData( int line ) : optional( false ), xmlLine( line ) {} TypeInfo type; std::string name; std::vector arraySizes; std::string len; bool optional; int xmlLine; }; struct CommandData { CommandData( int line ) : xmlLine( line ) {} std::string alias; std::vector errorCodes; std::string handle; std::vector params; std::string referencedIn; std::string returnType; std::vector successCodes; int xmlLine; }; struct EnumAliasData { EnumAliasData( std::string const & name_, int line ) : name( name_ ), xmlLine( line ) {} std::string name; int xmlLine; }; struct EnumValueData { EnumValueData( int line, std::string const & name_, std::string const & protect_, std::string const & extension_, bool singleBit_ ) : name( name_ ), extension( extension_ ), protect( protect_ ), singleBit( singleBit_ ), xmlLine( line ) {} std::string name; std::string extension; std::string protect; bool singleBit; int xmlLine; }; struct EnumData { EnumData( int line ) : xmlLine( line ) {} void addEnumAlias( int line, std::string const & name, std::string const & alias ); void addEnumValue( int line, std::string const & valueName, std::string const & protect, bool bitpos, std::string const & extension ); std::string alias; // alias for this enum std::map aliases; // aliases for the values std::string bitwidth; bool isBitmask = false; std::vector values; int xmlLine; }; struct RequireData { RequireData( int line, std::string const & title_ ) : title( title_ ), xmlLine( line ) {} std::string title; std::vector commands; std::vector types; int xmlLine; }; struct FeatureData { FeatureData( std::string const & number_ ) : number( number_ ) {} std::string number; std::vector requireData; }; struct ExtensionData { ExtensionData( int line, std::string const & deprecatedBy_, std::string const & number_, std::string const & obsoletedBy_, std::string const & platform_, std::string const & promotedTo_ ) : deprecatedBy( deprecatedBy_ ) , number( number_ ) , obsoletedBy( obsoletedBy_ ) , platform( platform_ ) , promotedTo( promotedTo_ ) , xmlLine( line ) {} std::string deprecatedBy; std::string number; std::string obsoletedBy; std::string platform; std::string promotedTo; std::set requiresAttribute; std::vector requireData; int xmlLine; }; struct FuncPointerArgumentData { FuncPointerArgumentData( std::string const & t, int line ) : type( t ), xmlLine( line ) {} std::string type; int xmlLine; }; struct FuncPointerData { FuncPointerData( std::string const & r, int line ) : requirements( r ), xmlLine( line ) {} std::vector arguments; std::string requirements; int xmlLine; }; struct HandleData { HandleData( std::string const & p, std::string const & objType, int line ) : objTypeEnum( objType ), parent( p ), xmlLine( line ) {} std::string alias; std::set childrenHandles; std::set commands; std::string deleteCommand; std::string deletePool; std::string objTypeEnum; std::string parent; std::set secondLevelCommands; int xmlLine; // RAII data std::map::const_iterator destructorIt; std::vector::const_iterator> constructorIts; }; struct MemberData { MemberData( int line ) : xmlLine( line ) {} TypeInfo type; std::string name; std::vector arraySizes; std::string bitCount; std::vector len; bool noAutoValidity = false; std::vector optional; std::string selection; std::string selector; std::string value; std::string usedConstant; int xmlLine; }; struct PlatformData { PlatformData( std::string const & protect_ ) : protect( protect_ ) {} std::string protect; }; struct StructureAliasData { StructureAliasData( std::string const & alias_, int line ) : alias( alias_ ), xmlLine( line ) {} std::string alias; int xmlLine; }; struct StructureData { StructureData( std::vector const & extends, int line ) : structExtends( extends ), xmlLine( line ) {} bool allowDuplicate = false; bool isUnion = false; bool returnedOnly = false; bool mutualExclusiveLens = false; std::vector members; std::vector structExtends; 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::string referencedIn; }; private: void addCommand( std::string const & name, CommandData & commandData ); void addMissingFlagBits( std::vector & requireData, std::string const & referencedIn ); std::string addTitleAndProtection( std::string const & title, std::string const & strIf, std::string const & strElse = {} ) const; void appendDispatchLoaderDynamicCommands( std::vector const & requireData, std::set & listedCommands, std::string const & title, std::string & commandMembers, std::string & initialCommandAssignments, std::string & instanceCommandAssignments, std::string & deviceCommandAssignments ) const; void appendRAIIDispatcherCommands( std::vector const & requireData, std::set & 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 checkEnumCorrectness() const; void checkEnumCorrectness( std::vector const & requireData ) const; bool checkEquivalentSingularConstructor( std::vector::const_iterator> const & constructorIts, std::map::const_iterator constructorIt, std::vector::const_iterator lenIt ) const; void checkExtensionCorrectness() const; void checkFuncPointerCorrectness() const; void checkHandleCorrectness() const; void checkStructCorrectness() const; void checkStructMemberCorrectness( std::string const & structureName, std::vector const & members, std::set & sTypeValues ) const; bool containsArray( std::string const & type ) const; bool containsUnion( std::string const & type ) const; std::vector determineConstPointerParamIndices( std::vector const & params ) const; size_t determineDefaultStartIndex( std::vector const & params, std::set const & skippedParams ) const; size_t determineInitialSkipCount( std::string const & command ) const; std::vector determineNonConstPointerParamIndices( std::vector const & params ) const; std::vector::const_iterator> determineRAIIHandleConstructors( std::string const & handleType, std::map::const_iterator destructorIt, std::set & specialFunctions ) const; std::map::const_iterator determineRAIIHandleDestructor( std::string const & handleType ) const; std::set determineSkippedParams( std::vector const & params, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & returnParamIndex, bool singular ) const; std::string determineSubStruct( std::pair const & structure ) const; std::map determineVectorParamIndices( std::vector const & params ) const; void distributeSecondLevelCommands( std::set const & specialFunctions ); std::string findBaseName( std::string aliasName, std::map const & aliases ) const; std::string generateArgumentEnhancedConstPointer( ParamData const & param, bool definition, bool withAllocators, #if !defined( NDEBUG ) bool withDispatcher, #endif bool & hasDefaultAssignment ) const; std::string generateArgumentListEnhanced( std::vector const & params, std::set const & skippedParams, std::set const & singularParams, bool definition, bool withAllocators, bool structureChain, bool withDispatcher ) const; std::string generateArgumentListStandard( std::vector const & params, std::set const & skippedParams ) const; std::string generateBitmask( std::map::const_iterator bitmaskIt ) const; std::string generateBitmasks( std::vector const & requireData, std::set & listedBitmasks, std::string const & title ) const; std::pair generateBitmaskValues( std::map::const_iterator bitmaskIt, std::map::const_iterator bitmaskBitsIt ) const; std::string generateCallArgumentsEnhanced( std::vector const & params, size_t initialSkipCount, bool nonConstPointerAsNullptr, std::set const & singularParams, bool raiiHandleMemberFunction ) const; std::string generateCallArgumentsStandard( std::string const & handle, std::vector const & params ) const; std::string generateCallArgumentEnhanced( std::vector const & params, size_t paramIndex, bool nonConstPointerAsNullptr, std::set const & singularParams, bool raiiHandleMemberFunction ) const; std::string generateCallArgumentEnhancedConstPointer( ParamData const & param, size_t paramIndex, std::set const & singularParams ) const; std::string generateCallArgumentEnhancedNonConstPointer( ParamData const & param, size_t paramIndex, bool nonConstPointerAsNullptr, std::set const & singularParams, bool raiiHandleMemberFunction ) const; std::string generateCallArgumentEnhancedValue( std::vector const & params, size_t paramIndex, std::set const & singularParams ) const; std::string generateCommand( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const; std::string generateCommandDefinitions( std::vector const & requireData, std::set & listedCommands, std::string const & title ) const; std::string generateCommandDefinitions( std::string const & command, std::string const & handle ) const; std::string generateCommandName( std::string const & vulkanCommandName, std::vector const & params, size_t initialSkipCount, std::set const & tags ) const; std::string generateCommandResult( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::map const & vectorParamIndices ) const; std::string generateCommandResultEnumerate( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::pair const & vectorParamIndices, bool withAllocators ) const; std::string generateCommandResultEnumerateTwoVectors( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::map const & vectorParamIndices, std::vector const & returnParamIndices, bool withAllocators ) const; std::string generateCommandResultEnumerateTwoVectorsDeprecated( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::map const & vectorParamIndices, bool withAllocators ) const; std::string generateCommandResultGetChain( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t nonConstPointerIndex ) const; std::string generateCommandResultGetHandleUnique( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t nonConstPointerIndex ) const; std::string generateCommandResultGetSingularAndValue( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::vector const & returnParamIndices, std::map const & vectorParamIndices ) const; std::string generateCommandResultGetTwoValues( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::vector returnParamIndices ) const; std::string generateCommandResultGetTwoVectors( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::map const & vectorParamIndices ) const; std::string generateCommandResultGetValue( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParamIndex ) const; std::string generateCommandResultGetValueDeprecated( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::map const & vectorParamIndices, size_t returnParamIndex ) const; std::string generateCommandResultGetVector( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::map const & vectorParamIndices, size_t returnParamIndex ) const; std::string generateCommandResultGetVectorAndValue( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::map const & vectorParamIndices, std::vector const & returnParamIndex, bool withAllocator ) const; std::string generateCommandResultGetVectorDeprecated( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::map const & vectorParamIndices, size_t returnParamIndex ) const; std::string generateCommandResultGetVectorOfHandles( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::map const & vectorParamIndices, size_t returnParamIndex, bool withAllocator ) const; std::string generateCommandResultGetVectorOfHandlesSingular( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::map const & vectorParamIndices, size_t returnParamIndex ) const; std::string generateCommandResultGetVectorOfHandlesUnique( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::map const & vectorParamIndices, size_t returnParamIndex, bool withAllocator ) const; std::string generateCommandResultGetVectorOfHandlesUniqueSingular( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::map const & vectorParamIndices, size_t returnParamIndex ) const; std::string generateCommandResultGetVectorOfVoidSingular( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::map const & vectorParamIndices, size_t returnParamIndex ) const; std::string generateCommandResultMultiSuccessNoErrors( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const; std::string generateCommandResultMultiSuccessWithErrors( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const; std::string generateCommandResultMultiSuccessWithErrors0Return( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const; std::string generateCommandResultMultiSuccessWithErrors1Return( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParamIndex ) const; std::string generateCommandResultMultiSuccessWithErrors2Return( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::vector const & returnParamIndices ) const; std::string generateCommandResultMultiSuccessWithErrors3Return( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::vector const & returnParamIndices ) const; std::string generateCommandResultSingleSuccessNoErrors( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const; std::string generateCommandResultSingleSuccessWithErrors( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const; std::string generateCommandResultSingleSuccessWithErrors0Return( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const; std::string generateCommandResultSingleSuccessWithErrors1Return( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParamIndex ) const; std::string generateCommandResultSingleSuccessWithErrors1ReturnChain( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParamIndex ) const; std::string generateCommandResultSingleSuccessWithErrors1ReturnHandle( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParamIndex ) const; std::string generateCommandResultSingleSuccessWithErrors1ReturnHandle0Vector( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParamIndex ) const; std::string generateCommandResultSingleSuccessWithErrors1ReturnHandle1Vector( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParamIndex, std::pair const & vectorParamIndex ) const; std::string generateCommandResultSingleSuccessWithErrors1ReturnHandle2Vector( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParamIndex, std::map const & vectorParamIndices ) const; std::string generateCommandResultSingleSuccessWithErrors1ReturnValue( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParamIndex ) const; std::string generateCommandResultSingleSuccessWithErrors1ReturnVoid( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParamIndex ) const; std::string generateCommandResultSingleSuccessWithErrors2Return( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::vector const & returnParamIndices ) const; std::string generateCommandSetStandard( std::string const & standard ) const; std::string generateCommandSetStandardEnhanced( bool definition, std::string const & standard, std::string const & enhanced ) const; std::string generateCommandSetStandardEnhancedChained( bool definition, std::string const & standard, std::string const & enhanced, std::string const & enhancedChained ) const; std::string generateCommandSetStandardEnhancedSingularDeprecated( bool definition, std::string const & standard, std::string const & enhancedDeprecated, std::string const & enhanced, std::string const & enhancedSingular ) const; std::string generateCommandSetStandardEnhancedUnique( bool definition, std::string const & standard, std::string const & enhanced, std::string const & enhancedUnique ) const; std::string generateCommandSetStandardEnhancedWithAllocator( bool definition, std::string const & standard, std::string const & enhanced, std::string const & enhancedWithAllocator ) const; std::string generateCommandSetStandardEnhancedWithAllocatorChained( bool definition, std::string const & standard, std::string const & enhanced, std::string const & enhancedWithAllocator, std::string const & enhancedChained, std::string const & enhancedChainedWithAllocator ) const; std::string generateCommandSetStandardEnhancedWithAllocatorSingularDeprecated( bool definition, std::string const & standard, std::string const & enhancedDeprecated, std::string const & enhanced, std::string const & enhancedWithAllocator, std::string const & enhancedSingular ) const; std::string generateCommandSetStandardEnhancedWithAllocatorDeprecated2( bool definition, std::string const & standard, std::string const & enhancedDeprecated, std::string const & enhancedWithAllocatorDeprecated, std::string const & enhanced, std::string const & enhancedWithAllocator ) const; std::string generateCommandSetStandardEnhancedWithAllocatorSingularUnique( bool definition, std::string const & standard, std::string const & enhanced, std::string const & enhancedWithAllocator, std::string const & enhancedSingular, std::string const & enhancedUnique, std::string const & enhancedUniqueWithAllocator, std::string const & enhancedUniqueSingular ) const; std::string generateCommandSetStandardEnhancedWithAllocatorUnique( bool definition, std::string const & standard, std::string const & enhanced, std::string const & enhancedWithAllocator, std::string const & enhancedUnique, std::string const & enhancedUniqueWithAllocator ) const; std::string generateCommandSetStandardOrEnhanced( std::string const & standard, std::string const & enhanced ) const; std::string generateCommandStandard( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const; std::string generateCommandType( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const; std::string generateCommandValue( 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, std::map const & vectorParamIndices ) const; std::string generateCommandVoid0Return( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition ) const; std::string generateCommandVoid1Return( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t returnParamIndex ) const; std::string generateCommandVoid2Return( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::vector const & returnParamIndices ) const; std::string generateCommandVoidEnumerate( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::pair const & vectorParamIndex, std::vector const & returnParamIndices, bool withAllocators ) const; std::string generateCommandVoidEnumerateChained( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::pair const & vectorParamIndex, std::vector const & returnParamIndices, bool withAllocators ) const; std::string generateCommandVoidGetChain( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, size_t nonConstPointerIndex ) const; std::string generateCommandVoidGetValue( std::string const & name, CommandData const & commandData, size_t initialSkipCount, bool definition, std::map const & vectorParamIndices, size_t returnParamIndex ) const; std::string generateConstexprString( std::pair const & structData, bool assignmentOperator ) const; std::string generateDestroyCommand( std::string const & name, CommandData const & commandData ) const; std::string generateDispatchLoaderDynamicCommandAssignment( std::string const & commandName, CommandData const & commandData, std::string const & firstArg ) const; std::string generateDispatchLoaderStaticCommands( std::vector const & requireData, std::set & listedCommands, std::string const & title ) const; std::string generateEnhancedReturnType( CommandData const & commandData, size_t returnParamIndex, bool isStructureChain ) const; std::string generateEnum( std::pair const & enumData ) const; std::string generateEnums( std::vector const & requireData, std::set & listedEnums, std::string const & title ) const; std::string generateEnumInitializer( TypeInfo const & type, std::vector const & arraySizes, std::vector const & values, bool bitmask ) const; std::string generateEnumToString( std::pair const & enumData ) const; std::string generateFailureCheck( std::vector const & successCodes ) const; std::string generateFunctionBodyEnhanced( std::string const & name, CommandData const & commandData, size_t initialSkipCount, size_t returnParamIndex, size_t templateParamIndex, std::map const & vectorParamIndices, bool twoStep, std::string const & enhancedReturnType, bool withAllocator ) const; std::string generateFunctionBodyEnhancedLocalReturnVariable( CommandData const & commandData, size_t returnParamIndex, std::string const & enhancedReturnType, bool withAllocator ) const; std::string generateFunctionBodyEnhancedMultiVectorSizeCheck( std::string const & name, CommandData const & commandData, size_t initialSkipCount, size_t returnParamIndex, std::map const & vectorParamIndices ) const; std::string generateFunctionBodyEnhancedReturnResultValue( std::string const & returnName, std::string const & name, CommandData const & commandData, size_t initialSkipCount, size_t returnParamIndex, bool twoStep ) const; std::string generateFunctionBodyEnhancedSingleStep( std::string const & name, CommandData const & commandData, size_t returnParamIndex, size_t templateParamIndex, std::map const & vectorParamIndices ) const; std::string generateFunctionBodyEnhancedTwoStep( std::string const & name, CommandData const & commandData, size_t returnParamIndex, size_t templateParamIndex, std::map const & vectorParamIndices, std::string const & returnName ) const; std::string generateFunctionHeaderArgumentsEnhanced( CommandData const & commandData, size_t returnParamIndex, size_t templateParamIndex, size_t initialSkipCount, std::map const & vectorParamIndices, bool withDefaults, bool withAllocator ) const; std::string generateFunctionCall( std::string const & name, CommandData const & commandData, size_t returnParamIndex, size_t templateParamIndex, std::map const & vectorParamIndices, bool twoStep, bool firstCall ) const; std::string generateFunctionHeaderArgumentEnhanced( ParamData const & param, size_t paramIndex, std::map const & vectorParamIndices, bool skip, bool isTemplateParam ) const; std::string generateFunctionHeaderArgumentEnhancedVector( ParamData const & param, std::string const & strippedParameterName, bool hasSizeParam, bool isTemplateParam ) const; std::string generateFunctionPointerCheck( std::string const & function, std::string const & referencedIn ) const; std::string generateHandle( std::pair const & handle, std::set & listedHandles ) const; std::string generateHandleCommandDeclarations( std::set const & commands ) const; std::string generateHandleDependencies( std::pair const & handle, std::set & listedHandles ) const; std::string generateHandleEmpty( HandleData const & handleData ) const; std::string generateHashStructures( std::vector const & requireData, std::string const & title ) const; std::string generateLenInitializer( std::vector::const_iterator mit, std::map::const_iterator, std::vector::const_iterator>>::const_iterator litit, bool mutualExclusiveLens ) const; std::string generateName( TypeInfo const & typeInfo ) const; std::pair generateProtection( std::string const & referencedIn, std::string const & protect ) const; std::pair generateProtection( std::string const & type, bool isAliased ) const; std::string generateRAIICommandDefinitions( std::vector const & requireData, std::set & listedCommands, std::string const & title ) const; std::string generateRAIIHandle( std::pair const & handle, std::set & listedHandles, std::set const & specialFunctions ) const; std::string generateRAIIHandleCommand( std::string const & command, size_t initialSkipCount, std::set const & specialFunctions, bool definition ) const; std::string generateRAIIHandleCommandDeclarations( std::pair const & handle, std::set const & specialFunctions ) const; std::string generateRAIIHandleCommandResult( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition ) const; std::string generateRAIIHandleCommandResultMultiSuccessNoErrors( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition ) const; std::string generateRAIIHandleCommandResultMultiSuccessNoErrors0Return( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, bool definition ) const; std::string generateRAIIHandleCommandResultMultiSuccessWithErrors( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition ) const; std::string generateRAIIHandleCommandResultMultiSuccessWithErrors0Return( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, bool definition ) const; std::string generateRAIIHandleCommandResultMultiSuccessWithErrors1Return( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition, size_t returnParamIndex ) const; std::string generateRAIIHandleCommandResultMultiSuccessWithErrors1ReturnValue( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & nonConstPointerParamIndices, bool definition ) const; std::string generateRAIIHandleCommandResultMultiSuccessWithErrors1ReturnVoidSingular( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & nonConstPointerParamIndices, bool definition ) const; std::string generateRAIIHandleCommandResultMultiSuccessWithErrors1ReturnVoidVector( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & nonConstPointerParamIndices, bool definition ) const; std::string generateRAIIHandleCommandResultMultiSuccessWithErrors2Return( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition, std::vector const & returnParamIndices ) const; std::string generateRAIIHandleCommandResultMultiSuccessWithErrors2Return1VectorEnumerate( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & nonConstPointerParamIndices, bool definition ) const; std::string generateRAIIHandleCommandResultMultiSuccessWithErrors3Return( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition, std::vector const & returnParamIndices ) const; std::string generateRAIIHandleCommandResultMultiSuccessWithErrors3Return2VectorEnumerate( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & nonConstPointerParamIndices, bool definition ) const; std::string generateRAIIHandleCommandResultSingleSuccessNoErrors( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition ) const; std::string generateRAIIHandleCommandResultSingleSuccessNoErrors0Return( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, bool definition ) const; std::string generateRAIIHandleCommandResultSingleSuccessWithErrors( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition ) const; std::string generateRAIIHandleCommandResultSingleSuccessWithErrors0Return( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, bool definition ) const; std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnChain( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & nonConstPointerParamIndices, bool definition ) const; std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1Return( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition, size_t returnParamIndex ) const; std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnValue( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & nonConstPointerParamIndices, bool definition ) const; std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidSingular( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & nonConstPointerParamIndices, bool definition ) const; std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidVector( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & nonConstPointerParamIndices, bool definition ) const; std::string generateRAIIHandleCommandResultSingleSuccessWithErrors2Return( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition, std::vector const & returnParamIndices ) const; std::string generateRAIIHandleCommandResultSingleSuccessWithErrors2ReturnValueSingularValue( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition, std::vector const & returnParamIndices, std::map const & vectorParamIndices ) const; std::string generateRAIIHandleCommandResultSingleSuccessWithErrors2ReturnValueVectorValue( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & nonConstPointerParamIndices, bool definition ) const; std::string generateRAIIHandleCommandValue( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition ) const; std::string generateRAIIHandleCommandValue0Return0VectorType( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, bool definition ) const; std::string generateRAIIHandleCommandValue0Return0VectorVkType( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, bool definition ) const; std::string generateRAIIHandleCommandVoid( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition ) const; std::string generateRAIIHandleCommandVoid0Return( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition ) const; std::string generateRAIIHandleCommandVoid1ReturnChain( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & nonConstPointerParamIndices, bool definition ) const; std::string generateRAIIHandleCommandVoid1ReturnValue( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & nonConstPointerParamIndices, bool definition ) const; std::string generateRAIIHandleCommandVoid2ReturnEnumerateChain( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & nonConstPointerParamIndices, bool definition ) const; std::string generateRAIIHandleCommandVoid2ReturnEnumerateValue( std::map::const_iterator commandIt, size_t initialSkipCount, std::map const & vectorParamIndices, std::vector const & nonConstPointerParamIndices, bool definition ) const; std::pair generateRAIIHandleConstructor( std::pair const & handle, std::map::const_iterator constructorIt, std::string const & enter, std::string const & leave ) const; std::pair generateRAIIHandleConstructor1Return2Vector( std::pair const & handle, std::map::const_iterator constructorIt, std::string const & enter, std::string const & leave, size_t returnParamIndex, std::map const & vectorParamIndices ) const; std::pair generateRAIIHandleConstructors( std::pair const & handle ) const; std::string generateRAIIHandleConstructorArguments( std::string const & handleType, std::vector const & params, bool singular, bool encounteredArgument ) const; std::string generateRAIIHandleConstructorCallArguments( std::string const & handleType, std::vector const & params, bool nonConstPointerAsNullptr, std::set const & singularParams, bool allocatorIsMemberVariable ) const; std::string generateRAIIHandleConstructorEnumerate( std::pair const & handle, std::map::const_iterator constructorIt, std::vector::const_iterator handleParamIt, std::vector::const_iterator lenParamIt, std::string const & enter, std::string const & leave ) const; std::string generateRAIIHandleConstructorInitializationList( std::string const & handleType, std::map::const_iterator constructorIt, std::map::const_iterator destructorIt, bool hasSecondLevelCommands ) const; std::string generateRAIIHandleConstructorResult( std::pair const & handle, std::map::const_iterator constructorIt, std::string const & enter, std::string const & leave ) const; std::string generateRAIIHandleConstructorTakeOwnership( std::pair const & handle ) const; std::string generateRAIIHandleConstructorVector( std::pair const & handle, std::map::const_iterator constructorIt, std::vector::const_iterator handleParamIt, std::string const & enter, std::string const & leave ) const; std::string generateRAIIHandleConstructorVectorSingular( std::pair const & handle, std::map::const_iterator constructorIt, std::vector::const_iterator handleParamIt, std::string const & enter, std::string const & leave ) const; std::string generateRAIIHandleConstructorVoid( std::pair const & handle, std::map::const_iterator constructorIt, std::string const & enter, std::string const & leave ) const; std::string generateRAIIHandleContext( std::pair const & handle, std::set const & specialFunctions ) const; std::pair generateRAIIHandleDestructor( std::string const & handleType, std::map::const_iterator destructorIt, std::string const & enter ) const; std::string generateRAIIHandleDestructorCallArguments( std::string const & handleType, std::vector const & params ) const; std::tuple generateRAIIHandleDetails( std::pair const & handle, std::string const & destructorCall ) const; std::string generateRAIIHandleSingularConstructorArguments( std::pair const & handle, std::map::const_iterator constructorIt ) const; std::string generateRAIIHandleUpgradeConstructor( std::pair const & handle ) const; std::string generateRAIIHandleVectorSizeCheck( std::string const & name, CommandData const & commandData, size_t initialSkipCount, std::map> const & countToVectorMap, std::set const & skippedParams ) const; std::string generateSizeCheck( std::vector::const_iterator> const & arrayIts, std::string const & structName, std::string const & prefix, bool mutualExclusiveLens ) const; std::string generateStruct( std::pair const & structure, std::set & listedStructs ) const; std::string generateStructAssignmentOperators( std::pair const & structure ) const; std::string generateStructCompareOperators( std::pair const & structure ) const; std::string generateStructConstructors( std::pair const & structData ) const; std::string generateStructConstructorsEnhanced( std::pair const & structData ) const; std::string generateStructConstructorArgument( bool listedArgument, MemberData const & memberData, bool withDefault ) const; std::string generateStructure( std::pair const & structure ) const; std::string generateStructExtendsStructs( std::vector const & requireData, std::set & listedStructs, std::string const & title ) const; std::string generateStructForwardDeclarations( std::vector const & requireData, std::string const & title ) const; std::pair generateStructMembers( std::pair const & structData, std::string const & prefix ) const; std::string generateStructSetter( std::string const & structureName, std::vector const & memberData, size_t index ) const; std::string generateStructSubConstructor( std::pair const & structData ) const; std::string generateSuccessCheck( std::vector const & successCodes ) const; std::string generateSuccessCodeList( std::vector const & successCodes ) const; std::string generateUnion( std::pair const & structure ) const; std::string generateUniqueTypes( std::string const & parentType, std::set const & childrenTypes ) const; std::string generateVectorSizeCheck( std::string const & name, CommandData const & commandData, size_t initialSkipCount, std::map> const & countToVectorMap, std::set const & skippedParams ) const; std::string getPlatform( std::string const & title ) const; std::pair getPoolTypeAndName( std::string const & type ) const; std::string getVectorSize( std::vector const & params, std::map const & vectorParamIndices, size_t returnParamIndex ) const; bool hasParentHandle( std::string const & handle, std::string const & parent ) const; bool isDeviceCommand( CommandData const & commandData ) const; bool isHandleType( std::string const & type ) const; bool isLenByStructMember( std::string const & name, std::vector const & params ) const; bool isLenByStructMember( std::string const & name, ParamData const & param ) const; bool isMultiSuccessCodeConstructor( std::vector::const_iterator> const & constructorIts ) const; bool isParam( std::string const & name, std::vector const & params ) const; bool isStructureChainAnchor( std::string const & type ) const; std::pair>> needsVectorSizeCheck( std::map const & vectorParamIndices ) const; void readCommands( tinyxml2::XMLElement const * element ); void readCommandsCommand( tinyxml2::XMLElement const * element ); ParamData readCommandsCommandParam( tinyxml2::XMLElement const * element, std::vector const & params ); std::pair readCommandsCommandProto( tinyxml2::XMLElement const * element ); std::string readComment( tinyxml2::XMLElement const * element ); void readEnums( tinyxml2::XMLElement const * element ); void readEnumsConstant( tinyxml2::XMLElement const * element ); void readEnumsEnum( tinyxml2::XMLElement const * element, std::map::iterator enumIt ); void readExtensions( tinyxml2::XMLElement const * element ); void readExtensionsExtension( tinyxml2::XMLElement const * element ); void readExtensionsExtensionDisabledRequire( tinyxml2::XMLElement const * element ); void readExtensionsExtensionDisabledRequireCommand( tinyxml2::XMLElement const * element ); void readExtensionsExtensionDisabledRequireType( tinyxml2::XMLElement const * element ); void readExtensionsExtensionRequire( tinyxml2::XMLElement const * element, std::map::iterator extensionIt ); void readExtensionsExtensionRequireCommand( tinyxml2::XMLElement const * element, std::string const & extensionName, RequireData & requireData ); void readExtensionsExtensionRequireType( tinyxml2::XMLElement const * element, std::string const & extensionName, RequireData & requireData ); void readFeature( tinyxml2::XMLElement const * element ); void readFeatureRequire( tinyxml2::XMLElement const * element, std::map::iterator featureIt ); void readFeatureRequireCommand( tinyxml2::XMLElement const * element, std::map::iterator featureIt, RequireData & requireData ); void readFeatureRequireType( tinyxml2::XMLElement const * element, std::map::iterator featureIt, RequireData & requireData ); std::pair readNameAndType( tinyxml2::XMLElement const * elements ); void readPlatforms( tinyxml2::XMLElement const * element ); void readPlatformsPlatform( tinyxml2::XMLElement const * element ); void readRegistry( tinyxml2::XMLElement const * element ); void readRequireEnum( tinyxml2::XMLElement const * element, std::string const & extensionName ); void readSPIRVCapabilities( tinyxml2::XMLElement const * element ); void readSPIRVCapabilitiesSPIRVCapability( tinyxml2::XMLElement const * element ); void readSPIRVCapabilitiesSPIRVCapabilityEnable( tinyxml2::XMLElement const * element ); void readSPIRVCapabilitiesSPIRVCapabilityEnableExtension( int xmlLine, std::map const & attributes ); void readSPIRVCapabilitiesSPIRVCapabilityEnableProperty( int xmlLine, std::map const & attributes ); void readSPIRVCapabilitiesSPIRVCapabilityEnableStruct( int xmlLine, std::map const & attributes ); void readSPIRVCapabilitiesSPIRVCapabilityEnableVersion( int xmlLine, std::map const & attributes ); void readSPIRVExtensions( tinyxml2::XMLElement const * element ); void readSPIRVExtensionsExtension( tinyxml2::XMLElement const * element ); void readSPIRVExtensionsExtensionEnable( tinyxml2::XMLElement const * element ); void readTags( tinyxml2::XMLElement const * element ); void readTagsTag( tinyxml2::XMLElement const * element ); void readTypes( tinyxml2::XMLElement const * element ); void readTypesType( tinyxml2::XMLElement const * element ); void readTypesTypeBasetype( tinyxml2::XMLElement const * element, std::map const & attributes ); void readTypesTypeBitmask( tinyxml2::XMLElement const * element, std::map const & attributes ); void readTypesTypeDefine( tinyxml2::XMLElement const * element, std::map const & attributes ); void readTypesTypeEnum( tinyxml2::XMLElement const * element, std::map const & attributes ); void readTypesTypeFuncpointer( tinyxml2::XMLElement const * element, std::map const & attributes ); void readTypesTypeHandle( tinyxml2::XMLElement const * element, std::map const & attributes ); void readTypesTypeInclude( tinyxml2::XMLElement const * element, std::map const & attributes ); void readTypesTypeRequires( tinyxml2::XMLElement const * element, std::map const & attributes ); void readTypesTypeStruct( tinyxml2::XMLElement const * element, bool isUnion, std::map const & attributes ); void readTypesTypeStructMember( tinyxml2::XMLElement const * element, std::vector & members, bool isUnion ); void readTypesTypeStructMemberEnum( tinyxml2::XMLElement const * element, MemberData & memberData ); void readTypesTypeStructMemberName( tinyxml2::XMLElement const * element, MemberData & memberData, std::vector const & members ); void readTypesTypeStructMemberType( tinyxml2::XMLElement const * element, MemberData & memberData ); TypeInfo readTypeInfo( tinyxml2::XMLElement const * element ) const; void registerDeleter( std::string const & name, std::pair const & commandData ); void rescheduleRAIIHandle( std::string & str, std::pair const & handle, std::set & listedHandles, std::set const & specialFunctions ) const; std::vector selectCommandsByHandle( std::vector const & requireData, std::set const & handleCommands, std::set & listedCommands ) const; void setVulkanLicenseHeader( int line, std::string const & comment ); std::string toString( TypeCategory category ); private: std::map m_baseTypes; std::map m_bitmasks; std::map m_commands; std::map m_constants; std::set m_defines; std::map m_enums; std::set m_extendedStructs; // structs which are referenced by the structextends tag std::map m_extensions; std::map::const_iterator> m_extensionsByNumber; std::map m_features; std::map m_funcPointers; std::map m_handles; std::set m_includes; std::map m_platforms; std::set m_RAIISpecialFunctions; std::map m_structures; std::map m_structureAliases; std::map> m_structureAliasesInverse; std::set m_tags; std::map m_types; std::string m_typesafeCheck; std::string m_version; std::string m_vulkanLicenseHeader; }; const size_t INVALID_INDEX = (size_t)~0;