Files
o3de/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshStatsCollector.h
T
lumberyard-employee-dm b9824ed172 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>
2022-01-26 16:15:47 -06:00

49 lines
2.2 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
*
*/
#pragma once
#include <Atom/Feature/SkinnedMesh/SkinnedMeshStatsBus.h>
namespace AZ
{
namespace Render
{
class SkinnedMeshFeatureProcessor;
//! Implements the SkinnedMeshStatsRequestBus for collecting stats about skinned mesh usage in a scene
class SkinnedMeshStatsCollector
: public SkinnedMeshStatsRequestBus::Handler
{
public:
SkinnedMeshStatsCollector() = delete;
SkinnedMeshStatsCollector(SkinnedMeshFeatureProcessor* featureProcessor);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// SkinnedMeshStatsRequestBus::Handler overrides...
//! GetSceneStats re-calculates all the scene stats on demand. Requesting them every frame means re-calculating them every frame
virtual SkinnedMeshSceneStats GetSceneStats() override;
private:
void ResetAllStats();
void AddDispatchItemToSceneStats(const AZStd::unique_ptr<SkinnedMeshDispatchItem>& dispatchItem);
void AddBonesToSceneStats(const Data::Instance<RPI::Buffer>& boneTransformBuffer);
void AddReadOnlyBufferViewsToSceneStats(const AZStd::span<const AZ::RHI::Ptr<RHI::BufferView>>& sourceUnskinnedBufferViews);
void AddWritableBufferViewsToSceneStats(const AZStd::span<const AZ::RHI::Ptr<RHI::BufferView>>& targetSkinnedBufferViews);
void AddVerticesToSceneStats(size_t vertexCount);
SkinnedMeshSceneStats m_sceneStats;
// Use sets to ensure we're not double-counting any resources that are shared
AZStd::unordered_set<RPI::Buffer*> m_sceneBoneTransforms;
AZStd::unordered_set<RHI::BufferView*> m_sceneReadOnlyBufferViews;
AZStd::unordered_set<RHI::BufferView*> m_sceneWritableBufferViews;
SkinnedMeshFeatureProcessor* m_featureProcessor;
};
} // namespace Render
} // namespace AZ