Updated all array_view uses with the C++20 span. (#7157)

* Updated all array_view uses with the C++20 span.

The updates were done in the following order
1. `AZStd::array_view<([^>].+)\* ?>`  -> `AZStd::span<\1 const>`
2. `AZStd::array_view<(?:const )(.+)>` -> `AZStd::span<const \1>`
3. `AZStd::array_view` -> `AZStd::span`

Removed the implementation of array_view.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Added missing whitespace between `const` and the typename for spans.

Updated the ShaderTest comparison of the ShaderResourceGroupLayout span
to compare the sizes as well

Updated comments on some of the methods that stated that they return "an
array" to mention they return "a span".

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
lumberyard-employee-dm
2022-01-26 16:15:47 -06:00
committed by GitHub
parent 48cea89910
commit b9824ed172
170 changed files with 833 additions and 1274 deletions
@@ -8,13 +8,15 @@
#include <Atom/Utils/ImageComparison.h>
#include <AzCore/Casting/numeric_cast.h>
namespace AZ
{
namespace Utils
{
ImageDiffResultCode CalcImageDiffRms(
AZStd::array_view<uint8_t> bufferA, const RHI::Size& sizeA, RHI::Format formatA,
AZStd::array_view<uint8_t> bufferB, const RHI::Size& sizeB, RHI::Format formatB,
AZStd::span<const uint8_t> bufferA, const RHI::Size& sizeA, RHI::Format formatA,
AZStd::span<const uint8_t> bufferB, const RHI::Size& sizeB, RHI::Format formatB,
float* diffScore,
float* filteredDiffScore,
float minDiffFilter)
+2 -2
View File
@@ -28,7 +28,7 @@ namespace AZ
}
}
PngFile PngFile::Create(const RHI::Size& size, RHI::Format format, AZStd::array_view<uint8_t> data, ErrorHandler errorHandler)
PngFile PngFile::Create(const RHI::Size& size, RHI::Format format, AZStd::span<const uint8_t> data, ErrorHandler errorHandler)
{
return Create(size, format, AZStd::vector<uint8_t>{data.begin(), data.end()}, errorHandler);
}
@@ -89,7 +89,7 @@ namespace AZ
return pngFile;
}
PngFile PngFile::LoadFromBuffer(AZStd::array_view<uint8_t> data, LoadSettings loadSettings)
PngFile PngFile::LoadFromBuffer(AZStd::span<const uint8_t> data, LoadSettings loadSettings)
{
if (!loadSettings.m_errorHandler)
{
+2 -2
View File
@@ -11,7 +11,7 @@
namespace AZ
{
AZStd::vector<uint8_t> Utils::PpmFile::CreatePpmFromImageBuffer(AZStd::array_view<uint8_t> buffer, const RHI::Size& size, RHI::Format format)
AZStd::vector<uint8_t> Utils::PpmFile::CreatePpmFromImageBuffer(AZStd::span<const uint8_t> buffer, const RHI::Size& size, RHI::Format format)
{
AZ_Assert(format == RHI::Format::R8G8B8A8_UNORM || format == RHI::Format::B8G8R8A8_UNORM, "CreatePpmFromImageReadbackResult only supports R8G8B8A8_UNORM");
@@ -46,7 +46,7 @@ namespace AZ
return outBuffer;
}
bool Utils::PpmFile::CreateImageBufferFromPpm(AZStd::array_view<uint8_t> ppmData, AZStd::vector<uint8_t>& buffer, RHI::Size& size, RHI::Format& format)
bool Utils::PpmFile::CreateImageBufferFromPpm(AZStd::span<const uint8_t> ppmData, AZStd::vector<uint8_t>& buffer, RHI::Size& size, RHI::Format& format)
{
if (ppmData.size() < 2)
{