MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Hpp / main

Function main

RAII_Samples/DebugUtilsObjectName/DebugUtilsObjectName.cpp:18–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16#endif
17
18int main()
19{
20 try
21 {
22 vk::raii::Context context;
23 vk::raii::Instance instance = vk::raii::su::makeInstance( context, AppName, EngineName, {}, vk::su::getInstanceExtensions() );
24#if !defined( NDEBUG )
25 vk::raii::DebugUtilsMessengerEXT debugUtilsMessenger( instance, vk::su::makeDebugUtilsMessengerCreateInfoEXT() );
26#endif
27
28 vk::raii::PhysicalDevices physicalDevices( instance );
29 assert( !physicalDevices.empty() );
30
31 uint32_t graphicsQueueFamilyIndex = vk::su::findGraphicsQueueFamilyIndex( physicalDevices[0].getQueueFamilyProperties() );
32 vk::raii::Device device = vk::raii::su::makeDevice( physicalDevices[0], graphicsQueueFamilyIndex );
33
34 // create an image
35 vk::raii::Image image = vk::raii::su::makeImage( device );
36
37 /* VULKAN_KEY_START */
38
39 device.setDebugUtilsObjectNameEXT( *image, "Image name" );
40
41 /* VULKAN_KEY_END */
42 }
43 catch ( vk::SystemError & err )
44 {
45 std::cout << "vk::SystemError: " << err.what() << std::endl;
46 exit( -1 );
47 }
48 catch ( std::exception & err )
49 {
50 std::cout << "std::exception: " << err.what() << std::endl;
51 exit( -1 );
52 }
53 catch ( ... )
54 {
55 std::cout << "unknown error\n";
56 exit( -1 );
57 }
58 return 0;
59}

Callers

nothing calls this directly

Calls 6

makeInstanceFunction · 0.85
getInstanceExtensionsFunction · 0.85
makeDeviceFunction · 0.85
makeImageFunction · 0.85

Tested by

no test coverage detected