Assume we want to draw a single object. We want the object to appear directly on screen so, before we begin, we must acquire a swapchain image (refer to the Acquiring a swapchain image recipe from Chapter 2, Image Presentation). Next, we start recording the command buffer (refer to the Beginning a command buffer recording operation recipe from Chapter 3, Command Buffers and Synchronization):
if( !BeginCommandBufferRecordingOperation( command_buffer, VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, nullptr ) ) { return false; }
The first thing we need to record is to change the swapchain image's layout to a VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL layout. This operation should be performed implicitly using appropriate render ...