You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Crash in Vulkan backend during window resize on Linux
#9475
I've been getting a 100% repro crash with an up-to-date sync of filament. When using the window resize handles in any of the samples, filament crashes.
I tracked this down to VulkanSwapChain::acquire(bool). During the first acquire after the has_resized() function returns true, the vkswapchain gets recreated and updated, and then mPlatform->acquire is called. That calls vkAcquireNextImageKHR which returns VK_ERROR_OUT_OF_DATE_KHR, and on my system at least, that Vulkan call doesn't write anything to &outImageSyncData->imageIndex. So mCurrentSwapIndex remains at INVALID_IMAGE_INDEX (= UINT_MAX) and mFinishedDrawing[mCurrentSwapIndex] = {}; crashes when attempting to access the array out of bounds.
I have what looks like a fix, at least on my system, so I'm passing it along in case it helps. On the line: if ((resized = mPlatform->hasResized(swapChain))), I just replaced the "if" with a "while". The thinking was that the OS was spamming window resize events so quickly that the new swapchain's surfaces were out of date before the swapchain could even be returned. Repeating the hasResized check until it returned false seems to have ensured the next image is valid when we get out of the loop and I no longer see crashes when resizing windows.
The samples now occasionally exhibit timing issues where the View's Viewport doesn't set up correctly for the final size of the window, but I figure I can work around that at the application level.
Whoops. Sorry, saw you filed the bug and switched my page over to track that. Then I saw you submitted a fix so I just verified it was working. I assume you don't need the comment any more since the fix is working, right?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I've been getting a 100% repro crash with an up-to-date sync of filament. When using the window resize handles in any of the samples, filament crashes.
I tracked this down to VulkanSwapChain::acquire(bool). During the first acquire after the has_resized() function returns true, the vkswapchain gets recreated and updated, and then mPlatform->acquire is called. That calls vkAcquireNextImageKHR which returns VK_ERROR_OUT_OF_DATE_KHR, and on my system at least, that Vulkan call doesn't write anything to &outImageSyncData->imageIndex. So mCurrentSwapIndex remains at INVALID_IMAGE_INDEX (= UINT_MAX) and mFinishedDrawing[mCurrentSwapIndex] = {}; crashes when attempting to access the array out of bounds.
I have what looks like a fix, at least on my system, so I'm passing it along in case it helps. On the line: if ((resized = mPlatform->hasResized(swapChain))), I just replaced the "if" with a "while". The thinking was that the OS was spamming window resize events so quickly that the new swapchain's surfaces were out of date before the swapchain could even be returned. Repeating the hasResized check until it returned false seems to have ensured the next image is valid when we get out of the loop and I no longer see crashes when resizing windows.
The samples now occasionally exhibit timing issues where the View's Viewport doesn't set up correctly for the final size of the window, but I figure I can work around that at the application level.
All reactions