Graphics Reference
In-Depth Information
getting statistics about the pipeline operation over the selected sequence of API calls, and
for a number of queries related to each of the stream output streams (making a total of four
different streams to query). In addition to the query type, the D3D11_QUERY_DESC structure
also provides a predicate hint option in the D3D11_QUERY_MISC_FLAG enumeration, which
will be discussed briefly in the predicated rendering section.
We will provide an example of using the pipeline statistics query, since this is gener-
ally a useful tool for developers. The sequence that must be followed to query the pipeline
statistics (as one might expect) is as follows:
Create the query object.
Begin the query.
End the query.
Retrieve the results.
As mentioned above, the query is created through the ID3DllDevice: :CreateQuery()
method. Since we want to query the pipeline statistics, we would fill in the description struc-
ture accordingly and pass it to the create query method. After the query has successfully
been created, we will use the ID3DllDeviceContext interface to begin and end the query.
The methods ID3DllDeviceContext::Begin() and ID3DllDeviceContext::End() will
mark the beginning and the end of a query, where all of the corresponding API calls be-
tween these two methods will affect the outcome of the query. It is important to note that
the semantics for when to call the begin and end methods depend on the type of query be-
ing performed, and that some queries don't even require the call to begin.
After the query sequence has been indicated, the application checks on the status of
the query by calling the ID3DllDeviceContext: :GetData() method and passing in the
desired query. This method may return S_OK or S_FALSE, depending on if the query has
completed executing. If it returns S_OK, the data returned in the user-supplied pointers to
the GetData method will contain the results of the query. Otherwise, the query is still being
executed, and the CPU must check back at a later time for the results. The actual data that
is returned will vary by query type. In the case of the pipeline statistics, the result will be
a D3D11_QUERY_DATA_PIPELINE_STATISTICS structure, which is shown in Listing B.2.
Struct D3D11_QUERY_DATA_PIPELINE_STATISTICS {
UINT64 IAVertices;
UINT64 IAPrimitives;
UINT64 VSInvocations;
UINT64 GSInvocations;
UINT64 GSPrimitives;
UINT64 CInvocations;
UINT64 CPrimitives;
Search WWH ::




Custom Search