Add some special handling debug code for vk::raii::DescriptorPool (#1978)

This commit is contained in:
Andreas Süßenbach 2024-10-24 08:18:43 +02:00 committed by GitHub
parent eacba56dc5
commit eecf79d57f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 10 deletions

View File

@ -9274,8 +9274,6 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandFactory( std::string co
if ( definition )
{
std::string callSequence =
generateCallSequence( name, commandData, returnParams, vectorParams, initialSkipCount, singularParams, {}, {}, flavourFlags, true, true );
std::string className = initialSkipCount ? stripPrefix( commandData.params[initialSkipCount - 1].type.type, "Vk" ) : "Context";
std::vector<std::string> dataTypes = determineDataTypes( commandData.params, vectorParams, returnParams, {} );
std::string dataType = combineDataTypes( vectorParams, returnParams, enumerating, dataTypes, flavourFlags, true );
@ -9290,17 +9288,27 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandFactory( std::string co
{
vulkanType = commandData.params[returnParams.back()].type.type;
}
std::string returnStatements =
generateRAIIFactoryReturnStatements( commandData.params, commandData.successCodes, vulkanType, enumerating, returnType, returnVariable, singular );
// some special handling for vkCreateDescriptorPool: not to have this flag set!
std::string specialAssertion;
if ( name == "vkCreateDescriptorPool" )
{
specialAssertion =
"VULKAN_HPP_ASSERT( createInfo.flags & vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet && \"createInfo.flags need to have vk::DescriptorPoolCreateFlagBits::eFreeDesriptors set in order to allow destruction of VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE::DescriptorSet which requires to return individual allocations to the pool\" );";
}
std::string dataDeclarations =
generateDataDeclarations( commandData, returnParams, vectorParams, {}, flavourFlags, true, dataTypes, dataType, returnType, returnVariable );
std::string vkType = commandData.params[returnParams.back()].type.type;
std::string callSequence =
generateCallSequence( name, commandData, returnParams, vectorParams, initialSkipCount, singularParams, {}, {}, flavourFlags, true, true );
std::string resultCheck = generateResultCheckExpected( commandData.successCodes, className, commandName );
std::string returnStatements =
generateRAIIFactoryReturnStatements( commandData.params, commandData.successCodes, vulkanType, enumerating, returnType, returnVariable, singular );
std::string const definitionTemplate =
R"(
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE::CreateReturnType<${returnType}>::Type ${className}::${commandName}( ${argumentList} ) const ${noexcept}
{
${specialAssertion}
${dataDeclarations}
${callSequence}
${resultCheck}
@ -9317,7 +9325,8 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandFactory( std::string co
{ "noexcept", noexceptString },
{ "resultCheck", resultCheck },
{ "returnStatements", returnStatements },
{ "returnType", returnType } } );
{ "returnType", returnType },
{ "specialAssertion", specialAssertion } } );
}
else
{
@ -14829,8 +14838,7 @@ VulkanHppGenerator::RequireFeature VulkanHppGenerator::readRequireFeature( tinyx
}
for ( auto const & n : name )
{
auto memberIt =
std::find_if( structIt->second.members.begin(), structIt->second.members.end(), [&n]( MemberData const & md ) { return md.name == n; } );
auto memberIt = std::find_if( structIt->second.members.begin(), structIt->second.members.end(), [&n]( MemberData const & md ) { return md.name == n; } );
checkForError(
memberIt != structIt->second.members.end(), line, "required feature name <" + n + "> not part of the required feature struct <" + structure + ">" );
checkForError( ( memberIt->type.isValue() && ( memberIt->type.type == "VkBool32" ) ),

View File

@ -13548,6 +13548,9 @@ namespace VULKAN_HPP_NAMESPACE
VULKAN_HPP_NAMESPACE::Optional<const VULKAN_HPP_NAMESPACE::AllocationCallbacks> allocator ) const
VULKAN_HPP_RAII_CREATE_NOEXCEPT
{
VULKAN_HPP_ASSERT(
createInfo.flags & vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet &&
"createInfo.flags need to have vk::DescriptorPoolCreateFlagBits::eFreeDesriptors set in order to allow destruction of VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE::DescriptorSet which requires to return individual allocations to the pool" );
VULKAN_HPP_NAMESPACE::DescriptorPool descriptorPool;
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->vkCreateDescriptorPool(
static_cast<VkDevice>( m_device ),