demos: Use do-while instead of clunky while
authorTony Barbour <tony@LunarG.com>
Thu, 29 Jun 2017 19:34:41 +0000 (13:34 -0600)
committerTony Barbour <tony@LunarG.com>
Thu, 29 Jun 2017 19:34:41 +0000 (13:34 -0600)
When acquiring swapchain images

Change-Id: I8c502e06490f73fc5c9cd8057cd12869a66ea942

demos/cube.c

index a6d68a1..576f0a4 100644 (file)
@@ -957,8 +957,7 @@ static void demo_draw(struct demo *demo) {
     vkWaitForFences(demo->device, 1, &demo->fences[demo->frame_index], VK_TRUE, UINT64_MAX);
     vkResetFences(demo->device, 1, &demo->fences[demo->frame_index]);
 
-    err = !(VK_SUCCESS);
-    while (err != VK_SUCCESS) {
+    do {
         // Get the index of the next available swapchain image:
         err = demo->fpAcquireNextImageKHR(demo->device, demo->swapchain, UINT64_MAX,
                                           demo->image_acquired_semaphores[demo->frame_index],
@@ -975,7 +974,7 @@ static void demo_draw(struct demo *demo) {
         } else {
             assert(!err);
         }
-    }
+    } while (err != VK_SUCCESS);
 
     demo_update_data_buffer(demo);