From a90a4f96c768a7f091c17fbb0892ad8939f396d7 Mon Sep 17 00:00:00 2001 From: Tony Barbour Date: Thu, 23 Mar 2017 13:25:36 -0600 Subject: demos: Wait for fences before destroying swapchain Addresses GH #1048 Change-Id: Ie94796bcd13dc506e1b97c483763df9023567ac6 --- demos/cube.c | 3 +++ demos/cube.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/demos/cube.c b/demos/cube.c index b1706a96..3e2733ee 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -997,6 +997,9 @@ static void demo_prepare_buffers(struct demo *demo) { // Note: destroying the swapchain also cleans up all its associated // presentable images once the platform is done with them. if (oldSwapchain != VK_NULL_HANDLE) { + // AMD driver times out waiting on fences used in AcquireNextImage on + // a swapchain that is subsequently destroyed before the wait. + vkWaitForFences(demo->device, FRAME_LAG, demo->fences, VK_TRUE, UINT64_MAX); demo->fpDestroySwapchainKHR(demo->device, oldSwapchain, NULL); } diff --git a/demos/cube.cpp b/demos/cube.cpp index 082ab4d0..588d1cd9 100644 --- a/demos/cube.cpp +++ b/demos/cube.cpp @@ -1339,6 +1339,9 @@ struct Demo { // Note: destroying the swapchain also cleans up all its associated // presentable images once the platform is done with them. if (oldSwapchain) { + // AMD driver times out waiting on fences used in AcquireNextImage on + // a swapchain that is subsequently destroyed before the wait. + device.waitForFences(FRAME_LAG, fences, VK_TRUE, UINT64_MAX); device.destroySwapchainKHR(oldSwapchain, nullptr); } -- cgit v1.2.3