diff options
author | reduz <reduzio@gmail.com> | 2022-02-05 11:59:34 +0100 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2022-02-05 11:59:34 +0100 |
commit | 74adf0bf2e171353c33cd47ed67ec5ee040a284a (patch) | |
tree | 620cc081cf40b385eff2ebebc7d7fe8072f3dd8b /servers | |
parent | df1724470d1cff4f67aeb4c0d039114373aeb001 (diff) |
Remove RID_Owner.get_rid_by_index
* Implementing this function efficiently is not really possible.
* Replaced by an option to get all RIDs into a buffer for performance.
Diffstat (limited to 'servers')
-rw-r--r-- | servers/rendering/renderer_scene_cull.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp index 8ded180633..5b2be8e174 100644 --- a/servers/rendering/renderer_scene_cull.cpp +++ b/servers/rendering/renderer_scene_cull.cpp @@ -3871,8 +3871,12 @@ void RendererSceneCull::update_dirty_instances() { void RendererSceneCull::update() { //optimize bvhs - for (uint32_t i = 0; i < scenario_owner.get_rid_count(); i++) { - Scenario *s = scenario_owner.get_ptr_by_index(i); + + uint32_t rid_count = scenario_owner.get_rid_count(); + RID *rids = (RID *)alloca(sizeof(RID) * rid_count); + scenario_owner.fill_owned_buffer(rids); + for (uint32_t i = 0; i < rid_count; i++) { + Scenario *s = scenario_owner.get_or_null(rids[i]); s->indexers[Scenario::INDEXER_GEOMETRY].optimize_incremental(indexer_update_iterations); s->indexers[Scenario::INDEXER_VOLUMES].optimize_incremental(indexer_update_iterations); } |