Add function pointer check when using DispatchLoaderDynamic. (#1769)

This commit is contained in:
Andreas Süßenbach 2024-01-08 12:19:28 +01:00 committed by GitHub
parent 1a24b01583
commit 9eab68eb5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3795 additions and 4 deletions

View File

@ -3460,6 +3460,9 @@ std::string VulkanHppGenerator::generateCommandEnhanced( std::string const &
${nodiscard}VULKAN_HPP_INLINE ${decoratedReturnType} ${className}${classSeparator}${commandName}( ${argumentList} )${const}${noexcept}
{
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
#if (VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
${functionPointerCheck}
#endif
${vectorSizeCheck}
${dataSizeChecks}
${dataDeclarations}
@ -3482,6 +3485,7 @@ ${vectorSizeCheck}
{ "dataPreparation", dataPreparation },
{ "dataSizeChecks", dataSizeChecks },
{ "decoratedReturnType", decoratedReturnType },
{ "functionPointerCheck", generateFunctionPointerCheck( name, commandData.requiredBy, false ) },
{ "nodiscard", nodiscard },
{ "noexcept", noexceptString },
{ "resultCheck", resultCheck },
@ -7507,7 +7511,7 @@ ${widthDivisorCases}
{ "texelsPerBlockCases", texelsPerBlockCases } } );
}
std::string VulkanHppGenerator::generateFunctionPointerCheck( std::string const & function, std::set<std::string> const & requiredBy ) const
std::string VulkanHppGenerator::generateFunctionPointerCheck( std::string const & function, std::set<std::string> const & requiredBy, bool raii ) const
{
std::string functionPointerCheck;
if ( !requiredBy.empty() )
@ -7518,7 +7522,7 @@ std::string VulkanHppGenerator::generateFunctionPointerCheck( std::string const
message += " or <" + *it + ">";
}
functionPointerCheck = "VULKAN_HPP_ASSERT( getDispatcher()->" + function + " && \"" + message + "\" );";
functionPointerCheck = std::string( "VULKAN_HPP_ASSERT( " ) + ( raii ? "getDispatcher()->" : "d." ) + function + " && \"" + message + "\" );";
}
return functionPointerCheck;
}
@ -8672,7 +8676,7 @@ ${vectorSizeCheck}
{ "dataDeclarations", dataDeclarations },
{ "dataPreparation", dataPreparation },
{ "dataSizeChecks", dataSizeChecks },
{ "functionPointerCheck", generateFunctionPointerCheck( name, commandData.requiredBy ) },
{ "functionPointerCheck", generateFunctionPointerCheck( name, commandData.requiredBy, true ) },
{ "nodiscard", nodiscard },
{ "noexcept", noexceptString },
{ "resultCheck", resultCheck },

View File

@ -718,7 +718,7 @@ private:
std::string generateExtensionsList( std::string const & type ) const;
std::string generateExtensionTypeTest( std::string const & type ) const;
std::string generateFormatTraits() const;
std::string generateFunctionPointerCheck( std::string const & function, std::set<std::string> const & requiredBy ) const;
std::string generateFunctionPointerCheck( std::string const & function, std::set<std::string> const & requiredBy, bool raii ) const;
std::string generateHandle( std::pair<std::string, HandleData> const & handle, std::set<std::string> & listedHandles ) const;
std::string generateHandleCommandDeclarations( std::set<std::string> const & commands ) const;
std::string generateHandleDependencies( std::pair<std::string, HandleData> const & handle, std::set<std::string> & listedHandles ) const;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff