Skip to content

Commit

Permalink
[Vulkan] stall device inside VulkanAndroidWindow::destroy() to handle…
Browse files Browse the repository at this point in the history
… more scenarios of DEVICE_LOST
  • Loading branch information
eugenegff committed Sep 2, 2024
1 parent f99918b commit 95dbec0
Showing 1 changed file with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ namespace Ogre
//-----------------------------------------------------------------------------------
void VulkanAndroidWindow::destroy()
{
if( mNativeWindow )
{
// Android is destroying our window. Possibly user pressed the home or power
// button.
//
// We must flush all our references to the old swapchain otherwise when
// the app goes to foreground again and submit that stale content Mali
// will return DEVICE_LOST
mDevice->stall();
}

VulkanWindowSwapChainBased::destroy();

if( mClosed )
Expand Down Expand Up @@ -349,22 +360,10 @@ namespace Ogre
//-------------------------------------------------------------------------
void VulkanAndroidWindow::setNativeWindow( ANativeWindow *nativeWindow )
{
if( mNativeWindow && !nativeWindow )
{
// Android is destroying our window. Likely user pressed the home or power
// button.
//
// We must flush all our references to the old swapchain otherwise when
// the app goes to foreground again and submit that stale content Mali
// will return DEVICE_LOST
mDevice->stall();
}

#ifdef OGRE_VULKAN_USE_SWAPPY
if( mSwapchain && mDevice->mRenderSystem->getSwappyFramePacing() )
SwappyVk_setWindow( mDevice->mDevice, mSwapchain, mNativeWindow );
#endif

destroy();

// Depth & Stencil buffer are normal textures; thus they need to be reeinitialized normally
Expand Down

0 comments on commit 95dbec0

Please sign in to comment.