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

Method update

samples/api/hello_triangle/hello_triangle.cpp:1113–1144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1111}
1112
1113void 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
1146bool HelloTriangle::resize(const uint32_t, const uint32_t)
1147{

Callers 4

generate_cubeMethod · 0.45
generate_quadMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected