| 197 | } |
| 198 | |
| 199 | void HPPHelloTriangle::update(float delta_time) |
| 200 | { |
| 201 | vk::Result res; |
| 202 | uint32_t index; |
| 203 | std::tie(res, index) = acquire_next_image(); |
| 204 | |
| 205 | // Handle outdated error in acquire. |
| 206 | if (res == vk::Result::eSuboptimalKHR || res == vk::Result::eErrorOutOfDateKHR) |
| 207 | { |
| 208 | resize(swapchain_data.extent.width, swapchain_data.extent.height); |
| 209 | std::tie(res, index) = acquire_next_image(); |
| 210 | } |
| 211 | |
| 212 | if (res != vk::Result::eSuccess) |
| 213 | { |
| 214 | queue.waitIdle(); |
| 215 | return; |
| 216 | } |
| 217 | |
| 218 | render_triangle(index); |
| 219 | |
| 220 | // Present swapchain image |
| 221 | vk::PresentInfoKHR present_info{.waitSemaphoreCount = 1, |
| 222 | .pWaitSemaphores = &per_frame_data[index].swapchain_release_semaphore, |
| 223 | .swapchainCount = 1, |
| 224 | .pSwapchains = &swapchain_data.swapchain, |
| 225 | .pImageIndices = &index}; |
| 226 | res = queue.presentKHR(present_info); |
| 227 | |
| 228 | // Handle Outdated error in present. |
| 229 | if (res == vk::Result::eSuboptimalKHR || res == vk::Result::eErrorOutOfDateKHR) |
| 230 | { |
| 231 | resize(swapchain_data.extent.width, swapchain_data.extent.height); |
| 232 | } |
| 233 | else if (res != vk::Result::eSuccess) |
| 234 | { |
| 235 | LOGE("Failed to present swapchain image."); |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | bool HPPHelloTriangle::resize(const uint32_t, const uint32_t) |
| 240 | { |
no outgoing calls
no test coverage detected