| 1111 | } |
| 1112 | |
| 1113 | void HelloTriangle::update(float delta_time) |
| 1114 | { |
| 1115 | uint32_t index; |
| 1116 | |
| 1117 | auto res = acquire_next_image(&index); |
| 1118 | |
| 1119 | // Handle outdated error in acquire. |
| 1120 | if (res == VK_SUBOPTIMAL_KHR || res == VK_ERROR_OUT_OF_DATE_KHR) |
| 1121 | { |
| 1122 | resize(context.swapchain_dimensions.width, context.swapchain_dimensions.height); |
| 1123 | res = acquire_next_image(&index); |
| 1124 | } |
| 1125 | |
| 1126 | if (res != VK_SUCCESS) |
| 1127 | { |
| 1128 | vkQueueWaitIdle(context.queue); |
| 1129 | return; |
| 1130 | } |
| 1131 | |
| 1132 | render_triangle(index); |
| 1133 | res = present_image(index); |
| 1134 | |
| 1135 | // Handle Outdated error in present. |
| 1136 | if (res == VK_SUBOPTIMAL_KHR || res == VK_ERROR_OUT_OF_DATE_KHR) |
| 1137 | { |
| 1138 | resize(context.swapchain_dimensions.width, context.swapchain_dimensions.height); |
| 1139 | } |
| 1140 | else if (res != VK_SUCCESS) |
| 1141 | { |
| 1142 | LOGE("Failed to present swapchain image."); |
| 1143 | } |
| 1144 | } |
| 1145 | |
| 1146 | bool HelloTriangle::resize(const uint32_t, const uint32_t) |
| 1147 | { |
no outgoing calls
no test coverage detected