diff --git a/OgreMain/include/CommandBuffer/OgreCommandBuffer.h b/OgreMain/include/CommandBuffer/OgreCommandBuffer.h index 48835fcb497..a3a31241a1c 100644 --- a/OgreMain/include/CommandBuffer/OgreCommandBuffer.h +++ b/OgreMain/include/CommandBuffer/OgreCommandBuffer.h @@ -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(); diff --git a/OgreMain/src/CommandBuffer/OgreCommandBuffer.cpp b/OgreMain/src/CommandBuffer/OgreCommandBuffer.cpp index c08c67d6c76..672ee84872f 100644 --- a/OgreMain/src/CommandBuffer/OgreCommandBuffer.cpp +++ b/OgreMain/src/CommandBuffer/OgreCommandBuffer.cpp @@ -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(); diff --git a/OgreMain/src/OgreRenderQueue.cpp b/OgreMain/src/OgreRenderQueue.cpp index 68b60303544..813aec2355e 100644 --- a/OgreMain/src/OgreRenderQueue.cpp +++ b/OgreMain/src/OgreRenderQueue.cpp @@ -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 )