mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-23 03:47:34 -04:00
Merge branch 'fix_clamp_physics_threads' into 'master'
Fix clamping physics threads See merge request OpenMW/openmw!2792 (cherry picked from commit fbb00027d83b2f2964443b5a5c65d12217af9b36) 3d3cccb8 Fix clamping physics threads
This commit is contained in:
parent
a7116aacbc
commit
5dfd2709b7
@ -322,8 +322,8 @@ namespace MWPhysics
|
|||||||
case LockingPolicy::ExclusiveLocksOnly:
|
case LockingPolicy::ExclusiveLocksOnly:
|
||||||
return 1;
|
return 1;
|
||||||
case LockingPolicy::AllowSharedLocks:
|
case LockingPolicy::AllowSharedLocks:
|
||||||
return static_cast<unsigned>(std::max(
|
return static_cast<unsigned>(std::clamp(
|
||||||
getMaxBulletSupportedThreads(), Settings::Manager::getInt("async num threads", "Physics")));
|
Settings::Manager::getInt("async num threads", "Physics"), 0, getMaxBulletSupportedThreads()));
|
||||||
}
|
}
|
||||||
|
|
||||||
throw std::runtime_error("Unsupported LockingPolicy: "
|
throw std::runtime_error("Unsupported LockingPolicy: "
|
||||||
@ -363,6 +363,7 @@ namespace MWPhysics
|
|||||||
{
|
{
|
||||||
if (mNumThreads >= 1)
|
if (mNumThreads >= 1)
|
||||||
{
|
{
|
||||||
|
Log(Debug::Info) << "Using " << mNumThreads << " async physics threads";
|
||||||
for (unsigned i = 0; i < mNumThreads; ++i)
|
for (unsigned i = 0; i < mNumThreads; ++i)
|
||||||
mThreads.emplace_back([&] { worker(); } );
|
mThreads.emplace_back([&] { worker(); } );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user