|
This sample application uses the new
asynchronous visibility query mechanism introduced in
DirectX 9 to count how many pixels of the teapot are
visible in the final frame. The four circular
"blockers" are drawn first. Prior to
drawing the teapot, a visibility query is begun:
m_pTeapotVizQuery->Issue(D3DISSUE_BEGIN);
After the teapot is drawn, the query is ended and the
application spins waiting for the result:
m_pTeapotVizQuery->Issue(D3DISSUE_END);
// Stupidly block
until we have a query result
while (m_pTeapotVizQuery->GetData((void *)
&m_dwVizData, sizeof(DWORD), D3DGETDATA_FLUSH) ==
S_FALSE)
{
// asynchronous aspect of GetData() so I can do
something
// here while the HW is still working on my DrawPrimitives()
}
The resulting numerical pixel count returned in m_dwVizData is output to the screen.
|