3 ms·
It would be tricky: constraint solving is a single-threaded algorithm, so the best option might be to run the broad-phase, and then break the scene down into is
by Diggsey 6y ago
It would be tricky: constraint solving is a single-threaded algorithm, so the best option might be to run the broad-phase, and then break the scene down into islands of disconnected bodies for parallel constraint solving.
The problems are that:
1) There may not be enough islands to make full use of the available threads.
2) For many frames there might be a single island which is particularly expensive to solve, so the benefit from parallelisation is reduced.
The broad-phase itself might benefit significantly from parallelisation though.
- rossnordby 6y agoWhile island based parallelism is doable and works reasonably well for many workloads, it's possible to dynamically batch constraints based on their involved bodies such that no constraints in a given batch share the same bodies. All constraints within each batch can be solved in parallel. Of course, pathological cases can generate a ton of batches. Usually such implementations will use a final 'catchall' batch of some kind after N normal batches. That final batch can be handled sequentially or with a fully parallel jacobi-ish solver (which typically has worse convergence than PGS/SI, but it's usually not a problem in context).