#include <ResourcePool.h>
Inherits AZ::RHI::DeviceObject, Handler, and Handler.
Inherited by AZ::RHI::AliasedHeap, AZ::RHI::BufferPoolBase, AZ::RHI::ImagePoolBase, AZ::RHI::QueryPool, and AZ::RHI::ShaderResourceGroupPool.
|
| AZ_RTTI (ResourcePool,"{757EB674-25DC-4D00-9808-D3DAF33A4EFE}", DeviceObject) |
|
void | Shutdown () overridefinal |
| Shuts down the pool. This method will shutdown all resources associated with the pool.
|
|
template<typename ResourceType > |
void | ForEach (AZStd::function< void(ResourceType &)> callback) |
|
template<typename ResourceType > |
void | ForEach (AZStd::function< void(const ResourceType &)> callback) const |
|
uint32_t | GetResourceCount () const |
| Returns the number of resources in the pool.
|
|
ResourcePoolResolver * | GetResolver () |
| Returns the resolver for this pool.
|
|
const ResourcePoolResolver * | GetResolver () const |
|
virtual const
ResourcePoolDescriptor & | GetDescriptor () const =0 |
| Returns the resource pool descriptor.
|
|
const HeapMemoryUsage & | GetHeapMemoryUsage (HeapMemoryLevel heapMemoryLevel) const |
| Returns the memory used by this pool for a specific heap type.
|
|
const PoolMemoryUsage & | GetMemoryUsage () const |
| Returns the memory used by this pool.
|
|
| AZ_RTTI (DeviceObject,"{17D34F71-944C-4AF5-9823-627474C4C0A6}", Object) |
|
bool | IsInitialized () const |
| Returns whether the device object is initialized.
|
|
Device & | GetDevice () const |
|
| AZ_RTTI (Object,"{E43378F1-2331-4173-94B8-990ED20E6003}") |
|
void | SetName (const Name &name) |
| Sets the name of the object.
|
|
const Name & | GetName () const |
| Returns the name set on the object by SetName.
|
|
uint32_t | use_count () |
| Returns the current use count of the object.
|
|
|
using | PlatformMethod = AZStd::function< RHI::ResultCode()> |
| A simple functor that returns a result code.
|
|
A base class for resource pools. This class facilitates registration of resources into the pool, and allows iterating child resource instances.
virtual void AZ::RHI::ResourcePool::ComputeFragmentation |
( |
| ) |
const |
|
protectedpure virtual |
template<typename ResourceType >
void AZ::RHI::ResourcePool::ForEach |
( |
AZStd::function< void(ResourceType &)> |
callback | ) |
|
Loops through every resource matching the provided resource type (RTTI casting is used) and calls the provided callback method. Both methods are thread-safe with respect to other Init calls. A shared_mutex is used to guard the internal registry. This means that multiple iterations can be done without blocking each other, but a resource Init / Shutdown will serialize with this method.
Validates the pool for initialization, calls the provided init method (which wraps the platform-specific resource init call). If the platform init fails, the resource pool is shutdown and an error code is returned.
ResultCode AZ::RHI::ResourcePool::InitResource |
( |
Resource * |
resource, |
|
|
const PlatformMethod & |
initResourceMethod |
|
) |
| |
|
protected |
Validates the state of resource, calls the provided init method, and registers the resource with the pool. If validation or the internal platform init method fail, the resource is not registered and an error code is returned.
void AZ::RHI::ResourcePool::SetResolver |
( |
AZStd::unique_ptr< ResourcePoolResolver > && |
resolvePolicy | ) |
|
|
protected |
Each platform implementation has the option to supply a resolver object. It's a platform defined class charged with performing resource data uploads on a scope in the FrameScheduler. Leaving this empty means the platform pool does not require a resolve operation.
bool AZ::RHI::ResourcePool::ValidateIsRegistered |
( |
const Resource * |
resource | ) |
const |
|
protected |
Validates the resource is registered / unregistered with the pool, and that it not null. In non-release builds this will issue a warning. Non-release builds will branch and fail the call if validation fails, but this should be treated as a bug, because release will disable validation.
Pool memory usage is held by the base class. It is exposed for public const access and protected mutable access. The budget components are assigned by this class (those should not be touched as they are passed from the user), but the usage components are managed by the platform pool implementation. The platform components are atomic, which enables for lock-free memory tracking.
The documentation for this class was generated from the following file:
- Gems/Atom/RHI/Code/Include/Atom/RHI/ResourcePool.h