b9824ed172
* 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>
88 lines
3.0 KiB
C++
88 lines
3.0 KiB
C++
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project.
|
|
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
|
|
#include <Atom/RPI.Reflect/Buffer/BufferAsset.h>
|
|
|
|
#include <AzCore/Asset/AssetSerializer.h>
|
|
#include <AzCore/RTTI/ReflectContext.h>
|
|
#include <AzCore/Serialization/SerializeContext.h>
|
|
|
|
namespace AZ
|
|
{
|
|
AZ_TYPE_INFO_SPECIALIZE(RPI::CommonBufferPoolType, "{E3FD19DF-4395-46FD-8092-D27BC73A3688}");
|
|
|
|
namespace RPI
|
|
{
|
|
const char* BufferAsset::DisplayName = "BufferAsset";
|
|
const char* BufferAsset::Group = "Buffer";
|
|
const char* BufferAsset::Extension = "azbuffer";
|
|
|
|
void BufferAsset::Reflect(ReflectContext* context)
|
|
{
|
|
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
|
|
{
|
|
serializeContext->Class<BufferAsset>()
|
|
->Version(2)
|
|
->Field("Name", &BufferAsset::m_name)
|
|
->Field("Buffer", &BufferAsset::m_buffer)
|
|
->Field("BufferDescriptor", &BufferAsset::m_bufferDescriptor)
|
|
->Field("BufferViewDescriptor", &BufferAsset::m_bufferViewDescriptor)
|
|
->Field("BufferPoolAsset", &BufferAsset::m_poolAsset)
|
|
->Field("CommonBufferPoolType", &BufferAsset::m_poolType)
|
|
;
|
|
|
|
// register enum strings
|
|
serializeContext->Enum<CommonBufferPoolType>()
|
|
->Value("Constant", CommonBufferPoolType::Constant)
|
|
->Value("StaticInputAssembly", CommonBufferPoolType::StaticInputAssembly)
|
|
->Value("DynamicInputAssembly", CommonBufferPoolType::DynamicInputAssembly)
|
|
->Value("ReadBack", CommonBufferPoolType::ReadBack)
|
|
->Value("ReadWrite", CommonBufferPoolType::ReadWrite)
|
|
->Value("ReadOnly", CommonBufferPoolType::ReadOnly)
|
|
->Value("Invalid", CommonBufferPoolType::Invalid)
|
|
;
|
|
}
|
|
}
|
|
|
|
AZStd::span<const uint8_t> BufferAsset::GetBuffer() const
|
|
{
|
|
return AZStd::span<const uint8_t>(m_buffer);
|
|
}
|
|
|
|
const RHI::BufferDescriptor& BufferAsset::GetBufferDescriptor() const
|
|
{
|
|
return m_bufferDescriptor;
|
|
}
|
|
|
|
const RHI::BufferViewDescriptor& BufferAsset::GetBufferViewDescriptor() const
|
|
{
|
|
return m_bufferViewDescriptor;
|
|
}
|
|
|
|
void BufferAsset::SetReady()
|
|
{
|
|
m_status = AssetStatus::Ready;
|
|
}
|
|
|
|
const Data::Asset<ResourcePoolAsset>& BufferAsset::GetPoolAsset() const
|
|
{
|
|
return m_poolAsset;
|
|
}
|
|
|
|
CommonBufferPoolType BufferAsset::GetCommonPoolType() const
|
|
{
|
|
return m_poolType;
|
|
}
|
|
|
|
const AZStd::string& BufferAsset::GetName() const
|
|
{
|
|
return m_name;
|
|
}
|
|
} //namespace RPI
|
|
} // namespace AZ
|