mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2025-09-12 13:27:58 -04:00
Introduce vk::PFN_VoidFunction as a replacement of PFN_vkVoidFunction (#2033)
This commit is contained in:
parent
d5f49e5a7b
commit
264d35b58c
@ -230,6 +230,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
{
|
{
|
||||||
${structForwardDeclarations}
|
${structForwardDeclarations}
|
||||||
${handleForwardDeclarations}
|
${handleForwardDeclarations}
|
||||||
|
${funcPointerReturns}
|
||||||
${uniqueHandles}
|
${uniqueHandles}
|
||||||
${handles}
|
${handles}
|
||||||
|
|
||||||
@ -289,6 +290,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
|
|
||||||
std::string str = replaceWithMap( vulkanHandlesHppTemplate,
|
std::string str = replaceWithMap( vulkanHandlesHppTemplate,
|
||||||
{
|
{
|
||||||
|
{ "funcPointerReturns", generateFuncPointerReturns() },
|
||||||
{ "handles", generateHandles() },
|
{ "handles", generateHandles() },
|
||||||
{ "handleForwardDeclarations", generateHandleForwardDeclarations() },
|
{ "handleForwardDeclarations", generateHandleForwardDeclarations() },
|
||||||
{ "licenseHeader", m_vulkanLicenseHeader },
|
{ "licenseHeader", m_vulkanLicenseHeader },
|
||||||
@ -784,7 +786,7 @@ export namespace std
|
|||||||
|
|
||||||
// This VkFlags type is used as part of a bitfield in some structure.
|
// This VkFlags type is used as part of a bitfield in some structure.
|
||||||
// As it that can't be mimiced by vk-data types, we need to export just that!!
|
// As it that can't be mimiced by vk-data types, we need to export just that!!
|
||||||
using VkGeometryInstanceFlagsKHR;
|
export VkGeometryInstanceFlagsKHR;
|
||||||
)";
|
)";
|
||||||
|
|
||||||
auto const str = replaceWithMap( vulkanCppmTemplate,
|
auto const str = replaceWithMap( vulkanCppmTemplate,
|
||||||
@ -5505,7 +5507,7 @@ std::string VulkanHppGenerator::generateCppModuleFuncpointerUsings() const
|
|||||||
//====================
|
//====================
|
||||||
)";
|
)";
|
||||||
|
|
||||||
auto const generateUsingsAndProtection = [this]( std::vector<RequireData> const & requireData, std::string const & title )
|
auto const generateUsingsAndProtection = [this]( std::vector<RequireData> const & requireData, std::string const & title )
|
||||||
{
|
{
|
||||||
auto usings = std::string{};
|
auto usings = std::string{};
|
||||||
for ( auto const & require : requireData )
|
for ( auto const & require : requireData )
|
||||||
@ -6736,6 +6738,10 @@ std::string VulkanHppGenerator::generateDecoratedReturnType( CommandData const &
|
|||||||
{
|
{
|
||||||
decoratedReturnType = generateNamespacedType( commandData.returnType );
|
decoratedReturnType = generateNamespacedType( commandData.returnType );
|
||||||
}
|
}
|
||||||
|
else if ( commandData.returnType.starts_with( "PFN_vk" ) )
|
||||||
|
{
|
||||||
|
decoratedReturnType = "VULKAN_HPP_NAMESPACE::PFN_" + stripPrefix( commandData.returnType, "PFN_vk" );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
decoratedReturnType = commandData.returnType;
|
decoratedReturnType = commandData.returnType;
|
||||||
@ -8286,19 +8292,19 @@ std::string VulkanHppGenerator::generateFuncPointer( std::pair<std::string, Func
|
|||||||
const auto [enter, leave] = generateProtection( getProtectFromType( funcPointer.first ) );
|
const auto [enter, leave] = generateProtection( getProtectFromType( funcPointer.first ) );
|
||||||
|
|
||||||
std::string funcPointerArguments;
|
std::string funcPointerArguments;
|
||||||
for ( auto const & argument : funcPointer.second.arguments )
|
if ( !funcPointer.second.arguments.empty() )
|
||||||
{
|
{
|
||||||
funcPointerArguments += argument.type.compose( "VULKAN_HPP_NAMESPACE" ) + " " + argument.name + ", ";
|
for ( auto const & argument : funcPointer.second.arguments )
|
||||||
|
{
|
||||||
|
funcPointerArguments += argument.type.compose( "VULKAN_HPP_NAMESPACE" ) + " " + argument.name + ", ";
|
||||||
|
}
|
||||||
|
assert( !funcPointerArguments.empty() );
|
||||||
|
funcPointerArguments.pop_back();
|
||||||
|
funcPointerArguments.pop_back();
|
||||||
}
|
}
|
||||||
assert( !funcPointerArguments.empty() );
|
|
||||||
funcPointerArguments.pop_back();
|
|
||||||
funcPointerArguments.pop_back();
|
|
||||||
|
|
||||||
static const std::string funcPointerTemplate = R"(
|
static const std::string funcPointerTemplate = R"(
|
||||||
typedef ${returnType} (VKAPI_PTR *PFN_${funcPointerName})
|
typedef ${returnType} (VKAPI_PTR *PFN_${funcPointerName})( ${funcPointerArguments} );
|
||||||
(
|
|
||||||
${funcPointerArguments}
|
|
||||||
);
|
|
||||||
)";
|
)";
|
||||||
|
|
||||||
str += "\n" + enter +
|
str += "\n" + enter +
|
||||||
@ -8312,6 +8318,27 @@ std::string VulkanHppGenerator::generateFuncPointer( std::pair<std::string, Func
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string VulkanHppGenerator::generateFuncPointerReturns() const
|
||||||
|
{
|
||||||
|
std::string str;
|
||||||
|
std::set<std::string> listedFuncPointers;
|
||||||
|
for ( auto const & handle : m_handles )
|
||||||
|
{
|
||||||
|
for ( auto const & command : handle.second.commands )
|
||||||
|
{
|
||||||
|
auto commandIt = findByNameOrAlias( m_commands, command );
|
||||||
|
assert( commandIt != m_commands.end() );
|
||||||
|
auto funcPointerIt = m_funcPointers.find( commandIt->second.returnType );
|
||||||
|
if ( ( funcPointerIt != m_funcPointers.end() ) && !listedFuncPointers.contains( commandIt->second.returnType ) )
|
||||||
|
{
|
||||||
|
assert( funcPointerIt->second.arguments.empty() );
|
||||||
|
str += generateFuncPointer( *funcPointerIt, listedFuncPointers );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
std::string VulkanHppGenerator::generateFunctionPointerCheck( std::string const & function, std::set<std::string> const & requiredBy, bool raii ) const
|
std::string VulkanHppGenerator::generateFunctionPointerCheck( std::string const & function, std::set<std::string> const & requiredBy, bool raii ) const
|
||||||
{
|
{
|
||||||
std::string functionPointerCheck;
|
std::string functionPointerCheck;
|
||||||
|
@ -845,6 +845,7 @@ private:
|
|||||||
std::string generateExtensionTypeTest( std::string const & type ) const;
|
std::string generateExtensionTypeTest( std::string const & type ) const;
|
||||||
std::string generateFormatTraits() const;
|
std::string generateFormatTraits() const;
|
||||||
std::string generateFuncPointer( std::pair<std::string, FuncPointerData> const & funcPointer, std::set<std::string> & listedStructs ) const;
|
std::string generateFuncPointer( std::pair<std::string, FuncPointerData> const & funcPointer, std::set<std::string> & listedStructs ) const;
|
||||||
|
std::string generateFuncPointerReturns() const;
|
||||||
std::string generateFunctionPointerCheck( std::string const & function, std::set<std::string> const & requiredBy, bool raii ) 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 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 generateHandleCommandDeclarations( std::set<std::string> const & commands ) const;
|
||||||
|
@ -8249,4 +8249,4 @@ export namespace std
|
|||||||
|
|
||||||
// This VkFlags type is used as part of a bitfield in some structure.
|
// This VkFlags type is used as part of a bitfield in some structure.
|
||||||
// As it that can't be mimiced by vk-data types, we need to export just that!!
|
// As it that can't be mimiced by vk-data types, we need to export just that!!
|
||||||
using VkGeometryInstanceFlagsKHR;
|
export VkGeometryInstanceFlagsKHR;
|
||||||
|
@ -400,7 +400,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
|
|
||||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||||
template <typename Dispatch>
|
template <typename Dispatch>
|
||||||
VULKAN_HPP_INLINE PFN_vkVoidFunction Instance::getProcAddr( const std::string & name, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT
|
VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::PFN_VoidFunction Instance::getProcAddr( const std::string & name, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
|
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
|
||||||
# if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
|
# if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
|
||||||
@ -422,7 +422,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
|
|
||||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||||
template <typename Dispatch>
|
template <typename Dispatch>
|
||||||
VULKAN_HPP_INLINE PFN_vkVoidFunction Device::getProcAddr( const std::string & name, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT
|
VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::PFN_VoidFunction Device::getProcAddr( const std::string & name, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
|
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
|
||||||
# if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
|
# if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
|
||||||
|
@ -2085,6 +2085,8 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
class IndirectCommandsLayoutEXT;
|
class IndirectCommandsLayoutEXT;
|
||||||
class IndirectExecutionSetEXT;
|
class IndirectExecutionSetEXT;
|
||||||
|
|
||||||
|
typedef void( VKAPI_PTR * PFN_VoidFunction )();
|
||||||
|
|
||||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||||
//======================
|
//======================
|
||||||
//=== UNIQUE HANDLEs ===
|
//=== UNIQUE HANDLEs ===
|
||||||
@ -9722,7 +9724,8 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
PFN_vkVoidFunction getProcAddr( const char * pName, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
|
PFN_vkVoidFunction getProcAddr( const char * pName, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
|
||||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||||
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
|
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
|
||||||
PFN_vkVoidFunction getProcAddr( const std::string & name, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
|
VULKAN_HPP_NAMESPACE::PFN_VoidFunction getProcAddr( const std::string & name,
|
||||||
|
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
|
||||||
#endif /* VULKAN_HPP_DISABLE_ENHANCED_MODE */
|
#endif /* VULKAN_HPP_DISABLE_ENHANCED_MODE */
|
||||||
|
|
||||||
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
|
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
|
||||||
@ -17032,7 +17035,8 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
PFN_vkVoidFunction getProcAddr( const char * pName, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
|
PFN_vkVoidFunction getProcAddr( const char * pName, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
|
||||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||||
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
|
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
|
||||||
PFN_vkVoidFunction getProcAddr( const std::string & name, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
|
VULKAN_HPP_NAMESPACE::PFN_VoidFunction getProcAddr( const std::string & name,
|
||||||
|
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
|
||||||
#endif /* VULKAN_HPP_DISABLE_ENHANCED_MODE */
|
#endif /* VULKAN_HPP_DISABLE_ENHANCED_MODE */
|
||||||
|
|
||||||
//=== VK_VERSION_1_1 ===
|
//=== VK_VERSION_1_1 ===
|
||||||
|
@ -3044,7 +3044,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
std::vector<VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE::PhysicalDevice>>::Type
|
std::vector<VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE::PhysicalDevice>>::Type
|
||||||
enumeratePhysicalDevices() const;
|
enumeratePhysicalDevices() const;
|
||||||
|
|
||||||
VULKAN_HPP_NODISCARD PFN_vkVoidFunction getProcAddr( const std::string & name ) const VULKAN_HPP_NOEXCEPT;
|
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::PFN_VoidFunction getProcAddr( const std::string & name ) const VULKAN_HPP_NOEXCEPT;
|
||||||
|
|
||||||
//=== VK_VERSION_1_1 ===
|
//=== VK_VERSION_1_1 ===
|
||||||
|
|
||||||
@ -3818,7 +3818,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
|
|
||||||
//=== VK_VERSION_1_0 ===
|
//=== VK_VERSION_1_0 ===
|
||||||
|
|
||||||
VULKAN_HPP_NODISCARD PFN_vkVoidFunction getProcAddr( const std::string & name ) const VULKAN_HPP_NOEXCEPT;
|
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::PFN_VoidFunction getProcAddr( const std::string & name ) const VULKAN_HPP_NOEXCEPT;
|
||||||
|
|
||||||
VULKAN_HPP_NODISCARD
|
VULKAN_HPP_NODISCARD
|
||||||
VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE::detail::CreateReturnType<VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE::Queue>::Type
|
VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE::detail::CreateReturnType<VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE::Queue>::Type
|
||||||
@ -13176,7 +13176,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
return memoryProperties;
|
return memoryProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE PFN_vkVoidFunction Instance::getProcAddr( const std::string & name ) const VULKAN_HPP_NOEXCEPT
|
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::PFN_VoidFunction Instance::getProcAddr( const std::string & name ) const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
VULKAN_HPP_ASSERT( getDispatcher()->vkGetInstanceProcAddr && "Function <vkGetInstanceProcAddr> requires <VK_VERSION_1_0>" );
|
VULKAN_HPP_ASSERT( getDispatcher()->vkGetInstanceProcAddr && "Function <vkGetInstanceProcAddr> requires <VK_VERSION_1_0>" );
|
||||||
|
|
||||||
@ -13185,7 +13185,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE PFN_vkVoidFunction Device::getProcAddr( const std::string & name ) const VULKAN_HPP_NOEXCEPT
|
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::PFN_VoidFunction Device::getProcAddr( const std::string & name ) const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
VULKAN_HPP_ASSERT( getDispatcher()->vkGetDeviceProcAddr && "Function <vkGetDeviceProcAddr> requires <VK_VERSION_1_0>" );
|
VULKAN_HPP_ASSERT( getDispatcher()->vkGetDeviceProcAddr && "Function <vkGetDeviceProcAddr> requires <VK_VERSION_1_0>" );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user