-
-
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: Improve frustum culling performance. (#701)
* UPBGE: Improve frustum culling performance. Frustum culling was improved in two ways. First, simplificate the bounding box update. Second the test are parallelized using TBB range loop. The bounding box update is simplified by adding the call to RAS_Deformer::UpdateBuckets in KX_GameObject::UpdateBounds after we checked that the objects as a bounding box. By doing this we avoid a call to GetDeformer for all objects without a bounding box, with an unmodified bounding box or without auto update. All the computation of culling objects is moved into KX_CullingHandler, this class construct it's own objects list and returns it in Process function. Process function build a CullTask and launch it usign tbb::parallal_reduce. Each CullTask have an operator() to test a range of object, any objects passing the culling test is added in a task local objects list. Once the tests finished the CullTask merge these objects list in function join to end up with the list of all non-culled objects. This technique of reduce of list is way better than using a shared object list for all tasks and lock a mutex before adding an object. The method with mutex was always slower than without parallelization. This patch was tested with cube meshes : number of object | previous time | new time 1000 | 0.06 | 0.07 8000 | 1.04 | 0.55 27000 | 3.81 | 1.90 125000 | 16.16 | 8.31
- Loading branch information
1 parent
3257be1
commit 20e9ff0
Showing
14 changed files
with
140 additions
and
100 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
Oops, something went wrong.