Add support for multiple top-level tags <types>, <commands>, and <extensions> (#1959)
Some checks failed
Set Version Tag / set-version-tag (push) Has been cancelled

This commit is contained in:
Andreas Süßenbach 2024-09-17 15:03:34 +02:00 committed by GitHub
parent 4e6e8d3fda
commit e12c05d628
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 418 additions and 269 deletions

File diff suppressed because it is too large Load Diff

View File

@ -114,7 +114,7 @@ public:
}; };
private: private:
struct AliasData struct NameLine
{ {
std::string name = {}; std::string name = {};
int xmlLine = {}; int xmlLine = {};
@ -145,14 +145,14 @@ private:
struct EnumValueData struct EnumValueData
{ {
std::map<std::string, int> aliases = {}; std::map<std::string, int> aliases = {};
std::string bitpos = {}; std::string bitpos = {};
bool deprecated = {}; bool deprecated = {};
std::string name = {}; std::string name = {};
std::string protect = {}; std::string protect = {};
bool supported = {}; bool supported = {};
std::string value = {}; std::string value = {};
int xmlLine = {}; int xmlLine = {};
}; };
struct EnumData struct EnumData
@ -174,6 +174,17 @@ private:
int xmlLine = {}; 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 struct NameData
{ {
std::string name = {}; std::string name = {};
@ -247,31 +258,32 @@ private:
struct RequireData struct RequireData
{ {
std::string depends = {}; std::string depends = {};
std::vector<std::pair<std::string, int>> commands = {}; std::vector<NameLine> commands = {};
std::map<std::string, std::string> enumConstants = {}; std::map<std::string, std::string> enumConstants = {};
std::vector<std::string> constants = {}; std::vector<std::string> constants = {};
std::vector<RequireFeature> features = {}; std::vector<RequireFeature> features = {};
std::vector<std::string> types = {}; std::vector<NameLine> types = {};
int xmlLine = {}; int xmlLine = {};
}; };
struct ExtensionData struct ExtensionData
{ {
std::string deprecatedBy = {}; std::string deprecatedBy = {};
bool isDeprecated = false; bool isDeprecated = false;
std::string name = {}; std::string name = {};
std::string number = {}; std::string number = {};
std::string obsoletedBy = {}; std::string obsoletedBy = {};
std::string platform = {}; std::string platform = {};
std::string promotedTo = {}; std::string promotedTo = {};
std::map<std::string, std::vector<std::vector<std::string>>> depends = {}; std::map<std::string, std::vector<std::vector<std::string>>> depends = {};
std::vector<std::string> ratified = {}; std::vector<std::string> ratified = {};
std::vector<RemoveData> removeData = {}; std::vector<RemoveData> removeData = {};
std::vector<RequireData> requireData = {}; std::vector<RequireData> requireData = {};
std::vector<std::string> supported = {}; std::vector<std::string> supported = {};
std::string type = {}; std::string type = {};
int xmlLine = 0; std::vector<RequireData> unsupportedRequireData = {};
int xmlLine = 0;
}; };
struct FeatureData struct FeatureData
@ -377,6 +389,12 @@ private:
int xmlLine = {}; 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 struct StructureData
{ {
std::map<std::string, int> aliases = {}; std::map<std::string, int> aliases = {};
@ -503,6 +521,7 @@ private:
void checkFeatureCorrectness() const; void checkFeatureCorrectness() const;
void checkFuncPointerCorrectness() const; void checkFuncPointerCorrectness() const;
void checkHandleCorrectness() const; void checkHandleCorrectness() const;
void checkSpirVCapabilityCorrectness() const;
void checkStructCorrectness() const; void checkStructCorrectness() const;
void checkStructMemberCorrectness( std::string const & structureName, std::vector<MemberData> const & members, std::set<std::string> & sTypeValues ) const; void checkStructMemberCorrectness( std::string const & structureName, std::vector<MemberData> const & members, std::set<std::string> & sTypeValues ) const;
std::string combineDataTypes( std::map<size_t, VectorParamData> const & vectorParams, std::string combineDataTypes( std::map<size_t, VectorParamData> const & vectorParams,
@ -530,43 +549,46 @@ private:
std::vector<std::map<std::string, CommandData>::const_iterator> std::vector<std::map<std::string, CommandData>::const_iterator>
determineRAIIHandleConstructors( std::string const & handleType, std::map<std::string, CommandData>::const_iterator destructorIt ) const; 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::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> determineSingularParams( size_t returnParam, std::map<size_t, VectorParamData> const & vectorParams ) const;
std::set<size_t> determineSkippedParams( std::vector<ParamData> const & params, std::set<size_t> determineSkippedParams( std::vector<ParamData> const & params,
size_t initialSkipCount, size_t initialSkipCount,
std::map<size_t, VectorParamData> const & vectorParams, std::map<size_t, VectorParamData> const & vectorParams,
std::vector<size_t> const & returnParam, std::vector<size_t> const & returnParam,
bool singular ) const; bool singular ) const;
std::string determineSubStruct( std::pair<std::string, StructureData> const & structure ) 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::map<size_t, VectorParamData> determineVectorParams( std::vector<ParamData> const & params ) const;
std::set<size_t> determineVoidPointerParams( std::vector<ParamData> const & params ) const; std::set<size_t> determineVoidPointerParams( std::vector<ParamData> const & params ) const;
void distributeEnumValueAliases(); void distributeEnumExtends();
void distributeSecondLevelCommands( std::set<std::string> const & specialFunctions ); void distributeEnumValueAliases();
void distributeStructAliases(); void distributeSecondLevelCommands( std::set<std::string> const & specialFunctions );
void filterLenMembers(); void distributeRequirements();
std::map<std::string, AliasData>::const_iterator findAlias( std::string const & name, std::map<std::string, AliasData> const & aliases ) const; void distributeRequirements( std::vector<RequireData> const & requireData, std::string const & requiredBy );
std::string findBaseName( std::string aliasName, std::map<std::string, AliasData> const & aliases ) const; void distributeStructAliases();
std::vector<FeatureData>::const_iterator findFeature( std::string const & name ) const; void filterLenMembers();
std::vector<ParamData>::const_iterator findParamIt( std::string const & name, std::vector<ParamData> const & paramData ) const; std::map<std::string, NameLine>::const_iterator findAlias( std::string const & name, std::map<std::string, NameLine> const & aliases ) const;
std::vector<MemberData>::const_iterator findStructMemberIt( std::string const & name, std::vector<MemberData> const & memberData ) const; std::string findBaseName( std::string aliasName, std::map<std::string, NameLine> const & aliases ) const;
std::vector<MemberData>::const_iterator findStructMemberItByType( std::string const & type, std::vector<MemberData> const & memberData ) const; std::vector<FeatureData>::const_iterator findFeature( std::string const & name ) const;
std::vector<ExtensionData>::const_iterator findSupportedExtension( std::string const & name ) const; std::vector<ParamData>::const_iterator findParamIt( std::string const & name, std::vector<ParamData> const & paramData ) const;
std::string findTag( std::string const & name, std::string const & postfix = "" ) const; std::vector<MemberData>::const_iterator findStructMemberIt( std::string const & name, std::vector<MemberData> const & memberData ) const;
std::pair<std::string, std::string> generateAllocatorTemplates( std::vector<size_t> const & returnParams, std::vector<MemberData>::const_iterator findStructMemberItByType( std::string const & type, std::vector<MemberData> const & memberData ) const;
std::vector<std::string> const & returnDataTypes, std::vector<ExtensionData>::const_iterator findSupportedExtension( std::string const & name ) const;
std::map<size_t, VectorParamData> const & vectorParams, std::string findTag( std::string const & name, std::string const & postfix = "" ) const;
std::vector<size_t> const & chainedReturnParams, std::pair<std::string, std::string> generateAllocatorTemplates( std::vector<size_t> const & returnParams,
CommandFlavourFlags flavourFlags, std::vector<std::string> const & returnDataTypes,
bool definition ) const; std::map<size_t, VectorParamData> const & vectorParams,
std::string generateArgumentListEnhanced( std::vector<ParamData> const & params, std::vector<size_t> const & chainedReturnParams,
std::vector<size_t> const & returnParams, CommandFlavourFlags flavourFlags,
std::map<size_t, VectorParamData> const & vectorParams, bool definition ) const;
std::set<size_t> const & skippedParams, std::string generateArgumentListEnhanced( std::vector<ParamData> const & params,
std::set<size_t> const & singularParams, std::vector<size_t> const & returnParams,
std::set<size_t> const & templatedParams, std::map<size_t, VectorParamData> const & vectorParams,
std::vector<size_t> const & chainedReturnParams, std::set<size_t> const & skippedParams,
bool definition, std::set<size_t> const & singularParams,
CommandFlavourFlags flavourFlags, std::set<size_t> const & templatedParams,
bool withDispatcher ) const; 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 ) const; std::string generateArgumentListStandard( std::vector<ParamData> const & params, std::set<size_t> const & skippedParams ) const;
std::string generateArgumentTemplates( std::vector<ParamData> const & params, std::string generateArgumentTemplates( std::vector<ParamData> const & params,
std::vector<size_t> const & returnParams, std::vector<size_t> const & returnParams,
@ -1033,6 +1055,8 @@ private:
bool isSupportedFeature( std::string const & name ) const; bool isSupportedFeature( std::string const & name ) const;
bool isTypeRequired( std::string const & type ) const; bool isTypeRequired( std::string const & type ) const;
bool isTypeUsed( std::string const & type ) const; bool isTypeUsed( std::string const & type ) const;
bool isUnsupportedExtension( std::string const & name ) const;
bool isUnsupportedFeature( std::string const & name ) const;
void markExtendedStructs(); void markExtendedStructs();
bool needsStructureChainResize( std::map<size_t, VectorParamData> const & vectorParams, std::vector<size_t> const & chainedReturnParams ) const; bool needsStructureChainResize( std::map<size_t, VectorParamData> const & vectorParams, std::vector<size_t> const & chainedReturnParams ) const;
std::pair<bool, std::map<size_t, std::vector<size_t>>> needsVectorSizeCheck( std::vector<ParamData> const & params, std::pair<bool, std::map<size_t, std::vector<size_t>>> needsVectorSizeCheck( std::vector<ParamData> const & params,
@ -1063,13 +1087,13 @@ private:
void readPlatforms( tinyxml2::XMLElement const * element ); void readPlatforms( tinyxml2::XMLElement const * element );
void readRegistry( tinyxml2::XMLElement const * element ); void readRegistry( tinyxml2::XMLElement const * element );
RemoveData readRemoveData( tinyxml2::XMLElement const * element ); RemoveData readRemoveData( tinyxml2::XMLElement const * element );
std::string readRequireCommand( tinyxml2::XMLElement const * element, std::string const & requiredBy ); NameLine readRequireCommand( tinyxml2::XMLElement const * element );
void readRequireEnum( void readRequireEnum(
tinyxml2::XMLElement const * element, std::string const & requiredBy, std::string const & platform, bool supported, RequireData & requireData ); tinyxml2::XMLElement const * element, std::string const & requiredBy, std::string const & platform, bool supported, RequireData & requireData );
RequireFeature readRequireFeature( tinyxml2::XMLElement const * element ); RequireFeature readRequireFeature( tinyxml2::XMLElement const * element );
std::string readRequireType( tinyxml2::XMLElement const * element, std::string const & requiredBy ); NameLine readRequireType( tinyxml2::XMLElement const * element );
void readSPIRVCapability( tinyxml2::XMLElement const * element ); void readSPIRVCapability( tinyxml2::XMLElement const * element );
void readSPIRVCapabilityEnable( tinyxml2::XMLElement const * element ); void readSPIRVCapabilityEnable( tinyxml2::XMLElement const * element, SpirVCapabilityData & capability );
void readSPIRVCapabilities( tinyxml2::XMLElement const * element ); void readSPIRVCapabilities( tinyxml2::XMLElement const * element );
void readSPIRVExtension( tinyxml2::XMLElement const * element ); void readSPIRVExtension( tinyxml2::XMLElement const * element );
void readSPIRVExtensionEnable( tinyxml2::XMLElement const * element ); void readSPIRVExtensionEnable( tinyxml2::XMLElement const * element );
@ -1126,30 +1150,32 @@ private:
MemberData const & vectorMemberByStructure( std::string const & structureType ) const; MemberData const & vectorMemberByStructure( std::string const & structureType ) const;
private: private:
std::string m_api; std::string m_api;
std::map<std::string, BaseTypeData> m_baseTypes; std::map<std::string, BaseTypeData> m_baseTypes;
std::map<std::string, BitmaskData> m_bitmasks; std::map<std::string, BitmaskData> m_bitmasks;
std::map<std::string, CommandData> m_commands; std::map<std::string, CommandData> m_commands;
std::map<std::string, ConstantData> m_constants; std::map<std::string, ConstantData> m_constants;
std::map<std::string, DefineData> m_defines; std::map<std::string, DefineData> m_defines;
DefinesPartition m_definesPartition; // partition defined macros into mutually-exclusive sets of callees, callers, and values DefinesPartition m_definesPartition; // partition defined macros into mutually-exclusive sets of callees, callers, and values
std::map<std::string, EnumData> m_enums; std::map<std::string, std::vector<EnumExtendData>> m_enumExtends;
std::vector<ExtensionData> m_extensions; std::map<std::string, EnumData> m_enums;
std::map<std::string, ExternalTypeData> m_externalTypes; std::vector<ExtensionData> m_extensions;
std::vector<FeatureData> m_features; std::map<std::string, ExternalTypeData> m_externalTypes;
std::map<std::string, FormatData> m_formats; std::vector<FeatureData> m_features;
std::map<std::string, FuncPointerData> m_funcPointers; std::map<std::string, FormatData> m_formats;
std::map<std::string, HandleData> m_handles; std::map<std::string, FuncPointerData> m_funcPointers;
std::map<std::string, IncludeData> m_includes; std::map<std::string, HandleData> m_handles;
std::map<std::string, PlatformData> m_platforms; std::map<std::string, IncludeData> m_includes;
std::set<std::string> m_RAIISpecialFunctions; std::map<std::string, PlatformData> m_platforms;
std::map<std::string, StructureData> m_structs; std::set<std::string> m_RAIISpecialFunctions;
std::vector<std::pair<std::string, AliasData>> m_structsAliases; // temporary storage for aliases, as they might be listed before the actual struct is listed std::map<std::string, SpirVCapabilityData> m_spirVCapabilities;
std::map<std::string, TagData> m_tags; std::map<std::string, StructureData> m_structs;
std::map<std::string, TypeData> m_types; std::vector<std::pair<std::string, NameLine>> m_structsAliases; // temporary storage for aliases, as they might be listed before the actual struct is listed
std::set<std::string> m_unsupportedExtensions; std::map<std::string, TagData> m_tags;
std::set<std::string> m_unsupportedFeatures; std::map<std::string, TypeData> m_types;
std::string m_version; std::vector<ExtensionData> m_unsupportedExtensions;
std::vector<VideoCodec> m_videoCodecs; std::vector<FeatureData> m_unsupportedFeatures;
std::string m_vulkanLicenseHeader; std::string m_version;
std::vector<VideoCodec> m_videoCodecs;
std::string m_vulkanLicenseHeader;
}; };