BVH - thread safety option

Added optional thread safe version through template argument and runtime switch, that wraps access with a mutex.
This commit is contained in:
lawnjelly
2021-05-18 20:36:25 +01:00
parent bb53fb028c
commit 14ce176f10
7 changed files with 75 additions and 3 deletions

View File

@@ -97,6 +97,11 @@ void VisualServerScene::camera_set_use_vertical_aspect(RID p_camera, bool p_enab
}
/* SPATIAL PARTITIONING */
VisualServerScene::SpatialPartitioningScene_BVH::SpatialPartitioningScene_BVH() {
_bvh.params_set_thread_safe(GLOBAL_GET("rendering/threads/thread_safe_bvh"));
}
VisualServerScene::SpatialPartitionID VisualServerScene::SpatialPartitioningScene_BVH::create(Instance *p_userdata, const AABB &p_aabb, int p_subindex, bool p_pairable, uint32_t p_pairable_type, uint32_t p_pairable_mask) {
#if defined(DEBUG_ENABLED) && defined(TOOLS_ENABLED)
// we are relying on this instance to be valid in order to pass