Class QueryPool
A pool holding asynchronous GPU Queries of a specific type.
public class QueryPool : GraphicsResourceBase, IDisposable, IComponent, IReferencable, ICollectorHolder
- Inheritance
-
objectQueryPool
- Implements
- Inherited Members
- Extension Methods
Constructors
QueryPool(GraphicsDevice, QueryType, int)
Initializes a new instance of the QueryPool class.
protected QueryPool(GraphicsDevice graphicsDevice, QueryType queryType, int queryCount)
Parameters
graphicsDeviceGraphicsDeviceThe Graphics Device.
queryTypeQueryTypeThe type of GPU Queries to contain in the pool.
queryCountintThe capacity of the pool.
Properties
QueryCount
Gets the capacity of the pool.
public int QueryCount { get; }
Property Value
QueryType
Gets the types of asynchronous GPU Queries in the pool.
public QueryType QueryType { get; }
Property Value
Methods
New(GraphicsDevice, QueryType, int)
Creates a new QueryPool.
public static QueryPool New(GraphicsDevice graphicsDevice, QueryType queryType, int queryCount)
Parameters
graphicsDeviceGraphicsDeviceThe Graphics Device.
queryTypeQueryTypeThe type of GPU Queries to contain in the pool.
queryCountintThe capacity of the pool.
Returns
OnDestroyed(bool)
Called when the GraphicsDevice has been detected to be internally destroyed, or when the Destroy() methad has been called. Raises the Destroyed event.
protected override void OnDestroyed(bool immediately = false)
Parameters
immediatelyboolA value indicating whether the resource should be destroyed immediately (true), or if it can be deferred until it's safe to do so (false).
Remarks
This method releases the underlying native resources (Silk.NET.Direct3D11.ID3D11Resource and Silk.NET.Direct3D11.ID3D11DeviceChild).
OnRecreate()
Called when the GraphicsDevice has been recreated.
protected override bool OnRecreate()
Returns
TryGetData(long[])
Attempts to retrieve data from the in-flight GPU queries.
public bool TryGetData(long[] dataArray)
Parameters
dataArraylong[]An array of long values to be populated with the retrieved data. The array must have a length equal to the number of queries performed (QueryCount).
Returns
Remarks
This method tries to perform reads for the multiple GPU queries in the pool and populates the provided array with the results. If any query fails, the method returns false and the array may contain partial or uninitialized data.