#include <MultiDeviceResourcePool.h>
Inherits AZ::RHI::MultiDeviceObject.
Inherited by AZ::RHI::MultiDeviceQueryPool.
|
| AZ_RTTI (MultiDeviceResourcePool, "{BAE5442C-A312-4133-AE80-1200753A7C3E}", MultiDeviceObject) |
|
virtual void | Shutdown () override=0 |
| 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.
|
|
virtual const ResourcePoolDescriptor & | GetDescriptor () const =0 |
| Returns the resource pool descriptor.
|
|
| AZ_RTTI (MultiDeviceObject, "{17D34F71-944C-4AF5-9823-627474C4C0A6}", Object) |
|
bool | IsInitialized () const |
| Returns whether the device object is initialized.
|
|
MultiDevice::DeviceMask | GetDeviceMask () 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()> |
| //!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//
|
|
|
ResultCode | Init (MultiDevice::DeviceMask deviceMask, const PlatformMethod &initMethod) |
|
ResultCode | InitResource (MultiDeviceResource *resource, const PlatformMethod &initResourceMethod) |
|
bool | ValidateIsRegistered (const MultiDeviceResource *resource) const |
|
bool | ValidateIsUnregistered (const MultiDeviceResource *resource) const |
|
bool | ValidateIsInitialized () const |
| Validates that the resource pool is initialized and ready to service requests.
|
|
void | Init (MultiDevice::DeviceMask deviceMask) |
| The derived class should call this method to assign the device.
|
|
void | Shutdown () override |
| Clears the current bound device to null.
|
|
template<typename T > |
void | IterateDevices (T callback) |
| Helper method that will iterate over all selected devices and call the provided callback.
|
|
void | add_ref () const |
|
void | release () const |
|
|
class | MultiDeviceResource |
|
|
AZStd::atomic_int | m_useCount = 0 |
|
A base class for multi-device resource pools. This class facilitates registration of multi-device resources into the pool, and allows iterating child resource instances.
◆ PlatformMethod
//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//
A simple functor that returns a result code.
◆ ForEach()
template<typename ResourceType >
void AZ::RHI::MultiDeviceResourcePool::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.
◆ GetDescriptor()
◆ Init()
ResultCode AZ::RHI::MultiDeviceResourcePool::Init |
( |
MultiDevice::DeviceMask |
deviceMask, |
|
|
const PlatformMethod & |
initMethod |
|
) |
| |
|
protected |
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.
◆ InitResource()
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.
◆ Shutdown()
virtual void AZ::RHI::MultiDeviceResourcePool::Shutdown |
( |
| ) |
|
|
overridepure virtual |
◆ ValidateIsRegistered()
bool AZ::RHI::MultiDeviceResourcePool::ValidateIsRegistered |
( |
const MultiDeviceResource * |
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.
The documentation for this class was generated from the following file:
- Gems/Atom/RHI/Code/Include/Atom/RHI/MultiDeviceResourcePool.h