Misc SurfaceData Optimizations (#7299)
* Misc SurfaceData Optimizations. This includes a few different optimizations found while trying to make the bulk query APIs faster: * Switches mutexes over to shared_lock to optimize for the multi-reader-single-writer pattern * Surface provider point creation now uses a pre-created set of masks to initialize with, and uses std::move() to move the created point into the output list instead of copying it. * Splits CombineSortAndFilterNeightboringPoints so that the FilterPoints() can occur separately and efficiently with erase/remove_if, and avoids making a copy of the output points. * Optimized SurfaceDataShapeComponent::ModifySurfacePoints * Fixed potential bug where the sort wasn't stable since it only compared the Z value, and could have produced unexpected results for differing points with the exact same Z value. * Fixed up a couple small bugs and missing checks in the unit tests Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com> * Fixed syntax on unit tests. Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
This commit is contained in:
@@ -93,10 +93,28 @@ namespace UnitTest
|
||||
// Compare two surface points.
|
||||
bool SurfacePointsAreEqual(const SurfaceData::SurfacePoint& lhs, const SurfaceData::SurfacePoint& rhs)
|
||||
{
|
||||
return (lhs.m_entityId == rhs.m_entityId)
|
||||
&& (lhs.m_position == rhs.m_position)
|
||||
&& (lhs.m_normal == rhs.m_normal)
|
||||
&& (lhs.m_masks == rhs.m_masks);
|
||||
if ((lhs.m_entityId != rhs.m_entityId)
|
||||
|| (lhs.m_position != rhs.m_position)
|
||||
|| (lhs.m_normal != rhs.m_normal)
|
||||
|| (lhs.m_masks.size() != rhs.m_masks.size()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto& mask : lhs.m_masks)
|
||||
{
|
||||
auto maskEntry = rhs.m_masks.find(mask.first);
|
||||
if (maskEntry == rhs.m_masks.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (maskEntry->second != mask.second)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Common test function for testing the "Provider" functionality of the component.
|
||||
|
||||
Reference in New Issue
Block a user