ID3D11DeviceContextX::WriteQuery Method

Executes a query and writes the results to a buffer.

Syntax

public:
void WriteQuery(
         D3D11_QUERY QueryType,
         UINT QueryIndex,
         UINT Flags,
         ID3D11Buffer *pBuffer,
         UINT OffsetInBytes,
         UINT StrideInBytes
)  

Parameters

QueryType
Type: D3D11_QUERY 

[in] Type of query to perform. D3D11_QUERY_TIMESTAMP_DISJOINT and predicate query types are not supported.

QueryIndex
Type: UINT 

[in] Index of the query. The index is used for D3D11_QUERY_OCCLUSION to select between one of two available occlusion counters for query.

Flags
Type: UINT 

[in] A set of flags to control the query, as a bitwise-OR’d combination of D3D11X_QUERY_FLAG enumeration constants.

pBuffer
Type: ID3D11Buffer *

[in] A pointer to an ID3D11Buffer.

OffsetInBytes
Type: UINT 

[in] Offset in bytes from the start of the buffer to write the query results. The offset must be 8-byte aligned.

StrideInBytes
Type: UINT 

[in] Stride in bytes to apply in writing query results composed of multiple instances. The stride is used for occlusion queries in the separation of 64-bit counter results from each of the targeted DBs. Supported strides are 64, 128, and 256 bytes.

Return value

None.

Remarks

While WriteQuery may be used with legacy semantics contexts, it operates as though fast semantics has been declared. It is the responsibility of the caller to perform any required synchronization in accessing the query results written to the buffer. Collected results reflect an assumption that fast kickoffs are being employed.

The format of the query results written to the buffer is dependent upon the D3D11_QUERY QueryType specified. The structure of the results per type is as follows:

QueryType Structure
D3D11_QUERY_EVENT D3D11X_QUERY_DATA_GPU_EVENT (typedef’d as UINT)
D3D11_QUERY_TIMESTAMP D3D11X_QUERY_DATA_GPU_TIMESTAMP (typedef’d as UINT64)
D3D11_QUERY_PIPELINE_STATISTICS D3D11X_QUERY_DATA_GPU_PIPELINE_STATISTICS
D3D11_QUERY_SO_STATISTICS_STREAMn D3D11X_QUERY_DATA_GPU_SO_STATISTICS
D3D11_QUERY_OCCLUSION D3D11X_QUERY_DATA_GPU_OCCLUSION_COUNT (per DB result) (typedef’d as UINT64)

Requirements

Header: Declared in d3d11_x.h.

Library: Use d3d11_x.lib.

See also

Reference

ID3D11DeviceContextX::SetPredicationFromQuery

ID3D11DeviceContextX Interface

ID3D11DeviceContextX Members