Game/MMD

DirectX11 Timestamp GetData busy wait problem

newpolaris 2017. 7. 14. 15:49
while (S_OK != Graphics::g_Context->GetData( pQueryDisjoint, pDisjoint, sizeof(D3D11_QUERY_DATA_TIMESTAMP_DISJOINT),  D3D11_ASYNC_GETDATA_DONOTFLUSH)) {}

if (!pDisjoint->Disjoint)
{
    for (uint32_t i = 0; i < NumQueries; i++)
    {
        if (S_OK != Graphics::g_Context->GetData( pQueryHeap[i], &pBuffer[i], sizeof( UINT64 ), 0 ))
            pBuffer[i] = 0;
    }
}

Without timestamp

With timestamp

Hot to reduce it?

Solution:

  1. Queued query data and resolve it next successive frame ( when GetData returns true ) - Query pool needed

https://github.com/NVIDIAGameWorks/D3DSamples/blob/master/samples/ComputeFilter/src/perftracker.cpp

  1. Do not update while success.