Original Post
Im trying to profile CPU state changes time. Here is what i do first time (based on DirectX article - Accurately Profiling Direct3D API Calls): g_pd3dDevice->CreateQuery(D3DQUERYTYPE_EVENT, &pEvent); pEvent->Issue(D3DISSUE_END); while(S_FALSE == pEvent->GetData( NULL, 0, D3DGETDATA_FLUSH )) ; // Now start counting because the video card is ready QueryPerformanceCounter(&start); for( DWORD ii=0; ii<10000; ii++ ) { g_pd3dDevice->SetStreamSource(0, g_pVB[ii%2], 0, sizeof(VERTEX)); //g_pd3dDevice->SetIndices(g_pIB[ii%2]); //g_pd3dDevice->SetTexture(0, g_pMeshTextures[ii%2]); //g_pd3dDevice->SetTransform( D3DTS_WORLD, &g_pWorld[ii%2] ); // draw only one triangle out of view frustrum to minimize GPU work g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, g_pMesh[ii]->GetNumVertices(), 0 , 1); batches++; } pEvent->Issue(D3DISSUE_END); while(S_FALSE == pEvent->GetData( NULL, 0, D3DGETDATA_FLUSH )) ; QueryPerformanceCounter(&stop); float numTicksPerCall = (float)(stop.QuadPart - start.QuadPart) / batches; nummcs = 1000000.0f * numTicksPerCall / freqCounter.QuadPart; For example, i got 0.7 microseconds per batch on SetStreamSource+DrawIndexedPrimitive on Core2Duo 2Ghz But when use more streams, i get more time! For example on 3000 streams (g_pVB[ii%3000]) i got 1.7 microseconds per batch! I dont understand the reazon why it happens. Same occurs with switches indexes and textures (for SetTransform it remains unchanged ~1.3 mks) More streams, more time on switches! At first i thought it depends from buffer content. But when i load same data in buffers, nothing was changed! And now im frustraded a bit. Maybe i did wrong something? I missed something? Why it happened?