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

#include <MultiDeviceQueryPool.h>

Inherits AZ::RHI::MultiDeviceResourcePool.

Public Member Functions

 AZ_CLASS_ALLOCATOR (MultiDeviceQueryPool, AZ::SystemAllocator, 0)
 
Ptr< QueryPoolGetDeviceQueryPool (int deviceIndex) const
 Returns the device-specific QueryPool for the given index.
 
ResultCode Init (MultiDevice::DeviceMask deviceMask, const QueryPoolDescriptor &descriptor)
 Initialize the MultiDeviceQueryPool by initializing all device-specific QueryPools for each device mentioned in the deviceMask.
 
ResultCode InitQuery (MultiDeviceQuery *query)
 
ResultCode InitQuery (MultiDeviceQuery **queries, uint32_t queryCount)
 
uint32_t CalculateResultsCount (uint32_t queryCount=0)
 
ResultCode GetResults (uint64_t *results, uint32_t resultsCount, QueryResultFlagBits flags)
 
ResultCode GetResults (MultiDeviceQuery *query, uint64_t *result, uint32_t resultsCount, QueryResultFlagBits flags)
 Same as GetResults(uint64_t, uint32_t, QueryResultFlagBits) but for a specific multi-device query.
 
ResultCode GetResults (MultiDeviceQuery **queries, uint32_t queryCount, uint64_t *results, uint32_t resultsCount, QueryResultFlagBits flags)
 
const QueryPoolDescriptorGetDescriptor () const override final
 
void Shutdown () override final
 Forwards the shutdown call to all device-specific QueryPools.
 
- Public Member Functions inherited from AZ::RHI::MultiDeviceResourcePool
 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 ResourcePoolDescriptorGetDescriptor () const =0
 Returns the resource pool descriptor.
 
- Public Member Functions inherited from AZ::RHI::MultiDeviceObject
 AZ_RTTI (MultiDeviceObject, "{17D34F71-944C-4AF5-9823-627474C4C0A6}", Object)
 
bool IsInitialized () const
 Returns whether the device object is initialized.
 
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.
 

Additional Inherited Members

- Protected Types inherited from AZ::RHI::MultiDeviceResourcePool
using PlatformMethod = AZStd::function< RHI::ResultCode()>
 //!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//
 
- Protected Member Functions inherited from AZ::RHI::MultiDeviceResourcePool
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.
 
- Protected Member Functions inherited from AZ::RHI::MultiDeviceObject
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.
 
- Protected Member Functions inherited from AZ::RHI::Object
void add_ref () const
 
void release () const
 
- Protected Attributes inherited from AZ::RHI::Object
AZStd::atomic_int m_useCount = 0
 

Detailed Description

MultiDeviceQueryPool manages a map of device-specific QueryPools, which provide backing storage and context for query instances. The QueryPoolDescriptor contains properties defining memory characteristics of query pools. All queries created on a pool share the same backing and type.

Member Function Documentation

◆ CalculateResultsCount()

uint32_t AZ::RHI::MultiDeviceQueryPool::CalculateResultsCount ( uint32_t  queryCount = 0)

Get the number of results that have to be allocated. The number returned is the number of results per query, multiplied by the number of queries and the number of devices. The number of devices is queried from the RHISystem. If the queryCount is omitted or equal to 0, the total number of queries in the pool is used.

◆ GetDescriptor()

const QueryPoolDescriptor & AZ::RHI::MultiDeviceQueryPool::GetDescriptor ( ) const
finaloverridevirtual

Returns the buffer descriptor used to initialize the query pool. Descriptor contents are undefined for uninitialized pools.

Implements AZ::RHI::MultiDeviceResourcePool.

◆ GetResults() [1/2]

ResultCode AZ::RHI::MultiDeviceQueryPool::GetResults ( MultiDeviceQuery **  queries,
uint32_t  queryCount,
uint64_t *  results,
uint32_t  resultsCount,
QueryResultFlagBits  flags 
)

Same as GetResults(MultiDeviceQuery*, uint64_t, uint32_t, QueryResultFlagBits) but for a list of queries. It's more efficient if the list of queries is sorted by handle in ascending order because there's no need to sort the results before returning.

◆ GetResults() [2/2]

ResultCode AZ::RHI::MultiDeviceQueryPool::GetResults ( uint64_t *  results,
uint32_t  resultsCount,
QueryResultFlagBits  flags 
)

Get the results from all queries (from all devices) in the pool, which are returned as uint64_t data. The parameter "resultsCount" denotes the total number of results requested. It can be determined by calling GetResultsCount(). The "results" parameter must contain enough space to save the results from all queries (from all devices) in the pool, i.e. resultCount * sizeof(uint64_t), must be pre-allocated. Results are ordered by device (using the deviceIndex) first and then per query, i.e., all results from a device are consecutive in memory. Data will only be written to the results array if the device actually exists, i.e., if its bit in the query's device mask is set and the device index is lower than the RHISystem's device count. The function can return partial results. In case of failure of requesting results from a specific device, only results from lower-indexed devices (which already have successfully returned results) are returned. For further details related to device-specific query functionality, please check the related header.

◆ InitQuery() [1/2]

ResultCode AZ::RHI::MultiDeviceQueryPool::InitQuery ( MultiDeviceQuery **  queries,
uint32_t  queryCount 
)

Initialize a group of queries from the pool. The initialization will try to allocate the queries in a consecutive space (consecutive per device). The reason for this is that is more efficient when requesting results or copying multiple query results.

Parameters
queriesPointer to an array of queries to initialize.
queryCountNumber of queries.

◆ InitQuery() [2/2]

ResultCode AZ::RHI::MultiDeviceQueryPool::InitQuery ( MultiDeviceQuery query)

Initialize a query from the pool (one device-specific query for each QueryPool). When initializing multiple queries use the other version of InitQuery because the pool will try to group the queries together.

Parameters
queryMultiDeviceQuery to initialize.

◆ Shutdown()

void AZ::RHI::MultiDeviceQueryPool::Shutdown ( )
finaloverridevirtual

Forwards the shutdown call to all device-specific QueryPools.

Implements AZ::RHI::MultiDeviceResourcePool.


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