Merge branch 'development' of https://github.com/o3de/o3de into cgalvan/DraftStreamingImageAssetPixelAPI

This commit is contained in:
Chris Galvan
2022-01-26 16:46:58 -06:00
170 changed files with 833 additions and 1274 deletions
@@ -9,7 +9,7 @@
#pragma once
#include <AzCore/Name/Name.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
namespace AZ
{
@@ -34,7 +34,7 @@ namespace AZ
explicit MaterialPropertyId(AZStd::string_view propertyName);
MaterialPropertyId(AZStd::string_view groupName, AZStd::string_view propertyName);
MaterialPropertyId(const Name& groupName, const Name& propertyName);
explicit MaterialPropertyId(const AZStd::array_view<AZStd::string> names);
explicit MaterialPropertyId(const AZStd::span<const AZStd::string> names);
AZ_DEFAULT_COPY_MOVE(MaterialPropertyId);
@@ -10,7 +10,7 @@
#include <Atom/RHI.Reflect/AttachmentEnums.h>
#include <Atom/RHI.Reflect/QueryPoolDescriptor.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
#include <AzCore/Name/Name.h>
@@ -65,7 +65,7 @@ namespace AZ
static void Reflect(AZ::ReflectContext* context);
PipelineStatisticsResult() = default;
PipelineStatisticsResult(AZStd::array_view<PipelineStatisticsResult>&& statisticsResultArray);
PipelineStatisticsResult(AZStd::span<const PipelineStatisticsResult>&& statisticsResultArray);
PipelineStatisticsResult& operator+=(const PipelineStatisticsResult& rhs);
@@ -15,7 +15,7 @@
#include <Atom/RHI/QueryPool.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
namespace AZ
{
@@ -59,15 +59,15 @@ namespace AZ
protected:
QueryPool(uint32_t queryCapacity, uint32_t queriesPerResult, RHI::QueryType queryType, RHI::PipelineStatisticsFlags statisticsFlags);
// Returns the RHI Query array.
AZStd::array_view<RHI::Ptr<RHI::Query>> GetRhiQueryArray() const;
// Returns the RHI Query array as a span.
AZStd::span<const RHI::Ptr<RHI::Query>> GetRhiQueryArray() const;
private:
// Distributes the RHI Query indices into sub-intervals. Each sub interval is assigned to a RPI Query.
void CreateRhiQueryIntervals();
// Returns an array of RHI Queries depending on the indices that are provided.
AZStd::array_view<RHI::Ptr<RHI::Query>> GetRhiQueriesFromInterval(const RHI::Interval& rhiQueryIndices) const;
// Returns a span of RHI Queries depending on the indices that are provided.
AZStd::span<const RHI::Ptr<RHI::Query>> GetRhiQueriesFromInterval(const RHI::Interval& rhiQueryIndices) const;
// Returns an array of raw RHI Query pointers depending on the indices that are provided.
AZStd::vector<RHI::Query*> GetRawRhiQueriesFromInterval(const RHI::Interval& rhiQueryIndices) const;
@@ -51,7 +51,7 @@ namespace AZ
size_t GetLodCount() const;
//! Returns the full list of Lods, where index 0 is the most detailed, and N-1 is the least.
AZStd::array_view<Data::Instance<ModelLod>> GetLods() const;
AZStd::span<const Data::Instance<ModelLod>> GetLods() const;
//! Returns whether a buffer upload is pending.
bool IsUploadPending() const;
@@ -20,7 +20,7 @@
#include <Atom/RPI.Reflect/Model/ModelLodAsset.h>
#include <Atom/RPI.Reflect/Model/ModelAsset.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
#include <AtomCore/std/containers/vector_set.h>
#include <AzCore/std/containers/fixed_vector.h>
@@ -92,7 +92,7 @@ namespace AZ
//! Blocks the CPU until pending buffer uploads have completed.
void WaitForUpload();
AZStd::array_view<Mesh> GetMeshes() const;
AZStd::span<const Mesh> GetMeshes() const;
//! Compares a ShaderInputContract to the mesh's available streams, and if any of them are optional, sets the corresponding "*_isBound" shader option.
//! Call this function to update the ShaderOptionKey before fetching a ShaderVariant, to find a variant that is compatible with this mesh's streams.
@@ -73,7 +73,7 @@ namespace AZ
Ptr<PassType> FindChildPass() const;
//! Gets the list of children. Useful for validating hierarchies
AZStd::array_view<Ptr<Pass>> GetChildren() const;
AZStd::span<const Ptr<Pass>> GetChildren() const;
//! Searches the tree for the first pass that uses the given DrawListTag.
const Pass* FindPass(RHI::DrawListTag drawListTag) const;
@@ -25,7 +25,7 @@
#include <Atom/RHI.Reflect/Scissor.h>
#include <Atom/RHI.Reflect/Viewport.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/std/containers/map.h>
@@ -192,7 +192,7 @@ namespace AZ
};
using PassAttachmentBindingList = AZStd::vector<PassAttachmentBinding>;
using PassAttachmentBindingListView = AZStd::array_view<PassAttachmentBinding>;
using PassAttachmentBindingListView = AZStd::span<const PassAttachmentBinding>;
} // namespace RPI
@@ -15,7 +15,7 @@
#include <Atom/RPI.Reflect/System/AnyAsset.h>
#include <Atom/RPI.Reflect/System/AssetAliases.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
namespace AZ
{
@@ -127,7 +127,7 @@ namespace AZ
const RHI::Ptr<RHI::ShaderResourceGroupLayout>& FindFallbackShaderResourceGroupLayout() const;
/// Returns the set of shader resource groups referenced by all variants in the shader asset.
AZStd::array_view<RHI::Ptr<RHI::ShaderResourceGroupLayout>> GetShaderResourceGroupLayouts() const;
AZStd::span<const RHI::Ptr<RHI::ShaderResourceGroupLayout>> GetShaderResourceGroupLayouts() const;
/// Returns a reference to the asset used to initialize this shader.
const Data::Asset<ShaderAsset>& GetAsset() const;
@@ -18,7 +18,7 @@
#include <Atom/RHI.Reflect/ShaderInputNameIndex.h>
#include <Atom/RHI/ShaderResourceGroup.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
#include <AtomCore/Instance/InstanceId.h>
#include <AtomCore/Instance/InstanceData.h>
@@ -104,16 +104,16 @@ namespace AZ
bool SetImage(RHI::ShaderInputImageIndex inputIndex, const Data::Instance<Image>& image, uint32_t arrayIndex = 0);
/// Sets multiple RPI images for the given shader input index.
bool SetImageArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::array_view<Data::Instance<Image>> images, uint32_t arrayIndex = 0);
bool SetImageArray(RHI::ShaderInputImageIndex inputIndex, AZStd::array_view<Data::Instance<Image>> images, uint32_t arrayIndex = 0);
bool SetImageArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::span<const Data::Instance<Image>> images, uint32_t arrayIndex = 0);
bool SetImageArray(RHI::ShaderInputImageIndex inputIndex, AZStd::span<const Data::Instance<Image>> images, uint32_t arrayIndex = 0);
/// Returns a single RPI image associated with the image shader input index and array offset.
const Data::Instance<Image>& GetImage(RHI::ShaderInputNameIndex& inputIndex, uint32_t arrayIndex = 0) const;
const Data::Instance<Image>& GetImage(RHI::ShaderInputImageIndex inputIndex, uint32_t arrayIndex = 0) const;
/// Returns an array of RPI images associated with the image shader input index.
AZStd::array_view<Data::Instance<Image>> GetImageArray(RHI::ShaderInputNameIndex& inputIndex) const;
AZStd::array_view<Data::Instance<Image>> GetImageArray(RHI::ShaderInputImageIndex inputIndex) const;
/// Returns a span of RPI images associated with the image shader input index.
AZStd::span<const Data::Instance<Image>> GetImageArray(RHI::ShaderInputNameIndex& inputIndex) const;
AZStd::span<const Data::Instance<Image>> GetImageArray(RHI::ShaderInputImageIndex inputIndex) const;
//////////////////////////////////////////////////////////////////////////
// Methods for assignment / access of RPI Buffer types.
@@ -123,17 +123,17 @@ namespace AZ
bool SetBuffer(RHI::ShaderInputBufferIndex inputIndex, const Data::Instance<Buffer>& buffer, uint32_t arrayIndex = 0);
/// Sets multiple RPI buffers for the given shader input index.
bool SetBufferArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::array_view<Data::Instance<Buffer>> buffers, uint32_t arrayIndex = 0);
bool SetBufferArray(RHI::ShaderInputBufferIndex inputIndex, AZStd::array_view<Data::Instance<Buffer>> buffers, uint32_t arrayIndex = 0);
bool SetBufferArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::span<const Data::Instance<Buffer>> buffers, uint32_t arrayIndex = 0);
bool SetBufferArray(RHI::ShaderInputBufferIndex inputIndex, AZStd::span<const Data::Instance<Buffer>> buffers, uint32_t arrayIndex = 0);
/// Returns a single RPI buffer associated with the buffer shader input index and array offset.
const Data::Instance<Buffer>& GetBuffer(RHI::ShaderInputNameIndex& inputIndex, uint32_t arrayIndex = 0) const;
const Data::Instance<Buffer>& GetBuffer(RHI::ShaderInputBufferIndex inputIndex, uint32_t arrayIndex = 0) const;
/// Returns an array of RPI buffers associated with the buffer shader input index.
AZStd::array_view<Data::Instance<Buffer>> GetBufferArray(RHI::ShaderInputNameIndex& inputIndex) const;
AZStd::array_view<Data::Instance<Buffer>> GetBufferArray(RHI::ShaderInputBufferIndex inputIndex) const;
/// Returns a span of RPI buffers associated with the buffer shader input index.
AZStd::span<const Data::Instance<Buffer>> GetBufferArray(RHI::ShaderInputNameIndex& inputIndex) const;
AZStd::span<const Data::Instance<Buffer>> GetBufferArray(RHI::ShaderInputBufferIndex inputIndex) const;
//! Reset image and buffer views so that it won't hold references for any RHI resources
void ResetViews();
@@ -145,19 +145,19 @@ namespace AZ
bool SetImageView(RHI::ShaderInputImageIndex inputIndex, const RHI::ImageView* imageView, uint32_t arrayIndex = 0);
/// Sets an array of image view for the given shader input index.
bool SetImageViewArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::array_view<const RHI::ImageView*> imageViews, uint32_t arrayIndex = 0);
bool SetImageViewArray(RHI::ShaderInputImageIndex inputIndex, AZStd::array_view<const RHI::ImageView*> imageViews, uint32_t arrayIndex = 0);
bool SetImageViewArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::span<const RHI::ImageView* const> imageViews, uint32_t arrayIndex = 0);
bool SetImageViewArray(RHI::ShaderInputImageIndex inputIndex, AZStd::span<const RHI::ImageView* const> imageViews, uint32_t arrayIndex = 0);
/// Sets an unbounded array of image views for the given shader input index.
bool SetImageViewUnboundedArray(RHI::ShaderInputImageUnboundedArrayIndex inputIndex, AZStd::array_view<const RHI::ImageView*> imageViews);
bool SetImageViewUnboundedArray(RHI::ShaderInputImageUnboundedArrayIndex inputIndex, AZStd::span<const RHI::ImageView* const> imageViews);
/// Returns a single image view associated with the image shader input index and array offset.
const RHI::ConstPtr<RHI::ImageView>& GetImageView(RHI::ShaderInputNameIndex& inputIndex, uint32_t arrayIndex = 0) const;
const RHI::ConstPtr<RHI::ImageView>& GetImageView(RHI::ShaderInputImageIndex inputIndex, uint32_t arrayIndex = 0) const;
/// Returns an array of image views associated with the given image shader input index.
AZStd::array_view<RHI::ConstPtr<RHI::ImageView>> GetImageViewArray(RHI::ShaderInputNameIndex& inputIndex) const;
AZStd::array_view<RHI::ConstPtr<RHI::ImageView>> GetImageViewArray(RHI::ShaderInputImageIndex inputIndex) const;
/// Returns a span of image views associated with the given image shader input index.
AZStd::span<const RHI::ConstPtr<RHI::ImageView>> GetImageViewArray(RHI::ShaderInputNameIndex& inputIndex) const;
AZStd::span<const RHI::ConstPtr<RHI::ImageView>> GetImageViewArray(RHI::ShaderInputImageIndex inputIndex) const;
//////////////////////////////////////////////////////////////////////////
// Methods for assignment / access of RHI Buffer types.
@@ -167,19 +167,19 @@ namespace AZ
bool SetBufferView(RHI::ShaderInputBufferIndex inputIndex, const RHI::BufferView* bufferView, uint32_t arrayIndex = 0);
/// Sets an array of buffer view for the given shader input index.
bool SetBufferViewArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::array_view<const RHI::BufferView*> bufferViews, uint32_t arrayIndex = 0);
bool SetBufferViewArray(RHI::ShaderInputBufferIndex inputIndex, AZStd::array_view<const RHI::BufferView*> bufferViews, uint32_t arrayIndex = 0);
bool SetBufferViewArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::span<const RHI::BufferView* const> bufferViews, uint32_t arrayIndex = 0);
bool SetBufferViewArray(RHI::ShaderInputBufferIndex inputIndex, AZStd::span<const RHI::BufferView* const> bufferViews, uint32_t arrayIndex = 0);
/// Sets an unbounded array of buffer views for the given shader input index.
bool SetBufferViewUnboundedArray(RHI::ShaderInputBufferUnboundedArrayIndex inputIndex, AZStd::array_view<const RHI::BufferView*> bufferViews);
bool SetBufferViewUnboundedArray(RHI::ShaderInputBufferUnboundedArrayIndex inputIndex, AZStd::span<const RHI::BufferView* const> bufferViews);
/// Returns a single buffer view associated with the buffer shader input index and array offset.
const RHI::ConstPtr<RHI::BufferView>& GetBufferView(RHI::ShaderInputNameIndex& inputIndex, uint32_t arrayIndex = 0) const;
const RHI::ConstPtr<RHI::BufferView>& GetBufferView(RHI::ShaderInputBufferIndex inputIndex, uint32_t arrayIndex = 0) const;
/// Returns an array of buffer views associated with the given buffer shader input index.
AZStd::array_view<RHI::ConstPtr<RHI::BufferView>> GetBufferViewArray(RHI::ShaderInputNameIndex& inputIndex) const;
AZStd::array_view<RHI::ConstPtr<RHI::BufferView>> GetBufferViewArray(RHI::ShaderInputBufferIndex inputIndex) const;
/// Returns a span of buffer views associated with the given buffer shader input index.
AZStd::span<const RHI::ConstPtr<RHI::BufferView>> GetBufferViewArray(RHI::ShaderInputNameIndex& inputIndex) const;
AZStd::span<const RHI::ConstPtr<RHI::BufferView>> GetBufferViewArray(RHI::ShaderInputBufferIndex inputIndex) const;
//////////////////////////////////////////////////////////////////////////
// Methods for assignment / access of RHI Sampler types.
@@ -189,16 +189,16 @@ namespace AZ
bool SetSampler(RHI::ShaderInputSamplerIndex inputIndex, const RHI::SamplerState& sampler, uint32_t arrayIndex = 0);
/// Sets an array of samplers for the given shader input index.
bool SetSamplerArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::array_view<RHI::SamplerState> samplers, uint32_t arrayIndex = 0);
bool SetSamplerArray(RHI::ShaderInputSamplerIndex inputIndex, AZStd::array_view<RHI::SamplerState> samplers, uint32_t arrayIndex = 0);
bool SetSamplerArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::span<const RHI::SamplerState> samplers, uint32_t arrayIndex = 0);
bool SetSamplerArray(RHI::ShaderInputSamplerIndex inputIndex, AZStd::span<const RHI::SamplerState> samplers, uint32_t arrayIndex = 0);
/// Returns a single sampler associated with the sampler shader input index and array offset.
const RHI::SamplerState& GetSampler(RHI::ShaderInputNameIndex& inputIndex, uint32_t arrayIndex) const;
const RHI::SamplerState& GetSampler(RHI::ShaderInputSamplerIndex inputIndex, uint32_t arrayIndex) const;
/// Returns an array of samplers associated with the sampler shader input index.
AZStd::array_view<RHI::SamplerState> GetSamplerArray(RHI::ShaderInputNameIndex& inputIndex) const;
AZStd::array_view<RHI::SamplerState> GetSamplerArray(RHI::ShaderInputSamplerIndex inputIndex) const;
/// Returns a span of samplers associated with the sampler shader input index.
AZStd::span<const RHI::SamplerState> GetSamplerArray(RHI::ShaderInputNameIndex& inputIndex) const;
AZStd::span<const RHI::SamplerState> GetSamplerArray(RHI::ShaderInputSamplerIndex inputIndex) const;
//////////////////////////////////////////////////////////////////////////
// Methods for assignment / access SRG constants.
@@ -227,11 +227,11 @@ namespace AZ
template <typename T>
bool SetConstant(RHI::ShaderInputConstantIndex inputIndex, const T& value, uint32_t arrayIndex);
/// Assigns an array of type T to the constant shader input.
/// Assigns a span of type T to the constant shader input.
template <typename T>
bool SetConstantArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::array_view<T> values);
bool SetConstantArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::span<const T> values);
template <typename T>
bool SetConstantArray(RHI::ShaderInputConstantIndex inputIndex, AZStd::array_view<T> values);
bool SetConstantArray(RHI::ShaderInputConstantIndex inputIndex, AZStd::span<const T> values);
/// Assigns an array of type T to the constant shader input.
template <typename T, size_t N>
@@ -253,9 +253,9 @@ namespace AZ
* If the strides do not match, an empty array is returned.
*/
template <typename T>
AZStd::array_view<T> GetConstantArray(RHI::ShaderInputNameIndex& inputIndex) const;
AZStd::span<const T> GetConstantArray(RHI::ShaderInputNameIndex& inputIndex) const;
template <typename T>
AZStd::array_view<T> GetConstantArray(RHI::ShaderInputConstantIndex inputIndex) const;
AZStd::span<const T> GetConstantArray(RHI::ShaderInputConstantIndex inputIndex) const;
/**
* Returns the constant data as type 'T' returned by value. The size of the constant region
@@ -276,9 +276,9 @@ namespace AZ
template <typename T>
T GetConstant(RHI::ShaderInputConstantIndex inputIndex, uint32_t arrayIndex) const;
/// Returns constant data for the given shader input index as an array of bytes.
AZStd::array_view<uint8_t> GetConstantRaw(RHI::ShaderInputNameIndex& inputIndex) const;
AZStd::array_view<uint8_t> GetConstantRaw(RHI::ShaderInputConstantIndex inputIndex) const;
/// Returns constant data for the given shader input index as a span of bytes.
AZStd::span<const uint8_t> GetConstantRaw(RHI::ShaderInputNameIndex& inputIndex) const;
AZStd::span<const uint8_t> GetConstantRaw(RHI::ShaderInputConstantIndex inputIndex) const;
private:
ShaderResourceGroup() = default;
@@ -415,13 +415,13 @@ namespace AZ
}
template <typename T>
bool ShaderResourceGroup::SetConstantArray(RHI::ShaderInputConstantIndex inputIndex, AZStd::array_view<T> values)
bool ShaderResourceGroup::SetConstantArray(RHI::ShaderInputConstantIndex inputIndex, AZStd::span<const T> values)
{
return m_data.SetConstantArray(inputIndex, values);
}
template <typename T>
bool ShaderResourceGroup::SetConstantArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::array_view<T> values)
bool ShaderResourceGroup::SetConstantArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::span<const T> values)
{
if (inputIndex.ValidateOrFindConstantIndex(GetLayout()))
{
@@ -433,7 +433,7 @@ namespace AZ
template <typename T, size_t N>
bool ShaderResourceGroup::SetConstantArray(RHI::ShaderInputConstantIndex inputIndex, const AZStd::array<T, N>& values)
{
return SetConstantArray(inputIndex, AZStd::array_view<T>(values));
return SetConstantArray(inputIndex, AZStd::span<const T>(values));
}
template <typename T, size_t N>
@@ -441,19 +441,19 @@ namespace AZ
{
if (inputIndex.ValidateOrFindConstantIndex(GetLayout()))
{
return SetConstantArray(inputIndex.GetConstantIndex(), AZStd::array_view<T>(values));
return SetConstantArray(inputIndex.GetConstantIndex(), AZStd::span<const T>(values));
}
return false;
}
template <typename T>
AZStd::array_view<T> ShaderResourceGroup::GetConstantArray(RHI::ShaderInputConstantIndex inputIndex) const
AZStd::span<const T> ShaderResourceGroup::GetConstantArray(RHI::ShaderInputConstantIndex inputIndex) const
{
return m_data.GetConstantArray<T>(inputIndex);
}
template <typename T>
AZStd::array_view<T> ShaderResourceGroup::GetConstantArray(RHI::ShaderInputNameIndex& inputIndex) const
AZStd::span<const T> ShaderResourceGroup::GetConstantArray(RHI::ShaderInputNameIndex& inputIndex) const
{
if (inputIndex.ValidateOrFindConstantIndex(GetLayout()))
{
@@ -16,7 +16,7 @@
#include <Atom/RPI.Reflect/Asset/AssetHandler.h>
#include <Atom/RPI.Reflect/ResourcePoolAsset.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
#include <AzCore/Asset/AssetCommon.h>
@@ -46,7 +46,7 @@ namespace AZ
BufferAsset() = default;
~BufferAsset() = default;
AZStd::array_view<uint8_t> GetBuffer() const;
AZStd::span<const uint8_t> GetBuffer() const;
const RHI::BufferDescriptor& GetBufferDescriptor() const;
@@ -14,7 +14,7 @@
#include <Atom/RHI/StreamingImagePool.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
#include <AzCore/Asset/AssetCommon.h>
@@ -64,10 +64,10 @@ namespace AZ
size_t GetSubImageCount() const;
//! Returns the sub-image data blob for a given mip slice and array slice (local to the group).
AZStd::array_view<uint8_t> GetSubImageData(uint32_t mipSlice, uint32_t arraySlice) const;
AZStd::span<const uint8_t> GetSubImageData(uint32_t mipSlice, uint32_t arraySlice) const;
//! Returns the sub-image data blob for a linear index (local to the group).
AZStd::array_view<uint8_t> GetSubImageData(uint32_t subImageIndex) const;
AZStd::span<const uint8_t> GetSubImageData(uint32_t subImageIndex) const;
//! Returns the sub-image layout for a single sub-image by index.
const RHI::ImageSubresourceLayout& GetSubImageLayout(uint32_t subImageIndex) const;
@@ -83,7 +83,7 @@ namespace AZ
size_t GetMipCount(size_t mipChainIndex) const;
//! Get image data for specified mip and slice. It may return empty array if its mipchain assets are not loaded
AZStd::array_view<uint8_t> GetSubImageData(uint32_t mip, uint32_t slice);
AZStd::span<const uint8_t> GetSubImageData(uint32_t mip, uint32_t slice);
//! Returns streaming image pool asset id of the pool that will be used to create the streaming image.
const Data::AssetId& GetPoolAssetId() const;
@@ -9,7 +9,7 @@
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/std/containers/vector.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
#include <Atom/RPI.Public/AssetInitBus.h>
#include <Atom/RPI.Reflect/Base.h>
@@ -11,7 +11,7 @@
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/any.h>
#include <AzCore/EBus/Event.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
#include <Atom/RPI.Public/AssetInitBus.h>
#include <Atom/RPI.Reflect/Base.h>
@@ -118,7 +118,7 @@ namespace AZ
//! The entries in this list align with the entries in the MaterialPropertiesLayout. Each AZStd::any is guaranteed
//! to have a value of type that matches the corresponding MaterialPropertyDescriptor.
//! For images, the value will be of type ImageBinding.
AZStd::array_view<MaterialPropertyValue> GetDefaultPropertyValues() const;
AZStd::span<const MaterialPropertyValue> GetDefaultPropertyValues() const;
//! Returns a map from the UV shader inputs to a custom name.
MaterialUvNameMap GetUvNameMap() const;
@@ -9,7 +9,7 @@
#include <Atom/RPI.Reflect/AssetCreator.h>
#include <Atom/RPI.Reflect/Material/MaterialTypeAsset.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
namespace AZ
{
@@ -59,7 +59,7 @@ namespace AZ
//! Returns the number of Lods in the model
size_t GetLodCount() const;
AZStd::array_view<Data::Asset<ModelLodAsset>> GetLodAssets() const;
AZStd::span<const Data::Asset<ModelLodAsset>> GetLodAssets() const;
//! Checks a ray for intersection against this model. The ray must be in the same coordinate space as the model.
//! Important: only to be used in the Editor, it may kick off a job to calculate spatial information.
@@ -50,9 +50,9 @@ namespace AZ
eSA_Invalid
};
static AZStd::array_view<float> GetPositionsBuffer(const ModelLodAsset::Mesh& mesh);
static AZStd::span<const float> GetPositionsBuffer(const ModelLodAsset::Mesh& mesh);
static AZStd::array_view<TriangleIndices> GetIndexBuffer(const ModelLodAsset::Mesh& mesh);
static AZStd::span<const TriangleIndices> GetIndexBuffer(const ModelLodAsset::Mesh& mesh);
private:
@@ -75,7 +75,7 @@ namespace AZ
struct MeshData
{
const ModelLodAsset::Mesh* m_mesh = nullptr;
AZStd::array_view<float> m_vertexData;
AZStd::span<const float> m_vertexData;
};
AZStd::vector<MeshData> m_meshes;
@@ -101,10 +101,10 @@ namespace AZ
//! A helper method for returning this mesh's index buffer using a specific type for the elements.
//! @note It's the caller's responsibility to choose the right type for the buffer.
template<class T>
AZStd::array_view<T> GetIndexBufferTyped() const;
AZStd::span<const T> GetIndexBufferTyped() const;
//! Return an array view of the list of all stream buffer info (not including the index buffer)
AZStd::array_view<StreamBufferInfo> GetStreamBufferInfoList() const;
AZStd::span<const StreamBufferInfo> GetStreamBufferInfoList() const;
//! A helper method for returning a specific buffer asset view.
//! It will return nullptr if the semantic buffer is not found.
@@ -117,11 +117,11 @@ namespace AZ
//! In perf loop, re-use AZ::Name instance.
//! @note It's the caller's responsibility to choose the right type for the buffer.
template<class T>
AZStd::array_view<T> GetSemanticBufferTyped(const AZ::Name& semantic) const;
AZStd::span<const T> GetSemanticBufferTyped(const AZ::Name& semantic) const;
private:
template<class T>
AZStd::array_view<T> GetBufferTyped(const BufferAssetView& bufferAssetView) const;
AZStd::span<const T> GetBufferTyped(const BufferAssetView& bufferAssetView) const;
AZ::Name m_name;
AZ::Aabb m_aabb = AZ::Aabb::CreateNull();
@@ -143,7 +143,7 @@ namespace AZ
};
//! Returns an array view into the collection of meshes owned by this lod
AZStd::array_view<Mesh> GetMeshes() const;
AZStd::span<const Mesh> GetMeshes() const;
//! Returns the model-space axis-aligned bounding box of all meshes in the lod
const AZ::Aabb& GetAabb() const;
@@ -173,24 +173,24 @@ namespace AZ
using ModelLodAssetHandler = AssetHandler<ModelLodAsset>;
template<class T>
AZStd::array_view<T> ModelLodAsset::Mesh::GetIndexBufferTyped() const
AZStd::span<const T> ModelLodAsset::Mesh::GetIndexBufferTyped() const
{
return GetBufferTyped<T>(GetIndexBufferAssetView());
}
template<class T>
AZStd::array_view<T> ModelLodAsset::Mesh::GetSemanticBufferTyped(const AZ::Name& semantic) const
AZStd::span<const T> ModelLodAsset::Mesh::GetSemanticBufferTyped(const AZ::Name& semantic) const
{
const BufferAssetView* bufferAssetView = GetSemanticBufferAssetView(semantic);
return bufferAssetView ? GetBufferTyped<T>(*bufferAssetView) : AZStd::array_view<T>{};
return bufferAssetView ? GetBufferTyped<T>(*bufferAssetView) : AZStd::span<const T>{};
}
template<class T>
AZStd::array_view<T> ModelLodAsset::Mesh::GetBufferTyped(const BufferAssetView& bufferAssetView) const
AZStd::span<const T> ModelLodAsset::Mesh::GetBufferTyped(const BufferAssetView& bufferAssetView) const
{
if (const BufferAsset* bufferAsset = bufferAssetView.GetBufferAsset().Get())
{
const AZStd::array_view<uint8_t> rawBuffer = bufferAsset->GetBuffer();
const AZStd::span<const uint8_t> rawBuffer = bufferAsset->GetBuffer();
if (!rawBuffer.empty())
{
const auto& bufferViewDescriptor = bufferAssetView.GetBufferViewDescriptor();
@@ -202,7 +202,7 @@ namespace AZ
"Size of buffer (%d) is not a multiple of the type's size specified (%d)",
endMeshRawBuffer - beginMeshRawBuffer, sizeof(T));
return AZStd::array_view<T>(reinterpret_cast<const T*>(beginMeshRawBuffer), reinterpret_cast<const T*>(endMeshRawBuffer));
return AZStd::span<const T>(reinterpret_cast<const T*>(beginMeshRawBuffer), reinterpret_cast<const T*>(endMeshRawBuffer));
}
}
return {};
@@ -23,7 +23,7 @@
#include <Atom/RPI.Reflect/Base.h>
#include <Atom/RPI.Reflect/Asset/AssetReference.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
#include <AzCore/std/containers/array.h>
#include <AzCore/std/smart_ptr/intrusive_base.h>
@@ -130,7 +130,7 @@ namespace AZ
};
using PassSlotList = AZStd::vector<PassSlot>;
using PassSlotListView = AZStd::array_view<PassSlot>;
using PassSlotListView = AZStd::span<const PassSlot>;
//! Refers to a PassAttachment or a PassAttachmentBinding on an adjacent Pass in the hierarchy. Specifies the
//! name of attachment or binding/slot as well as the name of the Pass on which the attachment or binding lives.
@@ -166,7 +166,7 @@ namespace AZ
};
using PassConnectionList = AZStd::vector<PassConnection>;
using PassConnectionListView = AZStd::array_view<PassConnection>;
using PassConnectionListView = AZStd::span<const PassConnection>;
//! Specifies a connection from a Pass's output slot to one of it's input slots. This is used as a fallback
//! for the output when the pass is disabled so the output can present a valid attachments to subsequent passes.
@@ -183,7 +183,7 @@ namespace AZ
};
using PassFallbackConnectionList = AZStd::vector<PassFallbackConnection>;
using PassFallbackConnectionListView = AZStd::array_view<PassFallbackConnection>;
using PassFallbackConnectionListView = AZStd::span<const PassFallbackConnection>;
// --- Pass Attachment Descriptor Classes ---
@@ -269,7 +269,7 @@ namespace AZ
};
using PassImageAttachmentDescList = AZStd::vector<PassImageAttachmentDesc>;
using PassImageAttachmentDescListView = AZStd::array_view<PassAttachmentDesc>;
using PassImageAttachmentDescListView = AZStd::span<const PassAttachmentDesc>;
//! A PassAttachmentDesc used for buffers
struct PassBufferAttachmentDesc final
@@ -283,7 +283,7 @@ namespace AZ
};
using PassBufferAttachmentDescList = AZStd::vector<PassBufferAttachmentDesc>;
using PassBufferAttachmentDescListView = AZStd::array_view<PassBufferAttachmentDesc>;
using PassBufferAttachmentDescListView = AZStd::span<const PassBufferAttachmentDesc>;
} // namespace RPI
@@ -13,7 +13,7 @@
#include <Atom/RPI.Reflect/Pass/PassAttachmentReflect.h>
#include <Atom/RPI.Reflect/Pass/PassData.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/Memory/SystemAllocator.h>
@@ -75,7 +75,7 @@ namespace AZ
};
using PassRequestList = AZStd::vector<PassRequest>;
using PassRequestListView = AZStd::array_view<PassRequest>;
using PassRequestListView = AZStd::span<const PassRequest>;
} // namespace RPI
} // namespace AZ
@@ -11,7 +11,7 @@
#include <Atom/RPI.Reflect/Pass/PassRequest.h>
#include <AtomCore/std/containers/array_view.h>
#include <AzCore/std/containers/span.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/Memory/SystemAllocator.h>
@@ -158,8 +158,8 @@ namespace AZ
//! Returns the set of shader resource group layouts owned by a given supervariant.
AZStd::array_view<RHI::Ptr<RHI::ShaderResourceGroupLayout>> GetShaderResourceGroupLayouts( SupervariantIndex supervariantIndex) const;
AZStd::array_view<RHI::Ptr<RHI::ShaderResourceGroupLayout>> GetShaderResourceGroupLayouts() const
AZStd::span<const RHI::Ptr<RHI::ShaderResourceGroupLayout>> GetShaderResourceGroupLayouts( SupervariantIndex supervariantIndex) const;
AZStd::span<const RHI::Ptr<RHI::ShaderResourceGroupLayout>> GetShaderResourceGroupLayouts() const
{
return GetShaderResourceGroupLayouts(DefaultSupervariantIndex);
}
@@ -88,7 +88,7 @@ namespace AZ
{
}
MaterialPropertyId::MaterialPropertyId(const AZStd::array_view<AZStd::string> names)
MaterialPropertyId::MaterialPropertyId(const AZStd::span<const AZStd::string> names)
{
for (const auto& name : names)
{
@@ -54,7 +54,7 @@ namespace AZ
// --- PipelineStatisticsResult ---
PipelineStatisticsResult::PipelineStatisticsResult(AZStd::array_view<PipelineStatisticsResult>&& statisticsResultArray)
PipelineStatisticsResult::PipelineStatisticsResult(AZStd::span<const PipelineStatisticsResult>&& statisticsResultArray)
{
for (const PipelineStatisticsResult& result : statisticsResultArray)
{
@@ -147,7 +147,7 @@ namespace AZ
return endQuery->End(commandList);
}
AZStd::array_view<RHI::Ptr<RHI::Query>> RPI::QueryPool::GetRhiQueryArray() const
AZStd::span<const RHI::Ptr<RHI::Query>> RPI::QueryPool::GetRhiQueryArray() const
{
return m_rhiQueryArray;
}
@@ -230,12 +230,12 @@ namespace AZ
return m_queriesPerResult;
}
AZStd::array_view<RHI::Ptr<RHI::Query>> QueryPool::GetRhiQueriesFromInterval(const RHI::Interval& rhiQueryIndices) const
AZStd::span<const RHI::Ptr<RHI::Query>> QueryPool::GetRhiQueriesFromInterval(const RHI::Interval& rhiQueryIndices) const
{
const uint32_t queryCount = rhiQueryIndices.m_max - rhiQueryIndices.m_min + 1u;
AZ_Assert(rhiQueryIndices.m_max < m_rhiQueryCapacity, "Query array index is going over the limit");
return AZStd::array_view<RHI::Ptr<RHI::Query>>(m_rhiQueryArray.begin() + rhiQueryIndices.m_min, queryCount);
return AZStd::span<const RHI::Ptr<RHI::Query>>(m_rhiQueryArray.begin() + rhiQueryIndices.m_min, queryCount);
}
AZStd::vector<RHI::Query*> QueryPool::GetRawRhiQueriesFromInterval(const RHI::Interval& rhiQueryIndices) const
@@ -26,7 +26,7 @@ namespace AZ
RHI::ResultCode TimestampQueryPool::BeginQueryInternal(RHI::Interval rhiQueryIndices, RHI::CommandList& commandList)
{
AZStd::array_view<RHI::Ptr<RHI::Query>> rhiQueryArray = GetRhiQueryArray();
AZStd::span<const RHI::Ptr<RHI::Query>> rhiQueryArray = GetRhiQueryArray();
AZ::RHI::Ptr<AZ::RHI::Query> beginQuery = rhiQueryArray[rhiQueryIndices.m_min];
return beginQuery->WriteTimestamp(commandList);
@@ -34,7 +34,7 @@ namespace AZ
RHI::ResultCode TimestampQueryPool::EndQueryInternal(RHI::Interval rhiQueryIndices, RHI::CommandList& commandList)
{
AZStd::array_view<RHI::Ptr<RHI::Query>> rhiQueryArray = GetRhiQueryArray();
AZStd::span<const RHI::Ptr<RHI::Query>> rhiQueryArray = GetRhiQueryArray();
AZ::RHI::Ptr<AZ::RHI::Query> endQuery = rhiQueryArray[rhiQueryIndices.m_max];
return endQuery->WriteTimestamp(commandList);
@@ -57,7 +57,7 @@ namespace AZ
return m_lods.size();
}
AZStd::array_view<Data::Instance<ModelLod>> Model::GetLods() const
AZStd::span<const Data::Instance<ModelLod>> Model::GetLods() const
{
return m_lods;
}
@@ -28,7 +28,7 @@ namespace AZ
&modelAssetAny);
}
AZStd::array_view<ModelLod::Mesh> ModelLod::GetMeshes() const
AZStd::span<const ModelLod::Mesh> ModelLod::GetMeshes() const
{
return m_meshes;
}
@@ -398,7 +398,7 @@ namespace AZ
// --- Debug functions ---
AZStd::array_view<Ptr<Pass>> ParentPass::GetChildren() const
AZStd::span<const Ptr<Pass>> ParentPass::GetChildren() const
{
return m_children;
}
@@ -490,7 +490,7 @@ namespace AZ
return m_asset->FindFallbackShaderResourceGroupLayout(m_supervariantIndex);
}
AZStd::array_view<RHI::Ptr<RHI::ShaderResourceGroupLayout>> Shader::GetShaderResourceGroupLayouts() const
AZStd::span<const RHI::Ptr<RHI::ShaderResourceGroupLayout>> Shader::GetShaderResourceGroupLayouts() const
{
return m_asset->GetShaderResourceGroupLayouts(m_supervariantIndex);
}
@@ -76,7 +76,7 @@ namespace AZ
{
const auto& lay = shaderAsset.FindShaderResourceGroupLayout(srgName, supervariantIndex);
m_layout = lay.get();
if (!m_layout)
{
AZ_Assert(false, "ShaderResourceGroup cannot be initialized due to invalid ShaderResourceGroupLayout");
@@ -188,7 +188,7 @@ namespace AZ
{
return GetLayout()->HasShaderVariantKeyFallbackEntry();
}
bool ShaderResourceGroup::SetImage(RHI::ShaderInputNameIndex& inputIndex, const Data::Instance<Image>& image, uint32_t arrayIndex)
{
if (inputIndex.ValidateOrFindImageIndex(GetLayout()))
@@ -215,7 +215,7 @@ namespace AZ
return false;
}
bool ShaderResourceGroup::SetImageArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::array_view<Data::Instance<Image>> images, uint32_t arrayIndex)
bool ShaderResourceGroup::SetImageArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::span<const Data::Instance<Image>> images, uint32_t arrayIndex)
{
if (inputIndex.ValidateOrFindImageIndex(GetLayout()))
{
@@ -224,7 +224,7 @@ namespace AZ
return false;
}
bool ShaderResourceGroup::SetImageArray(RHI::ShaderInputImageIndex inputIndex, AZStd::array_view<Data::Instance<Image>> images, uint32_t arrayIndex)
bool ShaderResourceGroup::SetImageArray(RHI::ShaderInputImageIndex inputIndex, AZStd::span<const Data::Instance<Image>> images, uint32_t arrayIndex)
{
if (GetLayout()->ValidateAccess(inputIndex, arrayIndex + static_cast<uint32_t>(images.size()) - 1))
{
@@ -257,7 +257,7 @@ namespace AZ
return s_nullImage;
}
AZStd::array_view<Data::Instance<Image>> ShaderResourceGroup::GetImageArray(RHI::ShaderInputNameIndex& inputIndex) const
AZStd::span<const Data::Instance<Image>> ShaderResourceGroup::GetImageArray(RHI::ShaderInputNameIndex& inputIndex) const
{
if (inputIndex.ValidateOrFindImageIndex(GetLayout()))
{
@@ -266,12 +266,12 @@ namespace AZ
return {};
}
AZStd::array_view<Data::Instance<Image>> ShaderResourceGroup::GetImageArray(RHI::ShaderInputImageIndex inputIndex) const
AZStd::span<const Data::Instance<Image>> ShaderResourceGroup::GetImageArray(RHI::ShaderInputImageIndex inputIndex) const
{
if (m_layout->ValidateAccess(inputIndex, 0))
{
const RHI::Interval interval = m_layout->GetGroupInterval(inputIndex);
return AZStd::array_view<Data::Instance<Image>>(&m_imageGroup[interval.m_min], interval.m_max - interval.m_min);
return AZStd::span<const Data::Instance<Image>>(&m_imageGroup[interval.m_min], interval.m_max - interval.m_min);
}
return {};
}
@@ -299,7 +299,7 @@ namespace AZ
return false;
}
bool ShaderResourceGroup::SetImageViewArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::array_view<const RHI::ImageView*> imageViews, uint32_t arrayIndex)
bool ShaderResourceGroup::SetImageViewArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::span<const RHI::ImageView* const> imageViews, uint32_t arrayIndex)
{
if (inputIndex.ValidateOrFindImageIndex(GetLayout()))
{
@@ -308,7 +308,7 @@ namespace AZ
return false;
}
bool ShaderResourceGroup::SetImageViewArray(RHI::ShaderInputImageIndex inputIndex, AZStd::array_view<const RHI::ImageView*> imageViews, uint32_t arrayIndex)
bool ShaderResourceGroup::SetImageViewArray(RHI::ShaderInputImageIndex inputIndex, AZStd::span<const RHI::ImageView* const> imageViews, uint32_t arrayIndex)
{
if (GetLayout()->ValidateAccess(inputIndex, arrayIndex + static_cast<uint32_t>(imageViews.size()) - 1))
{
@@ -322,7 +322,7 @@ namespace AZ
return false;
}
bool ShaderResourceGroup::SetImageViewUnboundedArray(RHI::ShaderInputImageUnboundedArrayIndex inputIndex, AZStd::array_view<const RHI::ImageView*> imageViews)
bool ShaderResourceGroup::SetImageViewUnboundedArray(RHI::ShaderInputImageUnboundedArrayIndex inputIndex, AZStd::span<const RHI::ImageView* const> imageViews)
{
return m_data.SetImageViewUnboundedArray(inputIndex, imageViews);
}
@@ -350,7 +350,7 @@ namespace AZ
return false;
}
bool ShaderResourceGroup::SetBufferViewArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::array_view<const RHI::BufferView*> bufferViews, uint32_t arrayIndex)
bool ShaderResourceGroup::SetBufferViewArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::span<const RHI::BufferView* const> bufferViews, uint32_t arrayIndex)
{
if (inputIndex.ValidateOrFindBufferIndex(GetLayout()))
{
@@ -359,7 +359,7 @@ namespace AZ
return false;
}
bool ShaderResourceGroup::SetBufferViewArray(RHI::ShaderInputBufferIndex inputIndex, AZStd::array_view<const RHI::BufferView*> bufferViews, uint32_t arrayIndex)
bool ShaderResourceGroup::SetBufferViewArray(RHI::ShaderInputBufferIndex inputIndex, AZStd::span<const RHI::BufferView* const> bufferViews, uint32_t arrayIndex)
{
if (GetLayout()->ValidateAccess(inputIndex, arrayIndex + static_cast<uint32_t>(bufferViews.size()) - 1))
{
@@ -373,7 +373,7 @@ namespace AZ
return false;
}
bool ShaderResourceGroup::SetBufferViewUnboundedArray(RHI::ShaderInputBufferUnboundedArrayIndex inputIndex, AZStd::array_view<const RHI::BufferView*> bufferViews)
bool ShaderResourceGroup::SetBufferViewUnboundedArray(RHI::ShaderInputBufferUnboundedArrayIndex inputIndex, AZStd::span<const RHI::BufferView* const> bufferViews)
{
return m_data.SetBufferViewUnboundedArray(inputIndex, bufferViews);
}
@@ -392,7 +392,7 @@ namespace AZ
return m_data.SetSampler(inputIndex, sampler, arrayIndex);
}
bool ShaderResourceGroup::SetSamplerArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::array_view<RHI::SamplerState> samplers, uint32_t arrayIndex)
bool ShaderResourceGroup::SetSamplerArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::span<const RHI::SamplerState> samplers, uint32_t arrayIndex)
{
if (inputIndex.ValidateOrFindSamplerIndex(GetLayout()))
{
@@ -401,7 +401,7 @@ namespace AZ
return false;
}
bool ShaderResourceGroup::SetSamplerArray(RHI::ShaderInputSamplerIndex inputIndex, AZStd::array_view<RHI::SamplerState> samplers, uint32_t arrayIndex)
bool ShaderResourceGroup::SetSamplerArray(RHI::ShaderInputSamplerIndex inputIndex, AZStd::span<const RHI::SamplerState> samplers, uint32_t arrayIndex)
{
return m_data.SetSamplerArray(inputIndex, samplers, arrayIndex);
}
@@ -437,7 +437,7 @@ namespace AZ
bool ShaderResourceGroup::ApplyDataMappings(const RHI::ShaderDataMappings& mappings)
{
bool success = true;
success = success && ApplyDataMappingArray(mappings.m_colorMappings);
success = success && ApplyDataMappingArray(mappings.m_uintMappings);
success = success && ApplyDataMappingArray(mappings.m_floatMappings);
@@ -461,13 +461,13 @@ namespace AZ
return m_data.GetImageView(inputIndex, arrayIndex);
}
AZStd::array_view<RHI::ConstPtr<RHI::ImageView>> ShaderResourceGroup::GetImageViewArray(RHI::ShaderInputNameIndex& inputIndex) const
AZStd::span<const RHI::ConstPtr<RHI::ImageView>> ShaderResourceGroup::GetImageViewArray(RHI::ShaderInputNameIndex& inputIndex) const
{
inputIndex.ValidateOrFindImageIndex(GetLayout());
return GetImageViewArray(inputIndex.GetImageIndex());
}
AZStd::array_view<RHI::ConstPtr<RHI::ImageView>> ShaderResourceGroup::GetImageViewArray(RHI::ShaderInputImageIndex inputIndex) const
AZStd::span<const RHI::ConstPtr<RHI::ImageView>> ShaderResourceGroup::GetImageViewArray(RHI::ShaderInputImageIndex inputIndex) const
{
return m_data.GetImageViewArray(inputIndex);
}
@@ -483,13 +483,13 @@ namespace AZ
return m_data.GetBufferView(inputIndex, arrayIndex);
}
AZStd::array_view<RHI::ConstPtr<RHI::BufferView>> ShaderResourceGroup::GetBufferViewArray(RHI::ShaderInputNameIndex& inputIndex) const
AZStd::span<const RHI::ConstPtr<RHI::BufferView>> ShaderResourceGroup::GetBufferViewArray(RHI::ShaderInputNameIndex& inputIndex) const
{
inputIndex.ValidateOrFindBufferIndex(GetLayout());
return GetBufferViewArray(inputIndex.GetBufferIndex());
}
AZStd::array_view<RHI::ConstPtr<RHI::BufferView>> ShaderResourceGroup::GetBufferViewArray(RHI::ShaderInputBufferIndex inputIndex) const
AZStd::span<const RHI::ConstPtr<RHI::BufferView>> ShaderResourceGroup::GetBufferViewArray(RHI::ShaderInputBufferIndex inputIndex) const
{
return m_data.GetBufferViewArray(inputIndex);
}
@@ -520,7 +520,7 @@ namespace AZ
return false;
}
bool ShaderResourceGroup::SetBufferArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::array_view<Data::Instance<Buffer>> buffers, uint32_t arrayIndex)
bool ShaderResourceGroup::SetBufferArray(RHI::ShaderInputNameIndex& inputIndex, AZStd::span<const Data::Instance<Buffer>> buffers, uint32_t arrayIndex)
{
if (inputIndex.ValidateOrFindBufferIndex(GetLayout()))
{
@@ -529,7 +529,7 @@ namespace AZ
return false;
}
bool ShaderResourceGroup::SetBufferArray(RHI::ShaderInputBufferIndex inputIndex, AZStd::array_view<Data::Instance<Buffer>> buffers, uint32_t arrayIndex)
bool ShaderResourceGroup::SetBufferArray(RHI::ShaderInputBufferIndex inputIndex, AZStd::span<const Data::Instance<Buffer>> buffers, uint32_t arrayIndex)
{
if (GetLayout()->ValidateAccess(inputIndex, arrayIndex + static_cast<uint32_t>(buffers.size()) - 1))
{
@@ -562,7 +562,7 @@ namespace AZ
return s_nullBuffer;
}
AZStd::array_view<Data::Instance<Buffer>> ShaderResourceGroup::GetBufferArray(RHI::ShaderInputNameIndex& inputIndex) const
AZStd::span<const Data::Instance<Buffer>> ShaderResourceGroup::GetBufferArray(RHI::ShaderInputNameIndex& inputIndex) const
{
if (inputIndex.ValidateOrFindBufferIndex(GetLayout()))
{
@@ -571,12 +571,12 @@ namespace AZ
return {};
}
AZStd::array_view<Data::Instance<Buffer>> ShaderResourceGroup::GetBufferArray(RHI::ShaderInputBufferIndex inputIndex) const
AZStd::span<const Data::Instance<Buffer>> ShaderResourceGroup::GetBufferArray(RHI::ShaderInputBufferIndex inputIndex) const
{
if (m_layout->ValidateAccess(inputIndex, 0))
{
const RHI::Interval interval = m_layout->GetGroupInterval(inputIndex);
return AZStd::array_view<Data::Instance<Buffer>>(&m_bufferGroup[interval.m_min], interval.m_max - interval.m_min);
return AZStd::span<const Data::Instance<Buffer>>(&m_bufferGroup[interval.m_min], interval.m_max - interval.m_min);
}
return {};
}
@@ -597,24 +597,24 @@ namespace AZ
return m_data.GetSampler(inputIndex, arrayIndex);
}
AZStd::array_view<RHI::SamplerState> ShaderResourceGroup::GetSamplerArray(RHI::ShaderInputNameIndex& inputIndex) const
AZStd::span<const RHI::SamplerState> ShaderResourceGroup::GetSamplerArray(RHI::ShaderInputNameIndex& inputIndex) const
{
inputIndex.ValidateOrFindSamplerIndex(GetLayout());
return GetSamplerArray(inputIndex.GetSamplerIndex());
}
AZStd::array_view<RHI::SamplerState> ShaderResourceGroup::GetSamplerArray(RHI::ShaderInputSamplerIndex inputIndex) const
AZStd::span<const RHI::SamplerState> ShaderResourceGroup::GetSamplerArray(RHI::ShaderInputSamplerIndex inputIndex) const
{
return m_data.GetSamplerArray(inputIndex);
}
AZStd::array_view<uint8_t> ShaderResourceGroup::GetConstantRaw(RHI::ShaderInputNameIndex& inputIndex) const
AZStd::span<const uint8_t> ShaderResourceGroup::GetConstantRaw(RHI::ShaderInputNameIndex& inputIndex) const
{
inputIndex.ValidateOrFindConstantIndex(GetLayout());
return GetConstantRaw(inputIndex.GetConstantIndex());
}
AZStd::array_view<uint8_t> ShaderResourceGroup::GetConstantRaw(RHI::ShaderInputConstantIndex inputIndex) const
AZStd::span<const uint8_t> ShaderResourceGroup::GetConstantRaw(RHI::ShaderInputConstantIndex inputIndex) const
{
return m_data.GetConstantRaw(inputIndex);
}
@@ -49,9 +49,9 @@ namespace AZ
}
}
AZStd::array_view<uint8_t> BufferAsset::GetBuffer() const
AZStd::span<const uint8_t> BufferAsset::GetBuffer() const
{
return AZStd::array_view<uint8_t>(m_buffer);
return AZStd::span<const uint8_t>(m_buffer);
}
const RHI::BufferDescriptor& BufferAsset::GetBufferDescriptor() const
@@ -165,7 +165,7 @@ namespace AZ
creator.SetPoolAsset(sourceAsset->GetPoolAsset());
creator.SetBufferViewDescriptor(sourceAsset->GetBufferViewDescriptor());
const AZStd::array_view<uint8_t> sourceBuffer = sourceAsset->GetBuffer();
const AZStd::span<const uint8_t> sourceBuffer = sourceAsset->GetBuffer();
creator.SetBuffer(sourceBuffer.data(), sourceBuffer.size(), sourceAsset->GetBufferDescriptor());
return creator.End(clonedResult);
@@ -49,19 +49,19 @@ namespace AZ
return m_subImageDatas.size();
}
AZStd::array_view<uint8_t> ImageMipChainAsset::GetSubImageData(uint32_t mipSlice, uint32_t arraySlice) const
AZStd::span<const uint8_t> ImageMipChainAsset::GetSubImageData(uint32_t mipSlice, uint32_t arraySlice) const
{
return GetSubImageData(mipSlice * m_arraySize + arraySlice);
}
AZStd::array_view<uint8_t> ImageMipChainAsset::GetSubImageData(uint32_t subImageIndex) const
AZStd::span<const uint8_t> ImageMipChainAsset::GetSubImageData(uint32_t subImageIndex) const
{
AZ_Assert(subImageIndex < m_subImageDataOffsets.size() && subImageIndex < m_subImageDatas.size(), "subImageIndex is out of range");
// The offset vector contains an extra sentinel value.
const size_t dataSize = m_subImageDataOffsets[subImageIndex + 1] - m_subImageDataOffsets[subImageIndex];
return AZStd::array_view<uint8_t>(reinterpret_cast<const uint8_t*>(m_subImageDatas[subImageIndex].m_data), dataSize);
return AZStd::span<const uint8_t>(reinterpret_cast<const uint8_t*>(m_subImageDatas[subImageIndex].m_data), dataSize);
}
const RHI::ImageSubresourceLayout& ImageMipChainAsset::GetSubImageLayout(uint32_t mipSlice) const
@@ -111,7 +111,7 @@ namespace AZ
for (uint16_t mipSliceIndex = 0; mipSliceIndex < m_mipLevels; ++mipSliceIndex)
{
RHI::StreamingImageMipSlice mipSlice;
mipSlice.m_subresources = AZStd::array_view<RHI::StreamingImageSubresourceData>(&m_subImageDatas[m_arraySize * mipSliceIndex], m_arraySize);
mipSlice.m_subresources = AZStd::span<const RHI::StreamingImageSubresourceData>(&m_subImageDatas[m_arraySize * mipSliceIndex], m_arraySize);
mipSlice.m_subresourceLayout = m_subImageLayouts[mipSliceIndex];
m_mipSlices.push_back(mipSlice);
}
@@ -94,11 +94,11 @@ namespace AZ
return m_totalImageDataSize;
}
AZStd::array_view<uint8_t> StreamingImageAsset::GetSubImageData(uint32_t mip, uint32_t slice)
AZStd::span<const uint8_t> StreamingImageAsset::GetSubImageData(uint32_t mip, uint32_t slice)
{
if (mip >= m_mipLevelToChainIndex.size())
{
return AZStd::array_view<uint8_t>();
return AZStd::span<const uint8_t>();
}
size_t mipChainIndex = m_mipLevelToChainIndex[mip];
@@ -119,7 +119,7 @@ namespace AZ
if (mipChainAsset == nullptr)
{
AZ_Warning("Streaming Image", false, "MipChain asset wasn't loaded");
return AZStd::array_view<uint8_t>();
return AZStd::span<const uint8_t>();
}
return mipChainAsset->GetSubImageData(mip - mipChain.m_mipOffset, slice);
@@ -154,7 +154,7 @@ namespace AZ
return m_materialPropertiesLayout.get();
}
AZStd::array_view<MaterialPropertyValue> MaterialTypeAsset::GetDefaultPropertyValues() const
AZStd::span<const MaterialPropertyValue> MaterialTypeAsset::GetDefaultPropertyValues() const
{
return m_propertyValues;
}
@@ -82,9 +82,9 @@ namespace AZ
return m_lodAssets.size();
}
AZStd::array_view<Data::Asset<ModelLodAsset>> ModelAsset::GetLodAssets() const
AZStd::span<const Data::Asset<ModelLodAsset>> ModelAsset::GetLodAssets() const
{
return AZStd::array_view<Data::Asset<ModelLodAsset>>(m_lodAssets);
return AZStd::span<const Data::Asset<ModelLodAsset>>(m_lodAssets);
}
void ModelAsset::SetReady()
@@ -213,7 +213,7 @@ namespace AZ
}
RHI::BufferViewDescriptor positionBufferViewDesc = positionBufferView->GetBufferViewDescriptor();
AZStd::array_view<uint8_t> positionRawBuffer = bufferAssetViewPtr->GetBuffer();
AZStd::span<const uint8_t> positionRawBuffer = bufferAssetViewPtr->GetBuffer();
const uint32_t positionElementSize = positionBufferViewDesc.m_elementSize;
const uint32_t positionElementCount = positionBufferViewDesc.m_elementCount;
@@ -227,7 +227,7 @@ namespace AZ
}
RHI::BufferViewDescriptor indexBufferViewDesc = indexBufferView.GetBufferViewDescriptor();
AZStd::array_view<uint8_t> indexRawBuffer = indexAssetViewPtr->GetBuffer();
AZStd::span<const uint8_t> indexRawBuffer = indexAssetViewPtr->GetBuffer();
const AZ::Vector3 rayEnd = rayStart + rayDir;
AZ::Vector3 a, b, c;
@@ -297,7 +297,7 @@ namespace AZ
{
for (const ModelLodAsset::Mesh& mesh : loadAssetPtr->GetMeshes())
{
const AZStd::array_view<ModelLodAsset::Mesh::StreamBufferInfo>& streamBufferList = mesh.GetStreamBufferInfoList();
const AZStd::span<const ModelLodAsset::Mesh::StreamBufferInfo>& streamBufferList = mesh.GetStreamBufferInfoList();
// find position semantic
const ModelLodAsset::Mesh::StreamBufferInfo* positionBuffer = nullptr;
@@ -101,7 +101,7 @@ namespace AZ
creator.SetName(sourceAsset->GetName().GetStringView());
AZ::Data::AssetId lastUsedId = cloneAssetId;
const AZStd::array_view<Data::Asset<ModelLodAsset>> sourceLodAssets = sourceAsset->GetLodAssets();
const AZStd::span<const Data::Asset<ModelLodAsset>> sourceLodAssets = sourceAsset->GetLodAssets();
for (const Data::Asset<ModelLodAsset>& sourceLodAsset : sourceLodAssets)
{
Data::Asset<ModelLodAsset> lodAsset;
@@ -61,7 +61,7 @@ namespace AZ
{
const auto& [first, second, third] = triangleIndices;
const AZStd::array_view<float>& positionBuffer = m_meshes[nObjIndex].m_vertexData;
const AZStd::span<const float>& positionBuffer = m_meshes[nObjIndex].m_vertexData;
if (positionBuffer.empty())
{
@@ -114,7 +114,7 @@ namespace AZ
for (AZ::u8 meshIndex = 0, meshCount = aznumeric_caster(m_meshes.size()); meshIndex < meshCount; ++meshIndex)
{
const AZStd::array_view<float> positionBuffer = m_meshes[meshIndex].m_vertexData;
const AZStd::span<const float> positionBuffer = m_meshes[meshIndex].m_vertexData;
for (size_t positionIndex = 0; positionIndex < positionBuffer.size(); positionIndex += 3)
{
entireBoundBox.AddPoint({positionBuffer[positionIndex], positionBuffer[positionIndex + 1], positionBuffer[positionIndex + 2]});
@@ -137,14 +137,14 @@ namespace AZ
return true;
}
AZStd::array_view<float> ModelKdTree::GetPositionsBuffer(const ModelLodAsset::Mesh& mesh)
AZStd::span<const float> ModelKdTree::GetPositionsBuffer(const ModelLodAsset::Mesh& mesh)
{
AZStd::array_view<float> positionBuffer = mesh.GetSemanticBufferTyped<float>(AZ::Name{"POSITION"});
AZStd::span<const float> positionBuffer = mesh.GetSemanticBufferTyped<float>(AZ::Name{"POSITION"});
AZ_Warning("ModelKdTree", !positionBuffer.empty(), "Could not find position buffers in a mesh");
return positionBuffer;
}
AZStd::array_view<ModelKdTree::TriangleIndices> ModelKdTree::GetIndexBuffer(const ModelLodAsset::Mesh& mesh)
AZStd::span<const ModelKdTree::TriangleIndices> ModelKdTree::GetIndexBuffer(const ModelLodAsset::Mesh& mesh)
{
return mesh.GetIndexBufferTyped<ModelKdTree::TriangleIndices>();
}
@@ -264,7 +264,7 @@ namespace AZ
const auto& [first, second, third] = pNode->GetVertexIndex(i);
const AZ::u32 nObjIndex = pNode->GetObjIndex(i);
const AZStd::array_view<float> positionBuffer = m_meshes[nObjIndex].m_vertexData;
const AZStd::span<const float> positionBuffer = m_meshes[nObjIndex].m_vertexData;
if (positionBuffer.empty())
{
@@ -95,9 +95,9 @@ namespace AZ
return m_indexBufferAssetView;
}
AZStd::array_view<ModelLodAsset::Mesh::StreamBufferInfo> ModelLodAsset::Mesh::GetStreamBufferInfoList() const
AZStd::span<const ModelLodAsset::Mesh::StreamBufferInfo> ModelLodAsset::Mesh::GetStreamBufferInfoList() const
{
return AZStd::array_view<ModelLodAsset::Mesh::StreamBufferInfo>(m_streamBufferInfo);
return AZStd::span<const ModelLodAsset::Mesh::StreamBufferInfo>(m_streamBufferInfo);
}
void ModelLodAsset::AddMesh(const Mesh& mesh)
@@ -109,9 +109,9 @@ namespace AZ
m_aabb.AddAabb(meshAabb);
}
AZStd::array_view<ModelLodAsset::Mesh> ModelLodAsset::GetMeshes() const
AZStd::span<const ModelLodAsset::Mesh> ModelLodAsset::GetMeshes() const
{
return AZStd::array_view<ModelLodAsset::Mesh>(m_meshes);
return AZStd::span<const ModelLodAsset::Mesh>(m_meshes);
}
const AZ::Aabb& ModelLodAsset::GetAabb() const
@@ -121,7 +121,7 @@ namespace AZ
const BufferAssetView* ModelLodAsset::Mesh::GetSemanticBufferAssetView(const AZ::Name& semantic) const
{
const AZStd::array_view<ModelLodAsset::Mesh::StreamBufferInfo>& streamBufferList = GetStreamBufferInfoList();
const AZStd::span<const ModelLodAsset::Mesh::StreamBufferInfo>& streamBufferList = GetStreamBufferInfoList();
for (const ModelLodAsset::Mesh::StreamBufferInfo& streamBufferInfo : streamBufferList)
{
@@ -243,7 +243,7 @@ namespace AZ
bool ModelLodAssetCreator::Clone(const Data::Asset<ModelLodAsset>& sourceAsset, Data::Asset<ModelLodAsset>& clonedResult, Data::AssetId& inOutLastCreatedAssetId)
{
AZStd::array_view<ModelLodAsset::Mesh> sourceMeshes = sourceAsset->GetMeshes();
AZStd::span<const ModelLodAsset::Mesh> sourceMeshes = sourceAsset->GetMeshes();
if (sourceMeshes.empty())
{
return true;
@@ -383,7 +383,7 @@ namespace AZ
return RHI::NullSrgLayout;
}
AZStd::array_view<RHI::Ptr<RHI::ShaderResourceGroupLayout>> ShaderAsset::GetShaderResourceGroupLayouts(
AZStd::span<const RHI::Ptr<RHI::ShaderResourceGroupLayout>> ShaderAsset::GetShaderResourceGroupLayouts(
SupervariantIndex supervariantIndex) const
{
auto supervariant = GetSupervariant(supervariantIndex);
+8 -8
View File
@@ -132,7 +132,7 @@ namespace UnitTest
{
return m_data;
}
private:
bool m_isMapped = false;
AZStd::vector<uint8_t> m_data;
@@ -146,7 +146,7 @@ namespace UnitTest
private:
AZ::RHI::ResultCode InitInternal(AZ::RHI::Device&, const AZ::RHI::BufferPoolDescriptor&) override { return AZ::RHI::ResultCode::Success;}
AZ::RHI::ResultCode InitBufferInternal(AZ::RHI::Buffer& bufferBase, const AZ::RHI::BufferDescriptor& descriptor) override
{
AZ_Assert(IsInitialized(), "Buffer Pool is not initialized");
@@ -264,7 +264,7 @@ namespace UnitTest
private:
AZ::RHI::ResultCode InitInternal(AZ::RHI::Device&, const AZ::RHI::PipelineLibraryData*) override { return AZ::RHI::ResultCode::Success; }
void ShutdownInternal() override {}
AZ::RHI::ResultCode MergeIntoInternal(AZStd::array_view<const AZ::RHI::PipelineLibrary*>) override { return AZ::RHI::ResultCode::Success; }
AZ::RHI::ResultCode MergeIntoInternal(AZStd::span<const AZ::RHI::PipelineLibrary* const>) override { return AZ::RHI::ResultCode::Success; }
AZ::RHI::ConstPtr<AZ::RHI::PipelineLibraryData> GetSerializedDataInternal() const override { return nullptr; }
};
@@ -372,11 +372,11 @@ namespace UnitTest
AZ::RHI::ResultCode InitInternal([[maybe_unused]] AZ::RHI::Device& device, [[maybe_unused]] const AZ::RHI::QueryPoolDescriptor& descriptor) override { return AZ::RHI::ResultCode::Success; }
AZ::RHI::ResultCode InitQueryInternal([[maybe_unused]] AZ::RHI::Query& query) override { return AZ::RHI::ResultCode::Success; }
AZ::RHI::ResultCode GetResultsInternal(
[[maybe_unused]] uint32_t startIndex,
[[maybe_unused]] uint32_t queryCount,
[[maybe_unused]] uint64_t* results,
[[maybe_unused]] uint32_t resultsCount,
[[maybe_unused]] AZ::RHI::QueryResultFlagBits flags) override
[[maybe_unused]] uint32_t startIndex,
[[maybe_unused]] uint32_t queryCount,
[[maybe_unused]] uint64_t* results,
[[maybe_unused]] uint32_t resultsCount,
[[maybe_unused]] AZ::RHI::QueryResultFlagBits flags) override
{ return AZ::RHI::ResultCode::Success; }
};
@@ -215,7 +215,7 @@ namespace UnitTest
return image;
}
void ValidateImageData(AZStd::array_view<uint8_t> data, const AZ::RHI::ImageSubresourceLayout& layout)
void ValidateImageData(AZStd::span<const uint8_t> data, const AZ::RHI::ImageSubresourceLayout& layout)
{
const uint32_t pixelSize = layout.m_size.m_width / layout.m_bytesPerRow;
@@ -260,7 +260,7 @@ namespace UnitTest
for (uint16_t arrayIndex = 0; arrayIndex < mipChain->GetArraySize(); ++arrayIndex)
{
AZStd::array_view<uint8_t> imageData = mipChain->GetSubImageData(mipLevel, arrayIndex);
AZStd::span<const uint8_t> imageData = mipChain->GetSubImageData(mipLevel, arrayIndex);
ValidateImageData(imageData, layout);
}
}
@@ -574,7 +574,7 @@ namespace UnitTest
EXPECT_EQ(mipChain->GetArraySize(), arraySize);
EXPECT_EQ(mipChain->GetSubImageCount(), mipLevels * arraySize);
AZStd::array_view<uint8_t> dataView = mipChain->GetSubImageData(0);
AZStd::span<const uint8_t> dataView = mipChain->GetSubImageData(0);
EXPECT_EQ(dataView[0], data[0]);
EXPECT_EQ(dataView[1], data[1]);
EXPECT_EQ(dataView[2], data[2]);
@@ -646,7 +646,7 @@ namespace UnitTest
MaterialPropertyIndex myFloat2 = layout->FindPropertyIndex(Name("general.MyFloat2"));
MaterialPropertyIndex myColor = layout->FindPropertyIndex(Name("general.MyColor"));
AZStd::array_view<MaterialPropertyValue> properties;
AZStd::span<const MaterialPropertyValue> properties;
// Check level 1 properties
properties = materialAssetLevel1.GetValue()->GetPropertyValues();
@@ -736,7 +736,7 @@ namespace UnitTest
// The properties will finalize automatically when we call GetPropertyValues()...
AZStd::array_view<MaterialPropertyValue> properties;
AZStd::span<const MaterialPropertyValue> properties;
// Check level 1 properties
properties = materialAssetLevel1->GetPropertyValues();
@@ -538,7 +538,11 @@ namespace UnitTest
auto shaderAsset = shader->GetAsset();
EXPECT_EQ(shader->GetPipelineStateType(), shaderAsset->GetPipelineStateType());
EXPECT_EQ(shader->GetShaderResourceGroupLayouts(), shaderAsset->GetShaderResourceGroupLayouts());
using ShaderResourceGroupLayoutSpan = AZStd::span<const AZ::RHI::Ptr<AZ::RHI::ShaderResourceGroupLayout>>;
ShaderResourceGroupLayoutSpan shaderResourceGroupLayoutSpan = shader->GetShaderResourceGroupLayouts();
ShaderResourceGroupLayoutSpan shaderAssetResourceGroupLayoutSpan = shader->GetShaderResourceGroupLayouts();
EXPECT_EQ(shaderResourceGroupLayoutSpan.data(), shaderAssetResourceGroupLayoutSpan.data());
EXPECT_EQ(shaderResourceGroupLayoutSpan.size(), shaderAssetResourceGroupLayoutSpan.size());
const RPI::ShaderVariant& rootShaderVariant = shader->GetVariant( RPI::ShaderVariantStableId{0} );
@@ -57,7 +57,7 @@ namespace UnitTest
}
template<typename T>
void ExpectEqual(AZStd::initializer_list<T> expectedValues, AZStd::array_view<T> arrayView)
void ExpectEqual(AZStd::initializer_list<T> expectedValues, AZStd::span<const T> arrayView)
{
EXPECT_EQ(expectedValues.size(), arrayView.size());
@@ -215,14 +215,14 @@ namespace UnitTest
EXPECT_TRUE(m_srg->SetConstant(inputIndex, true));
EXPECT_EQ(true, m_srg->GetConstant<bool>(inputIndex));
AZStd::array_view<uint8_t> result = m_srg->GetConstantRaw(inputIndex);
AZStd::array_view <uint32_t> resultInUint = AZStd::array_view<uint32_t>(reinterpret_cast<const uint32_t*>(result.data()), 1);
AZStd::span<const uint8_t> result = m_srg->GetConstantRaw(inputIndex);
AZStd::span<const uint32_t> resultInUint = AZStd::span<const uint32_t>(reinterpret_cast<const uint32_t*>(result.data()), 1);
ExpectEqual<uint32_t>({ 1 /*true*/ }, resultInUint);
EXPECT_TRUE(m_srg->SetConstant(inputIndex, false));
EXPECT_EQ(false, m_srg->GetConstant<bool>(inputIndex));
result = m_srg->GetConstantRaw(inputIndex);
resultInUint = AZStd::array_view<uint32_t>(reinterpret_cast<const uint32_t*>(result.data()), 1);
resultInUint = AZStd::span<const uint32_t>(reinterpret_cast<const uint32_t*>(result.data()), 1);
ExpectEqual<uint32_t>({ 0 /*false*/ }, resultInUint);
}
@@ -232,13 +232,13 @@ namespace UnitTest
// Check using inputIndex
EXPECT_TRUE(m_srg->SetConstantArray<bool>(inputIndex, AZStd::array<bool, 2>({ true, false })));
AZStd::array_view<uint8_t> result = m_srg->GetConstantRaw(inputIndex);
AZStd::array_view <uint32_t> resultInUint = AZStd::array_view<uint32_t>(reinterpret_cast<const uint32_t*>(result.data()), 2);
AZStd::span<const uint8_t> result = m_srg->GetConstantRaw(inputIndex);
AZStd::span<const uint32_t> resultInUint = AZStd::span<const uint32_t>(reinterpret_cast<const uint32_t*>(result.data()), 2);
ExpectEqual<uint32_t>({ 1 /*true*/, 0 /*false*/ }, resultInUint);
EXPECT_TRUE(m_srg->SetConstantArray<bool>(inputIndex, AZStd::array<bool, 2>({ false, true })));
result = m_srg->GetConstantRaw(inputIndex);
resultInUint = AZStd::array_view<uint32_t>(reinterpret_cast<const uint32_t*>(result.data()), 2);
resultInUint = AZStd::span<const uint32_t>(reinterpret_cast<const uint32_t*>(result.data()), 2);
ExpectEqual<uint32_t>({ 0 /*false*/, 1 /*true*/ }, resultInUint);
}
}
@@ -263,8 +263,8 @@ namespace UnitTest
const RHI::ShaderInputConstantIndex inputIndex(1);
EXPECT_TRUE(m_srg->SetConstantArray<bool>(inputIndex, AZStd::array<bool, 2>({ asBools[1], asBools[2] })));
AZStd::array_view<uint8_t> result = m_srg->GetConstantRaw(inputIndex);
AZStd::array_view <uint32_t> resultInUint = AZStd::array_view<uint32_t>(reinterpret_cast<const uint32_t*>(result.data()), 2);
AZStd::span<const uint8_t> result = m_srg->GetConstantRaw(inputIndex);
AZStd::span<const uint32_t> resultInUint = AZStd::span<const uint32_t>(reinterpret_cast<const uint32_t*>(result.data()), 2);
EXPECT_THAT(resultInUint, testing::ElementsAre(testing::IsTrue(), testing::IsFalse()));
}
}
@@ -356,7 +356,7 @@ namespace UnitTest
{
using namespace AZ;
AZStd::array_view<SimpleStruct> values;
AZStd::span<const SimpleStruct> values;
const RHI::ShaderInputConstantIndex inputIndex(17);
// Demonstrate the syntax of setting with a variable, and inputIndex...