Switched Gradient Surface benchmarks to use actual surface components. (#7468)

* Switched Gradient Surface benchmarks to use actual surface components.
The gradient unit tests and benchmarks were previously using a mock surface data system, which led to misleading benchmark results. Now, the actual SurfaceData system gets constructed, and the tests use a mock provider, but the benchmarks use actual shape providers for more realistic benchmarking.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Fixed unit tests to have better query ranges.
Half of each previous range was querying outside the surface provider's data.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
This commit is contained in:
Mike Balfour
2022-02-08 15:00:19 -06:00
committed by GitHub
parent 48313cd6de
commit c46c558038
29 changed files with 252 additions and 129 deletions
@@ -13,11 +13,11 @@
namespace UnitTest
{
void GradientSignalTestHelpers::CompareGetValueAndGetValues(AZ::EntityId gradientEntityId, float shapeHalfBounds)
void GradientSignalTestHelpers::CompareGetValueAndGetValues(AZ::EntityId gradientEntityId, float queryMin, float queryMax)
{
// Create a gradient sampler and run through a series of points to see if they match expectations.
const AZ::Aabb queryRegion = AZ::Aabb::CreateFromMinMax(AZ::Vector3(-shapeHalfBounds), AZ::Vector3(shapeHalfBounds));
const AZ::Aabb queryRegion = AZ::Aabb::CreateFromMinMax(AZ::Vector3(queryMin), AZ::Vector3(queryMax));
const AZ::Vector2 stepSize(1.0f, 1.0f);
GradientSignal::GradientSampler gradientSampler;
@@ -118,6 +118,7 @@ namespace UnitTest
AZStd::vector<float> results(totalQueryPoints);
GradientSignal::GradientRequestBus::Event(
gradientId, &GradientSignal::GradientRequestBus::Events::GetValues, positions, results);
benchmark::DoNotOptimize(results);
}
}
@@ -174,6 +175,7 @@ namespace UnitTest
// Query and get the results.
AZStd::vector<float> results(totalQueryPoints);
gradientSampler.GetValues(positions, results);
benchmark::DoNotOptimize(results);
}
}