mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-30 15:40:08 +00:00
Merge pull request #1028 from asuessenbach/check
Add check for BitFlags that are required by a Flags bitmask but not listed with any feature or extension.
This commit is contained in:
commit
44b8a5a4ec
@ -4347,7 +4347,8 @@ std::string VulkanHppGenerator::constructRAIIHandleMemberFunctionResultMultiGetT
|
||||
std::string argumentList =
|
||||
generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false );
|
||||
std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags );
|
||||
std::string returnType0 = stripPostfix( commandIt->second.params[nonConstPointerParamIndices[0]].type.compose(), "*" );
|
||||
std::string returnType0 =
|
||||
stripPostfix( commandIt->second.params[nonConstPointerParamIndices[0]].type.compose(), "*" );
|
||||
std::string returnType1 =
|
||||
stripPostfix( commandIt->second.params[nonConstPointerParamIndices[1]].type.compose(), "*" );
|
||||
|
||||
@ -4397,12 +4398,10 @@ std::string VulkanHppGenerator::constructRAIIHandleMemberFunctionResultMultiGetT
|
||||
)";
|
||||
|
||||
return replaceWithMap( declarationTemplate,
|
||||
{
|
||||
{ "argumentList", argumentList },
|
||||
{ { "argumentList", argumentList },
|
||||
{ "commandName", commandName },
|
||||
{ "returnType0", returnType0 },
|
||||
{ "returnType1", returnType1 }
|
||||
} );
|
||||
{ "returnType1", returnType1 } } );
|
||||
}
|
||||
}
|
||||
|
||||
@ -6942,13 +6941,53 @@ void VulkanHppGenerator::checkEnumCorrectness( std::vector<RequireData> const &
|
||||
{
|
||||
for ( auto const & type : require.types )
|
||||
{
|
||||
auto enumIt = m_enums.find( type );
|
||||
if ( ( enumIt != m_enums.end() ) && enumIt->second.isBitmask )
|
||||
auto typeIt = m_types.find( type );
|
||||
assert( typeIt != m_types.end() );
|
||||
if ( !typeIt->second.referencedIn.empty() )
|
||||
{
|
||||
auto bitmaskIt =
|
||||
std::find_if( m_bitmasks.begin(),
|
||||
switch ( typeIt->second.category )
|
||||
{
|
||||
case TypeCategory::Bitmask:
|
||||
{
|
||||
auto bitmaskIt = m_bitmasks.find( type );
|
||||
if ( bitmaskIt != m_bitmasks.end() )
|
||||
{
|
||||
if ( !bitmaskIt->second.requirements.empty() )
|
||||
{
|
||||
auto requireTypeIt = m_types.find( bitmaskIt->second.requirements );
|
||||
assert( requireTypeIt != m_types.end() );
|
||||
check( !requireTypeIt->second.referencedIn.empty(),
|
||||
bitmaskIt->second.xmlLine,
|
||||
"bitmask <" + bitmaskIt->first + ">, listed for <" + typeIt->second.referencedIn +
|
||||
">, requires <" + bitmaskIt->second.requirements + "> which is not listed for any feature or extension!" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( std::find_if( m_bitmasks.begin(),
|
||||
m_bitmasks.end(),
|
||||
[&enumIt]( auto const & bitmask ) { return bitmask.second.requirements == enumIt->first; } );
|
||||
[&type]( std::pair<const std::string, BitmaskData> const & bd )
|
||||
{ return bd.second.alias == type; } ) != m_bitmasks.end() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TypeCategory::Enum:
|
||||
{
|
||||
auto enumIt = m_enums.find( type );
|
||||
if ( enumIt == m_enums.end() )
|
||||
{
|
||||
enumIt = std::find_if( m_enums.begin(),
|
||||
m_enums.end(),
|
||||
[&type]( std::pair<const std::string, EnumData> const & ed )
|
||||
{ return ed.second.alias == type; } );
|
||||
}
|
||||
assert( enumIt != m_enums.end() );
|
||||
if ( enumIt->second.isBitmask )
|
||||
{
|
||||
auto bitmaskIt = std::find_if( m_bitmasks.begin(),
|
||||
m_bitmasks.end(),
|
||||
[&enumIt]( auto const & bitmask )
|
||||
{ return bitmask.second.requirements == enumIt->first; } );
|
||||
check( bitmaskIt != m_bitmasks.end(),
|
||||
enumIt->second.xmlLine,
|
||||
"enum <" + enumIt->first +
|
||||
@ -6959,6 +6998,11 @@ void VulkanHppGenerator::checkEnumCorrectness( std::vector<RequireData> const &
|
||||
bitmaskIt->first + "> is not of type <VkFlags64>" );
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user