Replaced FRAME_LAG with swapchain.num_images - 1 to be generic