Fix and enable failed gradient signal tests on Linux
* Fix failure reason for PerlinGradientComponent_GoldenTest: non-standard behavior of std::shuffle producing different results across platforms * Fix failure reason for GradientImageAssetConversionU8SingleScale: Undefined behavior when float casts to a uint8 has overflow Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com>
This commit is contained in:
@@ -111,7 +111,10 @@ namespace
|
||||
constexpr auto numChannels = 1;
|
||||
constexpr auto bytesPerPixel = numChannels * sizeof(AZ::u8);
|
||||
constexpr auto outputSize = imageDimensions * imageDimensions;
|
||||
constexpr auto scaling = 25;
|
||||
// Adjust the test scale so that none of the input data overflows the cast to AZ::u8.
|
||||
// The overflow behavior when casting from float to uint8 is undefined so we want to
|
||||
// avoid that consistently across all platforms
|
||||
constexpr auto scaling = 255.0f / aznumeric_cast<float>(imageDimensions * imageDimensions);
|
||||
|
||||
auto inputData = Detail::GenerateInput<AZ::u8, imageDimensions, numChannels>(scaling);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user