|
|
Can occlusion query calculate the changed pixel number in the RenderTraget texture that was SetrenderTarget in Drawing Function bracketed between the begin and end of Occulsion Query?
- IDirect3DQuery9* pOcclusionQuery;
- DWORD numberOfPixelsDrawn;
- m_pD3DDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, &pOcclusionQuery);
- // Add an end marker to the command buffer queue.
- pOcclusionQuery->Issue(D3DISSUE_BEGIN);
- // API render loop
- ...
- Draw(...) <<==Drawing Function, using SetRenderTarget
- ...
- // Add an end marker to the command buffer queue.
- pOcclusionQuery->Issue(D3DISSUE_END);
- // Force the driver to execute the commands from the command buffer.
- // Empty the command buffer and wait until the GPU is idle.
- while(S_FALSE == pOcclusionQuery->GetData( &numberOfPixelsDrawn,
- sizeof(DWORD), D3DGETDATA_FLUSH ))
- ;
复制代码 |
|