mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Simplify handling of structextends (#1866)
This commit is contained in:
parent
c1fb25264d
commit
2518f528c0
@ -12531,7 +12531,7 @@ bool VulkanHppGenerator::isStructureChainAnchor( std::string const & type ) cons
|
|||||||
auto it = findByNameOrAlias( m_structs, type );
|
auto it = findByNameOrAlias( m_structs, type );
|
||||||
if ( it != m_structs.end() )
|
if ( it != m_structs.end() )
|
||||||
{
|
{
|
||||||
return m_extendedStructs.contains( it->first );
|
return it->second.isExtended;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -12605,6 +12605,19 @@ bool VulkanHppGenerator::isTypeUsed( std::string const & type ) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VulkanHppGenerator::markExtendedStructs()
|
||||||
|
{
|
||||||
|
for (auto const& s : m_structs)
|
||||||
|
{
|
||||||
|
for (auto const& extends : s.second.structExtends)
|
||||||
|
{
|
||||||
|
auto structIt = m_structs.find( extends );
|
||||||
|
checkForError( structIt != m_structs.end(), s.second.xmlLine, "struct <" + s.first + "> extends unknown struct <" + extends + ">" );
|
||||||
|
structIt->second.isExtended = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool VulkanHppGenerator::needsStructureChainResize( std::map<size_t, VectorParamData> const & vectorParams,
|
bool VulkanHppGenerator::needsStructureChainResize( std::map<size_t, VectorParamData> const & vectorParams,
|
||||||
std::vector<size_t> const & chainedReturnParams ) const
|
std::vector<size_t> const & chainedReturnParams ) const
|
||||||
{
|
{
|
||||||
@ -13760,6 +13773,7 @@ void VulkanHppGenerator::readRegistry( tinyxml2::XMLElement const * element )
|
|||||||
else if ( value == "types" )
|
else if ( value == "types" )
|
||||||
{
|
{
|
||||||
readTypes( child );
|
readTypes( child );
|
||||||
|
markExtendedStructs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14954,7 +14968,6 @@ void VulkanHppGenerator::readTypeStruct( tinyxml2::XMLElement const * element, b
|
|||||||
checkForError( m_types.insert( { name, TypeData{ TypeCategory::Struct, {}, line } } ).second, line, "struct <" + name + "> already specified" );
|
checkForError( m_types.insert( { name, TypeData{ TypeCategory::Struct, {}, line } } ).second, line, "struct <" + name + "> already specified" );
|
||||||
checkForError( m_structsAliases.insert( { name, { alias, line } } ).second, line, "struct alias <" + name + "> already listed" );
|
checkForError( m_structsAliases.insert( { name, { alias, line } } ).second, line, "struct alias <" + name + "> already listed" );
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
checkAttributes( line,
|
checkAttributes( line,
|
||||||
@ -15075,8 +15088,6 @@ void VulkanHppGenerator::readTypeStruct( tinyxml2::XMLElement const * element, b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_extendedStructs.insert( structureData.structExtends.begin(), structureData.structExtends.end() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,6 +366,7 @@ private:
|
|||||||
{
|
{
|
||||||
std::map<std::string, int> aliases = {};
|
std::map<std::string, int> aliases = {};
|
||||||
bool allowDuplicate = {};
|
bool allowDuplicate = {};
|
||||||
|
bool isExtended = {};
|
||||||
bool isUnion = {};
|
bool isUnion = {};
|
||||||
bool returnedOnly = {};
|
bool returnedOnly = {};
|
||||||
bool mutualExclusiveLens = {};
|
bool mutualExclusiveLens = {};
|
||||||
@ -953,6 +954,7 @@ 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;
|
||||||
|
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,
|
||||||
std::map<size_t, VectorParamData> const & vectorParams,
|
std::map<size_t, VectorParamData> const & vectorParams,
|
||||||
@ -1042,7 +1044,6 @@ private:
|
|||||||
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, EnumData> m_enums;
|
||||||
std::set<std::string> m_extendedStructs; // structs which are referenced by the structextends tag
|
|
||||||
std::vector<ExtensionData> m_extensions;
|
std::vector<ExtensionData> m_extensions;
|
||||||
std::map<std::string, ExternalTypeData> m_externalTypes;
|
std::map<std::string, ExternalTypeData> m_externalTypes;
|
||||||
std::vector<FeatureData> m_features;
|
std::vector<FeatureData> m_features;
|
||||||
|
Loading…
Reference in New Issue
Block a user