Kaynağa Gözat

Don't crash when submitting the default command buffer on dx11/openGL

BearishSun 9 yıl önce
ebeveyn
işleme
4da4023c27

+ 3 - 0
Source/BansheeD3D11RenderAPI/Source/BsD3D11RenderAPI.cpp

@@ -1080,6 +1080,9 @@ namespace bs
 	void D3D11RenderAPI::submitCommandBuffer(const SPtr<CommandBuffer>& commandBuffer, UINT32 syncMask)
 	void D3D11RenderAPI::submitCommandBuffer(const SPtr<CommandBuffer>& commandBuffer, UINT32 syncMask)
 	{
 	{
 		SPtr<D3D11CommandBuffer> cb = std::static_pointer_cast<D3D11CommandBuffer>(commandBuffer);
 		SPtr<D3D11CommandBuffer> cb = std::static_pointer_cast<D3D11CommandBuffer>(commandBuffer);
+		if (cb == nullptr)
+			return;
+
 		cb->executeCommands();
 		cb->executeCommands();
 		cb->clear();
 		cb->clear();
 	}
 	}

+ 3 - 0
Source/BansheeGLRenderAPI/Source/BsGLRenderAPI.cpp

@@ -1111,6 +1111,9 @@ namespace bs
 	void GLRenderAPI::submitCommandBuffer(const SPtr<CommandBuffer>& commandBuffer, UINT32 syncMask)
 	void GLRenderAPI::submitCommandBuffer(const SPtr<CommandBuffer>& commandBuffer, UINT32 syncMask)
 	{
 	{
 		SPtr<GLCommandBuffer> cb = std::static_pointer_cast<GLCommandBuffer>(commandBuffer);
 		SPtr<GLCommandBuffer> cb = std::static_pointer_cast<GLCommandBuffer>(commandBuffer);
+		if (cb == nullptr)
+			return;
+
 		cb->executeCommands();
 		cb->executeCommands();
 		cb->clear();
 		cb->clear();
 	}
 	}