Introduce raii-compliant handle wrapper classes.
This commit is contained in:
@@ -27,21 +27,22 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
{
|
||||
try
|
||||
{
|
||||
vk::UniqueInstance instance = vk::su::createInstance( AppName, EngineName );
|
||||
vk::Instance instance = vk::su::createInstance( AppName, EngineName );
|
||||
#if !defined( NDEBUG )
|
||||
vk::UniqueDebugUtilsMessengerEXT debugUtilsMessenger = vk::su::createDebugUtilsMessenger( instance );
|
||||
vk::DebugUtilsMessengerEXT debugUtilsMessenger =
|
||||
instance.createDebugUtilsMessengerEXT( vk::su::makeDebugUtilsMessengerCreateInfoEXT() );
|
||||
#endif
|
||||
|
||||
// enumerate the physicalDevices
|
||||
std::vector<vk::PhysicalDevice> physicalDevices = instance->enumeratePhysicalDevices();
|
||||
std::vector<vk::PhysicalDevice> physicalDevices = instance.enumeratePhysicalDevices();
|
||||
|
||||
/* VULKAN_KEY_START */
|
||||
|
||||
for ( size_t i = 0; i < physicalDevices.size(); i++ )
|
||||
{
|
||||
std::cout << "PhysicalDevice " << i << "\n";
|
||||
std::vector<vk::ExtensionProperties> extensionProperties =
|
||||
physicalDevices[i].enumerateDeviceExtensionProperties();
|
||||
std::cout << "PhysicalDevice " << i << " : " << extensionProperties.size() << " extensions:\n";
|
||||
|
||||
// sort the extensions alphabetically
|
||||
std::sort( extensionProperties.begin(),
|
||||
@@ -58,6 +59,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
}
|
||||
|
||||
/* VULKAN_KEY_END */
|
||||
|
||||
instance.destroyDebugUtilsMessengerEXT( debugUtilsMessenger );
|
||||
instance.destroy();
|
||||
}
|
||||
catch ( vk::SystemError & err )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user