Table of Contents

Class QueryPool

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

A pool holding asynchronous GPU Queries of a specific type.

public class QueryPool : GraphicsResourceBase, IDisposable, IComponent, IReferencable, ICollectorHolder
Inheritance
object
QueryPool
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

graphicsDevice GraphicsDevice

The Graphics Device.

queryType QueryType

The type of GPU Queries to contain in the pool.

queryCount int

The capacity of the pool.

Properties

QueryCount

Gets the capacity of the pool.

public int QueryCount { get; }

Property Value

int

QueryType

Gets the types of asynchronous GPU Queries in the pool.

public QueryType QueryType { get; }

Property Value

QueryType

Methods

New(GraphicsDevice, QueryType, int)

Creates a new QueryPool.

public static QueryPool New(GraphicsDevice graphicsDevice, QueryType queryType, int queryCount)

Parameters

graphicsDevice GraphicsDevice

The Graphics Device.

queryType QueryType

The type of GPU Queries to contain in the pool.

queryCount int

The capacity of the pool.

Returns

QueryPool

An new instance of QueryPool of the specified queryType.

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

immediately bool

A 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

bool

true if resource has transitioned to the Active state.

TryGetData(long[])

Attempts to retrieve data from the in-flight GPU queries.

public bool TryGetData(long[] dataArray)

Parameters

dataArray long[]

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

bool

true if all data queries succeed; otherwise, false.

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.

See Also