| 30 | #include <vk_mem_alloc.h> |
| 31 | |
| 32 | bool ApiVulkanSample::prepare(const vkb::ApplicationOptions &options) |
| 33 | { |
| 34 | if (!VulkanSample::prepare(options)) |
| 35 | { |
| 36 | return false; |
| 37 | } |
| 38 | |
| 39 | depth_format = vkb::get_suitable_depth_format(get_device().get_gpu().get_handle()); |
| 40 | |
| 41 | // Update width and height from surface extent to reflect command line arguments |
| 42 | width = get_render_context().get_surface_extent().width; |
| 43 | height = get_render_context().get_surface_extent().height; |
| 44 | |
| 45 | // Create synchronization objects |
| 46 | VkSemaphoreCreateInfo semaphore_create_info = vkb::initializers::semaphore_create_info(); |
| 47 | // Create a semaphore used to synchronize image presentation |
| 48 | // Ensures that the current swapchain render target has completed presentation and has been released by the presentation engine, ready for rendering |
| 49 | VK_CHECK(vkCreateSemaphore(get_device().get_handle(), &semaphore_create_info, nullptr, &semaphores.acquired_image_ready)); |
| 50 | // Create a semaphore used to synchronize command submission |
| 51 | // Ensures that the image is not presented until all commands have been sumbitted and executed |
| 52 | VK_CHECK(vkCreateSemaphore(get_device().get_handle(), &semaphore_create_info, nullptr, &semaphores.render_complete)); |
| 53 | |
| 54 | // Set up submit info structure |
| 55 | // Semaphores will stay the same during application lifetime |
| 56 | // Command buffer submission info is set by each example |
| 57 | submit_info = vkb::initializers::submit_info(); |
| 58 | submit_info.pWaitDstStageMask = &submit_pipeline_stages; |
| 59 | |
| 60 | submit_info.waitSemaphoreCount = 1; |
| 61 | submit_info.pWaitSemaphores = &semaphores.acquired_image_ready; |
| 62 | submit_info.signalSemaphoreCount = 1; |
| 63 | submit_info.pSignalSemaphores = &semaphores.render_complete; |
| 64 | |
| 65 | queue = get_device().get_queue_by_flags(VK_QUEUE_GRAPHICS_BIT, 0).get_handle(); |
| 66 | |
| 67 | create_swapchain_buffers(); |
| 68 | create_command_pool(); |
| 69 | create_command_buffers(); |
| 70 | create_synchronization_primitives(); |
| 71 | setup_depth_stencil(); |
| 72 | setup_render_pass(); |
| 73 | create_pipeline_cache(); |
| 74 | setup_framebuffer(); |
| 75 | |
| 76 | prepare_gui(); |
| 77 | |
| 78 | return true; |
| 79 | } |
| 80 | |
| 81 | void ApiVulkanSample::prepare_gui() |
| 82 | { |
no test coverage detected