Skip to content

Commit

Permalink
[Vk] Don't stall in VulkanRenderSystem::destroyVkResources0() when de…
Browse files Browse the repository at this point in the history
…vice is lost. Also, RenderQueue::mUsedIndirectBuffers could be non empty after device lost.
  • Loading branch information
eugenegff committed Dec 30, 2024
1 parent 62eff2c commit 16a9c7b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
21 changes: 11 additions & 10 deletions OgreMain/src/OgreRenderQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,20 @@ namespace Ogre
//-----------------------------------------------------------------------
void RenderQueue::_releaseManualHardwareResources()
{
assert( mUsedIndirectBuffers.empty() );

IndirectBufferPackedVec::const_iterator itor = mFreeIndirectBuffers.begin();
IndirectBufferPackedVec::const_iterator endt = mFreeIndirectBuffers.end();

while( itor != endt )
for( IndirectBufferPacked *buf : mUsedIndirectBuffers )
{
if( ( *itor )->getMappingState() != MS_UNMAPPED )
( *itor )->unmap( UO_UNMAP_ALL );
mVaoManager->destroyIndirectBuffer( *itor );
++itor;
if( buf->getMappingState() != MS_UNMAPPED )
buf->unmap( UO_UNMAP_ALL );
mVaoManager->destroyIndirectBuffer( buf );
}
mUsedIndirectBuffers.clear();

for( IndirectBufferPacked *buf : mFreeIndirectBuffers )
{
if( buf->getMappingState() != MS_UNMAPPED )
buf->unmap( UO_UNMAP_ALL );
mVaoManager->destroyIndirectBuffer( buf );
}
mFreeIndirectBuffers.clear();
}
//-----------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ namespace Ogre
mCurrentAutoParamsBufferPtr = 0;
mCurrentAutoParamsBufferSpaceLeft = 0;

mDevice->stall();
if( !mDevice->isDeviceLost() )
mDevice->stall();
}
//-------------------------------------------------------------------------
void VulkanRenderSystem::destroyVkResources1()
Expand Down

0 comments on commit 16a9c7b

Please sign in to comment.