-
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPBGE: Restore UpdateIPO with mutex.
Previously the game object sg controllers were update after the action were updated, this behaviour is the only one safe, but the update of the IPO was costing a lot of time because we iterate again over all the action from the action manager and that this operation was not parallelized. The update IPO of an object is updating the conroller from the scene graph node of this object and updating the spacial data of this node (position…) The spcial data update is proceeded for the children of the node too. To parallelize this operation we have to make sure that nodes of the familly are not updated in the same time. The familly is the shared instance between all the nodes from the root parent node included. This familly is the new SG_Familly class which is for the moment only containing a mutex for the IPO update, this mutex is bound in two news functions used only for parallelizme: SG_Node::UpdateWorldDataThread and SG_Node::SetSimulatedTimeThread. Every nodes are instanciated with a new familly and reuse an existing familly when they are set to child of an other node. The familly mutex is not the only mutex used, there are two other for schedule list update and node transform. The last one is for the bullet implementation which is modifying a AABB manager. Now that the update IPO can be parallelized the call of BL_Action::UpdateIPO is moved into a second loop in BL_ActionManager::Update. The function BL_Action::UpdateIPO is also optimized. It use a flag named m_requestIpo set to true in BL_Action::Update when the action is not finished, not redundant and applied to the object. In KX_Scene the task pool is created only once to avoid spending time recreating it. It is stored into m_animationPool. Fix issue #388.
- Loading branch information
1 parent
d5ed120
commit 2b3405a
Showing
16 changed files
with
248 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* ***** BEGIN GPL LICENSE BLOCK ***** | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. | ||
* All rights reserved. | ||
* | ||
* The Original Code is: all of this file. | ||
* | ||
* Contributor(s): none yet. | ||
* | ||
* ***** END GPL LICENSE BLOCK ***** | ||
*/ | ||
|
||
/** \file gameengine/SceneGraph/SG_Familly.cpp | ||
* \ingroup bgesg | ||
*/ | ||
|
||
#include "SG_Familly.h" | ||
|
||
CM_ThreadSpinLock& SG_Familly::GetMutex() | ||
{ | ||
return m_mutex; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Implementationclass to derive controllers from | ||
* | ||
* | ||
* ***** BEGIN GPL LICENSE BLOCK ***** | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. | ||
* All rights reserved. | ||
* | ||
* The Original Code is: all of this file. | ||
* | ||
* Contributor(s): none yet. | ||
* | ||
* ***** END GPL LICENSE BLOCK ***** | ||
*/ | ||
|
||
/** \file SG_Familly.h | ||
* \ingroup bgesg | ||
*/ | ||
|
||
#ifndef __SG_FAMILLY_H__ | ||
#define __SG_FAMILLY_H__ | ||
|
||
#include "CM_Thread.h" | ||
|
||
class SG_Familly | ||
{ | ||
private: | ||
CM_ThreadSpinLock m_mutex; | ||
|
||
public: | ||
SG_Familly() = default; | ||
~SG_Familly() = default; | ||
|
||
CM_ThreadSpinLock& GetMutex(); | ||
|
||
}; | ||
|
||
#endif /* __SG_FAMILLY_H__ */ |
Oops, something went wrong.