MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / prepare

Method prepare

framework/hpp_api_vulkan_sample.cpp:24–69  ·  view source on GitHub ↗

Instantiate the default dispatcher

Source from the content-addressed store, hash-verified

22
23// Instantiate the default dispatcher
24VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
25
26bool HPPApiVulkanSample::prepare(const vkb::ApplicationOptions &options)
27{
28 if (!vkb::VulkanSampleCpp::prepare(options))
29 {
30 return false;
31 }
32
33 depth_format = vkb::common::get_suitable_depth_format(get_device().get_gpu().get_handle());
34
35 // Update extent from surface extent to reflect command line arguments
36 extent = get_render_context().get_surface_extent();
37
38 // Create synchronization objects
39 // Create a semaphore used to synchronize image presentation
40 // Ensures that the current swapchain render target has completed presentation and has been released by the presentation engine, ready for rendering
41 semaphores.acquired_image_ready = get_device().get_handle().createSemaphore({});
42 // Create a semaphore used to synchronize command submission
43 // Ensures that the image is not presented until all commands have been sumbitted and executed
44 semaphores.render_complete = get_device().get_handle().createSemaphore({});
45
46 // Set up submit info structure
47 // Semaphores will stay the same during application lifetime
48 // Command buffer submission info is set by each example
49 submit_info = vk::SubmitInfo();
50 submit_info.pWaitDstStageMask = &submit_pipeline_stages;
51
52 submit_info.setWaitSemaphores(semaphores.acquired_image_ready);
53 submit_info.setSignalSemaphores(semaphores.render_complete);
54
55 queue = get_device().get_queue_by_flags(vk::QueueFlagBits::eGraphics, 0).get_handle();
56
57 create_swapchain_buffers();
58 create_command_pool();
59 create_command_buffers();
60 create_synchronization_primitives();
61 setup_depth_stencil();
62 setup_render_pass();
63 create_pipeline_cache();
64 setup_framebuffer();
65
66 prepare_gui();
67
68 return true;
69}
70
71void HPPApiVulkanSample::prepare_gui()
72{

Callers 1

prepare_guiMethod · 0.45

Calls 3

create_pipeline_cacheFunction · 0.85
get_handleMethod · 0.45

Tested by

no test coverage detected