From 4557f029740ba78aafe35ebfd77ce8b400536b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Tue, 4 Jun 2024 16:35:52 +0200 Subject: [PATCH] Extend vk::su::createInstance to also take a vk::InstanceCreateFlagBits. (#1888) --- RAII_Samples/utils/utils.hpp | 2 +- samples/utils/utils.cpp | 9 +++++---- samples/utils/utils.hpp | 5 +++-- tests/UniqueHandle/UniqueHandle.cpp | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/RAII_Samples/utils/utils.hpp b/RAII_Samples/utils/utils.hpp index 21f2f41..ffac2cd 100644 --- a/RAII_Samples/utils/utils.hpp +++ b/RAII_Samples/utils/utils.hpp @@ -749,7 +749,7 @@ namespace vk #else vk::StructureChain #endif - instanceCreateInfoChain = vk::su::makeInstanceCreateInfoChain( applicationInfo, enabledLayers, enabledExtensions ); + instanceCreateInfoChain = vk::su::makeInstanceCreateInfoChain( {}, applicationInfo, enabledLayers, enabledExtensions ); return vk::raii::Instance( context, instanceCreateInfoChain.get() ); } diff --git a/samples/utils/utils.cpp b/samples/utils/utils.cpp index 7a56644..da885a8 100644 --- a/samples/utils/utils.cpp +++ b/samples/utils/utils.cpp @@ -301,7 +301,7 @@ namespace vk ); vk::Instance instance = - vk::createInstance( makeInstanceCreateInfoChain( applicationInfo, enabledLayers, enabledExtensions ).get() ); + vk::createInstance( makeInstanceCreateInfoChain( {}, applicationInfo, enabledLayers, enabledExtensions ).get() ); #if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 ) // initialize function pointers for instance @@ -1039,13 +1039,14 @@ namespace vk #else vk::StructureChain #endif - makeInstanceCreateInfoChain( vk::ApplicationInfo const & applicationInfo, + makeInstanceCreateInfoChain( vk::InstanceCreateFlagBits instanceCreateFlagBits, + vk::ApplicationInfo const & applicationInfo, std::vector const & layers, std::vector const & extensions ) { #if defined( NDEBUG ) // in non-debug mode just use the InstanceCreateInfo for instance creation - vk::StructureChain instanceCreateInfo( { {}, &applicationInfo, layers, extensions } ); + vk::StructureChain instanceCreateInfo( { instanceCreateFlagBits, &applicationInfo, layers, extensions } ); #else // in debug mode, addionally use the debugUtilsMessengerCallback in instance creation! vk::DebugUtilsMessageSeverityFlagsEXT severityFlags( vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning | @@ -1053,7 +1054,7 @@ namespace vk vk::DebugUtilsMessageTypeFlagsEXT messageTypeFlags( vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation ); vk::StructureChain instanceCreateInfo( - { {}, &applicationInfo, layers, extensions }, { {}, severityFlags, messageTypeFlags, &vk::su::debugUtilsMessengerCallback } ); + { instanceCreateFlagBits, &applicationInfo, layers, extensions }, { {}, severityFlags, messageTypeFlags, &vk::su::debugUtilsMessengerCallback } ); #endif return instanceCreateInfo; } diff --git a/samples/utils/utils.hpp b/samples/utils/utils.hpp index 8d17029..bd30051 100644 --- a/samples/utils/utils.hpp +++ b/samples/utils/utils.hpp @@ -77,7 +77,7 @@ namespace vk 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 ); - if( maxImageCount > 0 ) + if ( maxImageCount > 0 ) { imageCount = std::min( imageCount, maxImageCount ); } @@ -425,7 +425,8 @@ namespace vk #else vk::StructureChain #endif - makeInstanceCreateInfoChain( vk::ApplicationInfo const & applicationInfo, + makeInstanceCreateInfoChain( vk::InstanceCreateFlagBits instanceCreateFlagBits, + vk::ApplicationInfo const & applicationInfo, std::vector const & layers, std::vector const & extensions ); vk::Format pickDepthFormat( vk::PhysicalDevice const & physicalDevice ); diff --git a/tests/UniqueHandle/UniqueHandle.cpp b/tests/UniqueHandle/UniqueHandle.cpp index bd4501f..9007234 100644 --- a/tests/UniqueHandle/UniqueHandle.cpp +++ b/tests/UniqueHandle/UniqueHandle.cpp @@ -83,7 +83,7 @@ vk::UniqueInstance createInstanceUnique( std::string const & appNam ); vk::UniqueInstance instance = - vk::createInstanceUnique( vk::su::makeInstanceCreateInfoChain( applicationInfo, enabledLayers, enabledExtensions ).get() ); + vk::createInstanceUnique( vk::su::makeInstanceCreateInfoChain( {}, applicationInfo, enabledLayers, enabledExtensions ).get() ); #if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 ) // initialize function pointers for instance