Polls a queried resource to get the query state or a query result. For more information about queries, see Queries.
HRESULT GetData( void* pData, DWORD dwSize, DWORD dwGetDataFlags );
The return type identifies the query state (see Queries). The method returns S_OK if the query data is available and S_FALSE if it is not. These are considered successful return values. If the method fails when D3DGETDATA_FLUSH is used, the return value can be D3DERR_DEVICELOST.
It is possible to lose the device while polling for query status. When D3DGETDATA_FLUSH is specified, this method will return D3DERR_DEVICELOST in response to a lost device. This allows an application to prevent threads from endlessly polling due to a lost device (which cannot respond to the query).
An application must never write code that only invokes GetData ( ... , 0 ), expecting that GetData will eventually return S_OK by itself over time. This is true, even if the application has used the FLUSH flag with GetData in the past. For example:
// Enables an infinite loop: while( pQuery->GetData( ... , 0 ) == S_FALSE ) ; // Still enables an infinite loop: pQuery->GetData( ... , D3DGETDATA_FLUSH ); while( pQuery->GetData( ... , 0 ) == S_FALSE ) ; // Does not enable an infinate loop because eventually the command // buffer will fill up and that will cause a flush to occur. while( pQuery->GetData( ..., 0 ) == S_FALSE ) { pDevice->SetTexture(...); pDevice->Draw(...); }
Header: Declared in D3d9.h.