| 1953 | |
| 1954 | #if defined(LIQUIDFUN_SIMD_NEON) |
| 1955 | void b2ParticleSystem::FindContacts_Simd( |
| 1956 | b2GrowableBuffer<b2ParticleContact>& contacts) const |
| 1957 | { |
| 1958 | contacts.SetCount(0); |
| 1959 | |
| 1960 | const int alignedCount = m_count + NUM_V32_SLOTS; |
| 1961 | FindContactInput* reordered = (FindContactInput*) |
| 1962 | m_world->m_stackAllocator.Allocate( |
| 1963 | sizeof(FindContactInput) * alignedCount); |
| 1964 | |
| 1965 | // Put positions and indices into proxy-order. |
| 1966 | // This allows us to efficiently check for contacts using SIMD. |
| 1967 | ReorderForFindContact(reordered, alignedCount); |
| 1968 | |
| 1969 | // Perform broad-band contact check using tags to approximate |
| 1970 | // positions. This reduces the number of narrow-band contact checks |
| 1971 | // that use actual positions. |
| 1972 | static const int MAX_EXPECTED_CHECKS_PER_PARTICLE = 3; |
| 1973 | b2GrowableBuffer<FindContactCheck> checks(m_world->m_blockAllocator); |
| 1974 | checks.Reserve(MAX_EXPECTED_CHECKS_PER_PARTICLE * m_count); |
| 1975 | GatherChecks(checks); |
| 1976 | |
| 1977 | // Perform narrow-band contact checks using actual positions. |
| 1978 | // Any particles whose centers are within one diameter of each other are |
| 1979 | // considered contacting. |
| 1980 | FindContactsFromChecks_Simd(reordered, checks.Data(), checks.GetCount(), |
| 1981 | m_squaredDiameter, m_inverseDiameter, |
| 1982 | m_flagsBuffer.data, contacts); |
| 1983 | |
| 1984 | m_world->m_stackAllocator.Free(reordered); |
| 1985 | } |
| 1986 | #endif // defined(LIQUIDFUN_SIMD_NEON) |
| 1987 | |
| 1988 | LIQUIDFUN_SIMD_INLINE |