From fabb251458f4a2d6d4f87dd36038fac2774b378c Mon Sep 17 00:00:00 2001 From: Marijn Tamis Date: Fri, 20 Oct 2017 14:30:56 +0200 Subject: NvCloth 1.1.3 Release. (23014067) --- NvCloth/src/SwSolver.cpp | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'NvCloth/src/SwSolver.cpp') diff --git a/NvCloth/src/SwSolver.cpp b/NvCloth/src/SwSolver.cpp index c7437e1..f0f9152 100644 --- a/NvCloth/src/SwSolver.cpp +++ b/NvCloth/src/SwSolver.cpp @@ -50,7 +50,7 @@ bool neonSolverKernel(SwCloth const&, SwClothData&, SwKernelAllocator&, Iteratio } using namespace nv; - +using namespace cloth; #if NV_SIMD_SIMD typedef Simd4f Simd4fType; #else @@ -93,12 +93,17 @@ void sortTasks(shdfnd::Array& tasks) void cloth::SwSolver::addCloth(Cloth* cloth) { - SwCloth& swCloth = *static_cast(cloth); - - mSimulatedCloths.pushBack(SimulatedCloth(swCloth, this)); + addClothAppend(cloth); sortTasks(mSimulatedCloths); +} - mCloths.pushBack(&swCloth); +void cloth::SwSolver::addCloths(Range cloths) +{ + for (uint32_t i = 0; i < cloths.size(); ++i) + { + addClothAppend(*(cloths.begin() + i)); + } + sortTasks(mSimulatedCloths); } void cloth::SwSolver::removeCloth(Cloth* cloth) @@ -221,6 +226,16 @@ void cloth::SwSolver::interCollision() collider(); } +void cloth::SwSolver::addClothAppend(Cloth* cloth) +{ + SwCloth& swCloth = *static_cast(cloth); + NV_CLOTH_ASSERT(mCloths.find(&swCloth) == mCloths.end()); + + mSimulatedCloths.pushBack(SimulatedCloth(swCloth, this)); + + mCloths.pushBack(&swCloth); +} + void cloth::SwSolver::beginFrame() const { mSimulateProfileEventData = NV_CLOTH_PROFILE_START_CROSSTHREAD("cloth::SwSolver::simulate", 0); @@ -287,9 +302,14 @@ void cloth::SwSolver::SimulatedCloth::Simulate() // construct kernel functor and execute #if NV_ANDROID - // if (!neonSolverKernel(cloth, data, allocator, factory)) -#endif + if (!neonSolverKernel(*mCloth, data, allocator, factory)) + { + //NV_CLOTH_LOG_WARNING("No NEON CPU support detected. Falling back to scalar types."); + SwSolverKernel(*mCloth, data, allocator, factory)(); + } +#else SwSolverKernel(*mCloth, data, allocator, factory)(); +#endif data.reconcile(*mCloth); // update cloth } -- cgit v1.2.3