From d38980d59262f199672f48de5f15eb578b1dd51a Mon Sep 17 00:00:00 2001 From: asuessenbach Date: Thu, 3 Feb 2022 10:42:57 +0100 Subject: [PATCH] Update samples on PhysicalDeviceMemoryProperties --- .../CMakeLists.txt | 32 +++++++++---------- .../PhysicalDeviceMemoryProperties.cpp | 18 +++++------ .../CMakeLists.txt | 32 +++++++++---------- .../PhysicalDeviceMemoryProperties.cpp | 12 +++++-- 4 files changed, 47 insertions(+), 47 deletions(-) diff --git a/RAII_Samples/PhysicalDeviceMemoryProperties/CMakeLists.txt b/RAII_Samples/PhysicalDeviceMemoryProperties/CMakeLists.txt index c3a29c8..c81c5de 100644 --- a/RAII_Samples/PhysicalDeviceMemoryProperties/CMakeLists.txt +++ b/RAII_Samples/PhysicalDeviceMemoryProperties/CMakeLists.txt @@ -12,26 +12,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -if(!MSVC) - cmake_minimum_required(VERSION 3.2) +cmake_minimum_required(VERSION 3.2) - project(RAII_PhysicalDeviceMemoryProperties) +project(RAII_PhysicalDeviceMemoryProperties) - set(HEADERS - ) +set(HEADERS +) - set(SOURCES - PhysicalDeviceMemoryProperties.cpp - ) +set(SOURCES + PhysicalDeviceMemoryProperties.cpp +) - source_group(headers FILES ${HEADERS}) - source_group(sources FILES ${SOURCES}) +source_group(headers FILES ${HEADERS}) +source_group(sources FILES ${SOURCES}) - add_executable(RAII_PhysicalDeviceMemoryProperties - ${HEADERS} - ${SOURCES} - ) +add_executable(RAII_PhysicalDeviceMemoryProperties + ${HEADERS} + ${SOURCES} +) - set_target_properties(RAII_PhysicalDeviceMemoryProperties PROPERTIES FOLDER "RAIISamples") - target_link_libraries(RAII_PhysicalDeviceMemoryProperties PRIVATE utils) -endif(!MSVC) +set_target_properties(RAII_PhysicalDeviceMemoryProperties PROPERTIES FOLDER "RAII_Samples") +target_link_libraries(RAII_PhysicalDeviceMemoryProperties PRIVATE utils) diff --git a/RAII_Samples/PhysicalDeviceMemoryProperties/PhysicalDeviceMemoryProperties.cpp b/RAII_Samples/PhysicalDeviceMemoryProperties/PhysicalDeviceMemoryProperties.cpp index e712d2a..50f5c70 100644 --- a/RAII_Samples/PhysicalDeviceMemoryProperties/PhysicalDeviceMemoryProperties.cpp +++ b/RAII_Samples/PhysicalDeviceMemoryProperties/PhysicalDeviceMemoryProperties.cpp @@ -50,30 +50,28 @@ int main( int /*argc*/, char ** /*argv*/ ) { try { - std::unique_ptr> contextHandle = std::make_unique>(); - std::unique_ptr> instanceHandle = - vk::su::makeUniqueInstanceHandle( *contextHandle, AppName, EngineName, {}, {}, VK_API_VERSION_1_1 ); + vk::raii::Context context; + vk::raii::Instance instance = + vk::raii::su::makeInstance( context, AppName, EngineName, {}, {}, VK_API_VERSION_1_1 ); #if !defined( NDEBUG ) - std::unique_ptr> debugUtilsMessenger = - vk::su::makeUniqueDebugUtilsMessengerEXTHandle( *instanceHandle ); + vk::raii::DebugUtilsMessengerEXT debugUtilsMessenger( instance, vk::su::makeDebugUtilsMessengerCreateInfoEXT() ); #endif // enumerate the physicalDevices - std::unique_ptr> physicalDeviceHandles = - std::make_unique>( *instanceHandle ); + vk::raii::PhysicalDevices physicalDevices( instance ); /* VULKAN_KEY_START */ - for ( size_t i = 0; i < physicalDeviceHandles->size(); i++ ) + for ( size_t i = 0; i < physicalDevices.size(); i++ ) { // some properties are only valid, if a corresponding extension is available! std::vector extensionProperties = - (*physicalDeviceHandles)[i].enumerateDeviceExtensionProperties(); + physicalDevices[i].enumerateDeviceExtensionProperties(); bool containsMemoryBudget = vk::su::contains( extensionProperties, "VK_EXT_memory_budget" ); std::cout << "PhysicalDevice " << i << " :\n"; auto memoryProperties2 = - (*physicalDeviceHandles)[i] + physicalDevices[i] .getMemoryProperties2(); vk::PhysicalDeviceMemoryProperties const & memoryProperties = memoryProperties2.get().memoryProperties; diff --git a/samples/PhysicalDeviceMemoryProperties/CMakeLists.txt b/samples/PhysicalDeviceMemoryProperties/CMakeLists.txt index 05494e3..da07df4 100644 --- a/samples/PhysicalDeviceMemoryProperties/CMakeLists.txt +++ b/samples/PhysicalDeviceMemoryProperties/CMakeLists.txt @@ -12,26 +12,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -if(!MSVC) - cmake_minimum_required(VERSION 3.2) +cmake_minimum_required(VERSION 3.2) - project(PhysicalDeviceMemoryProperties) +project(PhysicalDeviceMemoryProperties) - set(HEADERS - ) +set(HEADERS +) - set(SOURCES - PhysicalDeviceMemoryProperties.cpp - ) +set(SOURCES + PhysicalDeviceMemoryProperties.cpp +) - source_group(headers FILES ${HEADERS}) - source_group(sources FILES ${SOURCES}) +source_group(headers FILES ${HEADERS}) +source_group(sources FILES ${SOURCES}) - add_executable(PhysicalDeviceMemoryProperties - ${HEADERS} - ${SOURCES} - ) +add_executable(PhysicalDeviceMemoryProperties + ${HEADERS} + ${SOURCES} +) - set_target_properties(PhysicalDeviceMemoryProperties PROPERTIES FOLDER "Samples") - target_link_libraries(PhysicalDeviceMemoryProperties PRIVATE utils) -endif(!MSVC) +set_target_properties(PhysicalDeviceMemoryProperties PROPERTIES FOLDER "Samples") +target_link_libraries(PhysicalDeviceMemoryProperties PRIVATE utils) diff --git a/samples/PhysicalDeviceMemoryProperties/PhysicalDeviceMemoryProperties.cpp b/samples/PhysicalDeviceMemoryProperties/PhysicalDeviceMemoryProperties.cpp index 7b920b2..fd881ae 100644 --- a/samples/PhysicalDeviceMemoryProperties/PhysicalDeviceMemoryProperties.cpp +++ b/samples/PhysicalDeviceMemoryProperties/PhysicalDeviceMemoryProperties.cpp @@ -50,13 +50,14 @@ int main( int /*argc*/, char ** /*argv*/ ) { try { - vk::UniqueInstance instance = vk::su::createInstance( AppName, EngineName, {}, {}, VK_API_VERSION_1_1 ); + vk::Instance instance = vk::su::createInstance( AppName, EngineName, {}, {}, VK_API_VERSION_1_1 ); #if !defined( NDEBUG ) - vk::UniqueDebugUtilsMessengerEXT debugUtilsMessenger = vk::su::createDebugUtilsMessenger( instance ); + vk::DebugUtilsMessengerEXT debugUtilsMessenger = + instance.createDebugUtilsMessengerEXT( vk::su::makeDebugUtilsMessengerCreateInfoEXT() ); #endif // enumerate the physicalDevices - std::vector physicalDevices = instance->enumeratePhysicalDevices(); + std::vector physicalDevices = instance.enumeratePhysicalDevices(); /* VULKAN_KEY_START */ @@ -95,6 +96,11 @@ int main( int /*argc*/, char ** /*argv*/ ) } /* VULKAN_KEY_END */ + +#if !defined( NDEBUG ) + instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger ); +#endif + instance.destroy(); } catch ( vk::SystemError & err ) {