Skip to content

Commit

Permalink
clear command buffer on device lost
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenegff committed Jan 14, 2025
1 parent 90e84b1 commit b52d0c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions OgreMain/include/CommandBuffer/OgreCommandBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ namespace Ogre
static CommandBufferExecuteFunc execute_lowLevelMaterial;
static CommandBufferExecuteFunc execute_invalidCommand;

void clear();

/// Executes all the commands in the command buffer. Clears the cmd buffer afterwards
void execute();

Expand Down
2 changes: 2 additions & 0 deletions OgreMain/src/CommandBuffer/OgreCommandBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ namespace Ogre
"CommandBuffer::execute_setInvalidCommand" );
}
//-----------------------------------------------------------------------------------
void CommandBuffer::clear() { mCommandBuffer.clear(); }
//-----------------------------------------------------------------------------------
void CommandBuffer::execute()
{
unsigned char const *RESTRICT_ALIAS cmdBase = mCommandBuffer.begin();
Expand Down
6 changes: 4 additions & 2 deletions OgreMain/src/OgreRenderQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,15 @@ namespace Ogre
//---------------------------------------------------------------------
RenderQueue::~RenderQueue()
{
delete mCommandBuffer;

_releaseManualHardwareResources();

delete mCommandBuffer;
}
//-----------------------------------------------------------------------
void RenderQueue::_releaseManualHardwareResources()
{
mCommandBuffer->clear();

for( IndirectBufferPacked *buf : mUsedIndirectBuffers )
{
if( buf->getMappingState() != MS_UNMAPPED )
Expand Down

0 comments on commit b52d0c2

Please sign in to comment.