3636#include " misc/graphics_pipeline_create_info.h"
3737#include " misc/image_create_info.h"
3838#include " misc/image_view_create_info.h"
39+ #include " misc/instance_create_info.h"
3940#include " misc/io.h"
4041#include " misc/memory_allocator.h"
4142#include " misc/object_tracker.h"
@@ -276,8 +277,14 @@ void App::draw_frame()
276277 present_wait_semaphore_ptr = curr_frame_signal_semaphore_ptr;
277278
278279 /* Determine the semaphore which the swapchain image */
279- n_swapchain_image = m_swapchain_ptr->acquire_image (curr_frame_wait_semaphore_ptr,
280- true ); /* in_should_block */
280+ {
281+ const auto acquire_result = m_swapchain_ptr->acquire_image (curr_frame_wait_semaphore_ptr,
282+ &n_swapchain_image,
283+ true ); /* in_should_block */
284+
285+ ANVIL_REDUNDANT_VARIABLE_CONST (acquire_result);
286+ anvil_assert (acquire_result == Anvil::SwapchainOperationErrorCode::SUCCESS);
287+ }
281288
282289 /* Submit work chunk and present */
283290 update_data_ub_contents (n_swapchain_image);
@@ -292,10 +299,18 @@ void App::draw_frame()
292299 false /* should_block */ )
293300 );
294301
295- present_queue_ptr->present (m_swapchain_ptr.get (),
296- n_swapchain_image,
297- 1 , /* n_wait_semaphores */
298- &present_wait_semaphore_ptr);
302+ {
303+ Anvil::SwapchainOperationErrorCode present_result = Anvil::SwapchainOperationErrorCode::DEVICE_LOST;
304+
305+ present_queue_ptr->present (m_swapchain_ptr.get (),
306+ n_swapchain_image,
307+ 1 , /* n_wait_semaphores */
308+ &present_wait_semaphore_ptr,
309+ &present_result);
310+
311+ ANVIL_REDUNDANT_VARIABLE (present_result);
312+ anvil_assert (present_result == Anvil::SwapchainOperationErrorCode::SUCCESS);
313+ }
299314
300315 ++n_frames_rendered;
301316
@@ -872,17 +887,21 @@ void App::init_window()
872887void App::init_vulkan ()
873888{
874889 /* Create a Vulkan instance */
875- m_instance_ptr = Anvil::Instance::create (APP_NAME, /* in_app_name */
876- APP_NAME, /* in_engine_name */
890+ {
891+ auto create_info_ptr = Anvil::InstanceCreateInfo::create (APP_NAME, /* in_app_name */
892+ APP_NAME, /* in_engine_name */
877893#ifdef ENABLE_VALIDATION
878- std::bind (&App::on_validation_callback,
879- this ,
880- std::placeholders::_1,
881- std::placeholders::_2),
894+ std::bind (&App::on_validation_callback,
895+ this ,
896+ std::placeholders::_1,
897+ std::placeholders::_2),
882898#else
883- Anvil::DebugCallbackFunction (),
899+ Anvil::DebugCallbackFunction (),
884900#endif
885- false ); /* in_mt_safe */
901+ false ); /* in_mt_safe */
902+
903+ m_instance_ptr = Anvil::Instance::create (std::move (create_info_ptr) );
904+ }
886905
887906 m_physical_device_ptr = m_instance_ptr->get_physical_device (0 );
888907
0 commit comments