mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Add check for BitFlags that are required by a Flags bitmask but not listed with any feature or extension.
This commit is contained in:
parent
72d3c3cae6
commit
c3da5fa53d
@ -4347,7 +4347,8 @@ std::string VulkanHppGenerator::constructRAIIHandleMemberFunctionResultMultiGetT
|
|||||||
std::string argumentList =
|
std::string argumentList =
|
||||||
generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false );
|
generateArgumentListEnhanced( commandIt->second.params, skippedParameters, {}, definition, false, false, false );
|
||||||
std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags );
|
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 =
|
std::string returnType1 =
|
||||||
stripPostfix( commandIt->second.params[nonConstPointerParamIndices[1]].type.compose(), "*" );
|
stripPostfix( commandIt->second.params[nonConstPointerParamIndices[1]].type.compose(), "*" );
|
||||||
|
|
||||||
@ -4397,12 +4398,10 @@ std::string VulkanHppGenerator::constructRAIIHandleMemberFunctionResultMultiGetT
|
|||||||
)";
|
)";
|
||||||
|
|
||||||
return replaceWithMap( declarationTemplate,
|
return replaceWithMap( declarationTemplate,
|
||||||
{
|
{ { "argumentList", argumentList },
|
||||||
{ "argumentList", argumentList },
|
|
||||||
{ "commandName", commandName },
|
{ "commandName", commandName },
|
||||||
{ "returnType0", returnType0 },
|
{ "returnType0", returnType0 },
|
||||||
{ "returnType1", returnType1 }
|
{ "returnType1", returnType1 } } );
|
||||||
} );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6942,21 +6941,66 @@ void VulkanHppGenerator::checkEnumCorrectness( std::vector<RequireData> const &
|
|||||||
{
|
{
|
||||||
for ( auto const & type : require.types )
|
for ( auto const & type : require.types )
|
||||||
{
|
{
|
||||||
auto enumIt = m_enums.find( type );
|
auto typeIt = m_types.find( type );
|
||||||
if ( ( enumIt != m_enums.end() ) && enumIt->second.isBitmask )
|
assert( typeIt != m_types.end() );
|
||||||
|
if ( !typeIt->second.referencedIn.empty() )
|
||||||
{
|
{
|
||||||
auto bitmaskIt =
|
switch ( typeIt->second.category )
|
||||||
std::find_if( m_bitmasks.begin(),
|
{
|
||||||
m_bitmasks.end(),
|
case TypeCategory::Bitmask:
|
||||||
[&enumIt]( auto const & bitmask ) { return bitmask.second.requirements == enumIt->first; } );
|
{
|
||||||
check( bitmaskIt != m_bitmasks.end(),
|
auto bitmaskIt = m_bitmasks.find( type );
|
||||||
enumIt->second.xmlLine,
|
if ( bitmaskIt != m_bitmasks.end() )
|
||||||
"enum <" + enumIt->first +
|
{
|
||||||
"> is not listed as an requires or bitvalues for any bitmask in the types section" );
|
if ( !bitmaskIt->second.requirements.empty() )
|
||||||
check( ( enumIt->second.bitwidth != "64" ) || ( bitmaskIt->second.type == "VkFlags64" ),
|
{
|
||||||
enumIt->second.xmlLine,
|
auto requireTypeIt = m_types.find( bitmaskIt->second.requirements );
|
||||||
"enum <" + enumIt->first + "> is marked with bitwidth <64> but corresponding bitmask <" +
|
assert( requireTypeIt != m_types.end() );
|
||||||
bitmaskIt->first + "> is not of type <VkFlags64>" );
|
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(),
|
||||||
|
[&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 +
|
||||||
|
"> is not listed as an requires or bitvalues for any bitmask in the types section" );
|
||||||
|
check( ( enumIt->second.bitwidth != "64" ) || ( bitmaskIt->second.type == "VkFlags64" ),
|
||||||
|
enumIt->second.xmlLine,
|
||||||
|
"enum <" + enumIt->first + "> is marked with bitwidth <64> but corresponding bitmask <" +
|
||||||
|
bitmaskIt->first + "> is not of type <VkFlags64>" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user