Open 3D Engine Atom Gem API Reference 25.05.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::RHI::MultiDeviceObject Class Reference

#include <MultiDeviceObject.h>

Inherits AZ::RHI::Object.

Inherited by AZ::RHI::Fence, AZ::RHI::IndirectBufferSignature, AZ::RHI::PipelineLibrary, AZ::RHI::PipelineState, AZ::RHI::RayTracingBlas, AZ::RHI::RayTracingBufferPools, AZ::RHI::RayTracingCompactionQuery, AZ::RHI::RayTracingCompactionQueryPool, AZ::RHI::RayTracingPipelineState, AZ::RHI::RayTracingShaderTable, AZ::RHI::RayTracingTlas, AZ::RHI::Resource, AZ::RHI::ResourcePool, and AZ::RHI::TransientAttachmentPool.

Public Member Functions

 AZ_RTTI (MultiDeviceObject, "{17D34F71-944C-4AF5-9823-627474C4C0A6}", Object)
 
bool IsInitialized () const
 Returns whether the device object is initialized.
 
AZ_FORCE_INLINE bool IsDeviceSet (int deviceIndex) const
 
MultiDevice::DeviceMask GetDeviceMask () const
 
- Public Member Functions inherited from AZ::RHI::Object
 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.
 

Static Public Member Functions

template<typename T >
static AZ_FORCE_INLINE void IterateDevices (MultiDevice::DeviceMask deviceMask, T callback)
 

Protected Member Functions

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 >
AZ_FORCE_INLINE void IterateDevices (T callback)
 Helper method that will iterate over all selected devices and call the provided callback.
 
template<typename T , typename U >
AZ_FORCE_INLINE decltype(auto) IterateObjects (U callback)
 
template<typename T , typename U >
AZ_FORCE_INLINE decltype(auto) IterateObjects (U callback) const
 
template<typename T >
AZ_FORCE_INLINE Ptr< T > GetDeviceObject (int deviceIndex) const
 
- Protected Member Functions inherited from AZ::RHI::Object
void add_ref () const
 
void release () const
 

Protected Attributes

AZStd::unordered_map< int, Ptr< DeviceObject > > m_deviceObjects
 A map of all device-specific objects, indexed by the device index.
 
- Protected Attributes inherited from AZ::RHI::Object
AZStd::atomic_int m_useCount = 0
 

Detailed Description

A variant of Object associated with a DeviceMask. In contrast to DeviceObject, which is device-specific and holds a strong reference to a specific device, MultiDeviceObject only specifies on which device an object resides/operates, specified by a DeviceMask (1 bit per device).

Member Function Documentation

◆ GetDeviceMask()

MultiDevice::DeviceMask AZ::RHI::MultiDeviceObject::GetDeviceMask ( ) const

Returns the device this object is associated with. It is only permitted to call this method when the object is initialized.

◆ IsDeviceSet()

AZ_FORCE_INLINE bool AZ::RHI::MultiDeviceObject::IsDeviceSet ( int  deviceIndex) const
inline

Helper method to check if a device index is set in the device mask. Note: A bit may be set but a device object may not actually exist, e.g. if the device index is bigger than the device count.

◆ IterateDevices()

template<typename T >
static AZ_FORCE_INLINE void AZ::RHI::MultiDeviceObject::IterateDevices ( MultiDevice::DeviceMask  deviceMask,
callback 
)
inlinestatic

Helper method that will iterate over all available devices in a device mask and call the provided callback The callback is called with the device index and needs to return a boolean indicating whether to continue th iteration.

◆ IterateObjects()

template<typename T , typename U >
AZ_FORCE_INLINE decltype(auto) AZ::RHI::MultiDeviceObject::IterateObjects ( callback)
inlineprotected

Helper method that will iterate over all device objects and call the provided callback with a device index and the object expecting ResultCode::Success in order to continue the iteration

◆ Shutdown()

void AZ::RHI::MultiDeviceObject::Shutdown ( )
overrideprotectedvirtual

The documentation for this class was generated from the following file: