BVH - fix lockguards for multithread mode

Due to a lack of variable name, the BVH lock guards lifetimes previously did not cover the whole function call.

(cherry picked from commit 5639be5f4f)
This commit is contained in:
lawnjelly 2023-02-20 15:38:51 +00:00 committed by Rémi Verschelde
parent dbf82ea121
commit c2e9cc4542
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 2 additions and 2 deletions

View File

@ -55,7 +55,7 @@
#include "core/os/mutex.h"
#define BVHTREE_CLASS BVH_Tree<T, NUM_TREES, 2, MAX_ITEMS, USER_PAIR_TEST_FUNCTION, USER_CULL_TEST_FUNCTION, USE_PAIRS, BOUNDS, POINT>
#define BVH_LOCKED_FUNCTION BVHLockedFunction(&_mutex, BVH_THREAD_SAFE &&_thread_safe);
#define BVH_LOCKED_FUNCTION BVHLockedFunction _lock_guard(&_mutex, BVH_THREAD_SAFE &&_thread_safe);
template <class T, int NUM_TREES = 1, bool USE_PAIRS = false, int MAX_ITEMS = 32, class USER_PAIR_TEST_FUNCTION = BVH_DummyPairTestFunction<T>, class USER_CULL_TEST_FUNCTION = BVH_DummyCullTestFunction<T>, class BOUNDS = AABB, class POINT = Vector3, bool BVH_THREAD_SAFE = true>
class BVH_Manager {
@ -776,7 +776,7 @@ private:
_mutex = p_mutex;
if (_mutex->try_lock() != OK) {
WARN_PRINT("Info : multithread BVH access detected (benign)");
WARN_PRINT_ONCE("Info : multithread BVH access detected (benign)");
_mutex->lock();
}