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 = {};
@ -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 = {};
@ -248,11 +259,11 @@ 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 = {};
}; };
@ -271,6 +282,7 @@ private:
std::vector<RequireData> requireData = {}; std::vector<RequireData> requireData = {};
std::vector<std::string> supported = {}; std::vector<std::string> supported = {};
std::string type = {}; std::string type = {};
std::vector<RequireData> unsupportedRequireData = {};
int xmlLine = 0; int xmlLine = 0;
}; };
@ -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,
@ -539,12 +558,15 @@ private:
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 distributeEnumExtends();
void distributeEnumValueAliases(); void distributeEnumValueAliases();
void distributeSecondLevelCommands( std::set<std::string> const & specialFunctions ); void distributeSecondLevelCommands( std::set<std::string> const & specialFunctions );
void distributeRequirements();
void distributeRequirements( std::vector<RequireData> const & requireData, std::string const & requiredBy );
void distributeStructAliases(); void distributeStructAliases();
void filterLenMembers(); void filterLenMembers();
std::map<std::string, AliasData>::const_iterator findAlias( std::string const & name, std::map<std::string, AliasData> const & aliases ) const; 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, AliasData> 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<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<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 findStructMemberIt( std::string const & name, std::vector<MemberData> const & memberData ) const;
@ -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 );
@ -1133,6 +1157,7 @@ private:
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, std::vector<EnumExtendData>> m_enumExtends;
std::map<std::string, EnumData> m_enums; std::map<std::string, EnumData> m_enums;
std::vector<ExtensionData> m_extensions; std::vector<ExtensionData> m_extensions;
std::map<std::string, ExternalTypeData> m_externalTypes; std::map<std::string, ExternalTypeData> m_externalTypes;
@ -1143,12 +1168,13 @@ private:
std::map<std::string, IncludeData> m_includes; std::map<std::string, IncludeData> m_includes;
std::map<std::string, PlatformData> m_platforms; std::map<std::string, PlatformData> m_platforms;
std::set<std::string> m_RAIISpecialFunctions; std::set<std::string> m_RAIISpecialFunctions;
std::map<std::string, SpirVCapabilityData> m_spirVCapabilities;
std::map<std::string, StructureData> m_structs; std::map<std::string, StructureData> m_structs;
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::vector<std::pair<std::string, NameLine>> m_structsAliases; // temporary storage for aliases, as they might be listed before the actual struct is listed
std::map<std::string, TagData> m_tags; std::map<std::string, TagData> m_tags;
std::map<std::string, TypeData> m_types; std::map<std::string, TypeData> m_types;
std::set<std::string> m_unsupportedExtensions; std::vector<ExtensionData> m_unsupportedExtensions;
std::set<std::string> m_unsupportedFeatures; std::vector<FeatureData> m_unsupportedFeatures;
std::string m_version; std::string m_version;
std::vector<VideoCodec> m_videoCodecs; std::vector<VideoCodec> m_videoCodecs;
std::string m_vulkanLicenseHeader; std::string m_vulkanLicenseHeader;