• Advertisement
Sign in to follow this  

[DX9/DX10] Profiling

This topic is 1861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've added some profiling calls to my renderer. Basically, it looks like this:

void CRenderer::beginTimeQuery()
{
#ifdef RENDERER_D3D9
eventQuery->Issue(D3DISSUE_END);
while (eventQuery->GetData(NULL, 0, D3DGETDATA_FLUSH) == S_FALSE);
QueryPerformanceCounter(&beginTime);
#elif RENDERER_D3D10
timestampDisjointQuery->Begin();
beginTimestampQuery->End();
#endif
}

double CRenderer::endTimeQuery()
{
#ifdef RENDERER_D3D9
eventQuery->Issue(D3DISSUE_END);
while (eventQuery->GetData(NULL, 0, D3DGETDATA_FLUSH) == S_FALSE);
QueryPerformanceCounter(&endTime);
return (double)(endTime.QuadPart - beginTime.QuadPart) / (double)timeFrequency.QuadPart;
#elif RENDERER_D3D10
endTimestampQuery->End();
timestampDisjointQuery->End();
uint64 beginTime, endTime;
D3D10_QUERY_DATA_TIMESTAMP_DISJOINT disjoint;
while (beginTimestampQuery->GetData(&beginTime, sizeof(uint64), 0) != S_OK);
while (endTimestampQuery->GetData(&endTime, sizeof(uint64), 0) != S_OK);
while (timestampDisjointQuery->GetData(&disjoint, sizeof(D3D10_QUERY_DATA_TIMESTAMP_DISJOINT), 0) != S_OK);
if (!disjoint.Disjoint)
return (double)(endTime - beginTime) / (double)disjoint.Frequency;
else
return -1.0;
#endif
}


Now, I render 2500 cubes, what gives me 230 FPS with both renderers. The problem is that the timings returned by endTimeQuery differ. For D3D9 it returns 0.003 and for D3D10 returns 0.0013. The rendering code does not do anything else and I wrapped the whole rendering loop inside the begin/end time block. So, where does this discrepancy could come from?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement