MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / update

Method update

samples/api/hpp_hello_triangle/hpp_hello_triangle.cpp:199–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199void 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
239bool HPPHelloTriangle::resize(const uint32_t, const uint32_t)
240{

Callers 7

prepare_instance_dataMethod · 0.45
generate_quadMethod · 0.45
generate_terrainMethod · 0.45
generate_quadMethod · 0.45
generate_cubeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected