Extend vk::su::createInstance to also take a vk::InstanceCreateFlagBits. (#1888)

This commit is contained in:
Andreas Süßenbach 2024-06-04 16:35:52 +02:00 committed by GitHub
parent eb1f4cfb58
commit 4557f02974
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 8 deletions

View File

@ -749,7 +749,7 @@ namespace vk
#else #else
vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT> vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT>
#endif #endif
instanceCreateInfoChain = vk::su::makeInstanceCreateInfoChain( applicationInfo, enabledLayers, enabledExtensions ); instanceCreateInfoChain = vk::su::makeInstanceCreateInfoChain( {}, applicationInfo, enabledLayers, enabledExtensions );
return vk::raii::Instance( context, instanceCreateInfoChain.get<vk::InstanceCreateInfo>() ); return vk::raii::Instance( context, instanceCreateInfoChain.get<vk::InstanceCreateInfo>() );
} }

View File

@ -301,7 +301,7 @@ namespace vk
); );
vk::Instance instance = vk::Instance instance =
vk::createInstance( makeInstanceCreateInfoChain( applicationInfo, enabledLayers, enabledExtensions ).get<vk::InstanceCreateInfo>() ); vk::createInstance( makeInstanceCreateInfoChain( {}, applicationInfo, enabledLayers, enabledExtensions ).get<vk::InstanceCreateInfo>() );
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 ) #if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
// initialize function pointers for instance // initialize function pointers for instance
@ -1039,13 +1039,14 @@ namespace vk
#else #else
vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT> vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT>
#endif #endif
makeInstanceCreateInfoChain( vk::ApplicationInfo const & applicationInfo, makeInstanceCreateInfoChain( vk::InstanceCreateFlagBits instanceCreateFlagBits,
vk::ApplicationInfo const & applicationInfo,
std::vector<char const *> const & layers, std::vector<char const *> const & layers,
std::vector<char const *> const & extensions ) std::vector<char const *> const & extensions )
{ {
#if defined( NDEBUG ) #if defined( NDEBUG )
// in non-debug mode just use the InstanceCreateInfo for instance creation // in non-debug mode just use the InstanceCreateInfo for instance creation
vk::StructureChain<vk::InstanceCreateInfo> instanceCreateInfo( { {}, &applicationInfo, layers, extensions } ); vk::StructureChain<vk::InstanceCreateInfo> instanceCreateInfo( { instanceCreateFlagBits, &applicationInfo, layers, extensions } );
#else #else
// in debug mode, addionally use the debugUtilsMessengerCallback in instance creation! // in debug mode, addionally use the debugUtilsMessengerCallback in instance creation!
vk::DebugUtilsMessageSeverityFlagsEXT severityFlags( vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning | vk::DebugUtilsMessageSeverityFlagsEXT severityFlags( vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning |
@ -1053,7 +1054,7 @@ namespace vk
vk::DebugUtilsMessageTypeFlagsEXT messageTypeFlags( vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | vk::DebugUtilsMessageTypeFlagsEXT messageTypeFlags( vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance |
vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation ); vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation );
vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT> instanceCreateInfo( vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT> instanceCreateInfo(
{ {}, &applicationInfo, layers, extensions }, { {}, severityFlags, messageTypeFlags, &vk::su::debugUtilsMessengerCallback } ); { instanceCreateFlagBits, &applicationInfo, layers, extensions }, { {}, severityFlags, messageTypeFlags, &vk::su::debugUtilsMessengerCallback } );
#endif #endif
return instanceCreateInfo; return instanceCreateInfo;
} }

View File

@ -77,7 +77,7 @@ namespace vk
VULKAN_HPP_INLINE uint32_t clampSurfaceImageCount( const uint32_t desiredImageCount, const uint32_t minImageCount, const uint32_t maxImageCount ) VULKAN_HPP_INLINE uint32_t clampSurfaceImageCount( const uint32_t desiredImageCount, const uint32_t minImageCount, const uint32_t maxImageCount )
{ {
uint32_t imageCount = std::max( desiredImageCount, minImageCount ); uint32_t imageCount = std::max( desiredImageCount, minImageCount );
if( maxImageCount > 0 ) if ( maxImageCount > 0 )
{ {
imageCount = std::min( imageCount, maxImageCount ); imageCount = std::min( imageCount, maxImageCount );
} }
@ -425,7 +425,8 @@ namespace vk
#else #else
vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT> vk::StructureChain<vk::InstanceCreateInfo, vk::DebugUtilsMessengerCreateInfoEXT>
#endif #endif
makeInstanceCreateInfoChain( vk::ApplicationInfo const & applicationInfo, makeInstanceCreateInfoChain( vk::InstanceCreateFlagBits instanceCreateFlagBits,
vk::ApplicationInfo const & applicationInfo,
std::vector<char const *> const & layers, std::vector<char const *> const & layers,
std::vector<char const *> const & extensions ); std::vector<char const *> const & extensions );
vk::Format pickDepthFormat( vk::PhysicalDevice const & physicalDevice ); vk::Format pickDepthFormat( vk::PhysicalDevice const & physicalDevice );

View File

@ -83,7 +83,7 @@ vk::UniqueInstance createInstanceUnique( std::string const & appNam
); );
vk::UniqueInstance instance = vk::UniqueInstance instance =
vk::createInstanceUnique( vk::su::makeInstanceCreateInfoChain( applicationInfo, enabledLayers, enabledExtensions ).get<vk::InstanceCreateInfo>() ); vk::createInstanceUnique( vk::su::makeInstanceCreateInfoChain( {}, applicationInfo, enabledLayers, enabledExtensions ).get<vk::InstanceCreateInfo>() );
#if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 ) #if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
// initialize function pointers for instance // initialize function pointers for instance