Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
perf(ww3d2): log shadow, sort and icon time inside the scene
Olcay Seygan1245a2d0847e
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cppindex 3f5d95427..4f41b1ff5 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp@@ -1508,6 +1508,16 @@ extern Real TheTranslucentMS;extern UnsignedInt TheTranslucentDraws;extern UnsignedInt TheSortingPolygonsRefused;extern UnsignedInt TheParticlesPastGroupLimit;+extern Real TheShadowMapMS;+extern Int TheShadowMapCasters;+extern UnsignedInt TheShadowMapDraws;+extern Real ThePostChainMS;+extern Real TheIconDrawMS;+extern UnsignedInt TheSceneDrawCalls;+extern Real TheSortingSortMS;+extern Real TheSortingCopyMS;+extern Real TheSortingDrawMS;+extern UnsignedInt TheSortingEntries;/** Particle cost summed over an unattended run, per drawn frame, for HEADLESS PARTICLECOST. */struct ParticleCostTotals@@ -2352,6 +2362,12 @@ void GameEngine::update( void )static Real fpsRadarTotal = 0.0f, fpsAudioTotal = 0.0f, fpsDrawTotal = 0.0f, fpsDrawMax = 0.0f;static Real fpsSceneTotal = 0.0f, fpsUITotal = 0.0f, fpsPostTotal = 0.0f, fpsWinTotal = 0.0f;static Real fpsStripGatherTotal = 0.0f, fpsStripDrawTotal = 0.0f;+ static Real fpsShadowTotal = 0.0f, fpsFillTotal = 0.0f, fpsTranslucentTotal = 0.0f;+ static Real fpsPostChainTotal = 0.0f, fpsIconTotal = 0.0f;+ static Real fpsSortTotal = 0.0f, fpsCopyTotal = 0.0f, fpsSortDrawTotal = 0.0f;+ static Int fpsCasterTotal = 0;+ static UnsignedInt fpsShadowDrawTotal = 0, fpsSceneDrawTotal = 0, fpsTranslucentDrawTotal = 0;+ static UnsignedInt fpsSortEntryTotal = 0, fpsOnScreenTotal = 0;Int64 tClientStart, tClientEnd, tLogicStart, tLogicEnd, tRadarEnd, tAudioEnd;Real clientMS = 0.0f, logicMS = 0.0f, radarMS = 0.0f, audioMS = 0.0f;Int logicTicks = 0;@@ -2359,6 +2375,11 @@ void GameEngine::update( void )TheStripGatherMS = TheStripDrawMS = 0.0f;TheParticleUpdateMS = TheParticleFillMS = TheTranslucentMS = 0.0f;TheTranslucentDraws = TheSortingPolygonsRefused = TheParticlesPastGroupLimit = 0;+ TheShadowMapMS = ThePostChainMS = TheIconDrawMS = 0.0f;+ TheSortingSortMS = TheSortingCopyMS = TheSortingDrawMS = 0.0f;+ TheSortingEntries = 0;+ TheShadowMapCasters = 0;+ TheShadowMapDraws = TheSceneDrawCalls = 0;QueryPerformanceCounter( (LARGE_INTEGER *)&tClientStart );#endif@@ -2587,6 +2608,21 @@ void GameEngine::update( void )fpsWinTotal += TheWindowRepaintMS;fpsStripGatherTotal += TheStripGatherMS;fpsStripDrawTotal += TheStripDrawMS;+ fpsShadowTotal += TheShadowMapMS;+ fpsFillTotal += TheParticleFillMS;+ fpsTranslucentTotal += TheTranslucentMS;+ fpsPostChainTotal += ThePostChainMS;+ fpsIconTotal += TheIconDrawMS;+ fpsCasterTotal += TheShadowMapCasters;+ fpsShadowDrawTotal += TheShadowMapDraws;+ fpsSceneDrawTotal += TheSceneDrawCalls;+ fpsTranslucentDrawTotal += TheTranslucentDraws;+ fpsSortTotal += TheSortingSortMS;+ fpsCopyTotal += TheSortingCopyMS;+ fpsSortDrawTotal += TheSortingDrawMS;+ fpsSortEntryTotal += TheSortingEntries;+ if( TheParticleSystemManager )+ fpsOnScreenTotal += TheParticleSystemManager->getOnScreenParticleCount();if( theFrameTimesStarted && TheParticleSystemManager ){const UnsignedInt particles = TheParticleSystemManager->getParticleCount();@@ -2634,6 +2670,15 @@ void GameEngine::update( void )( fpsClientTotal - fpsDrawTotal - fpsRadarTotal - fpsAudioTotal ) / fpsFrames,fpsLogicTotal / fpsFrames, fpsLogicMax,(Real)windowMS - fpsClientTotal - fpsLogicTotal));+ DEBUG_LOG(("SCENE SPLIT frame %d: shadow %.1f ms, %d casters, %u shadow draws | fill %.1f translucent %.1f (%u draws) | sort %.1f copy %.1f draw %.1f (%u entries, %u on screen) | icons %.1f | postchain %.1f | scene draws %u\n",+ TheGameLogic->getFrame(),+ fpsShadowTotal / fpsFrames, fpsCasterTotal / fpsFrames, fpsShadowDrawTotal / fpsFrames,+ fpsFillTotal / fpsFrames, fpsTranslucentTotal / fpsFrames,+ fpsTranslucentDrawTotal / fpsFrames,+ fpsSortTotal / fpsFrames, fpsCopyTotal / fpsFrames, fpsSortDrawTotal / fpsFrames,+ fpsSortEntryTotal / fpsFrames, fpsOnScreenTotal / fpsFrames,+ fpsIconTotal / fpsFrames, fpsPostChainTotal / fpsFrames,+ fpsSceneDrawTotal / fpsFrames));}fpsFrames = 0;fpsLogicTicks = fpsCatchupPasses = 0;@@ -2641,6 +2686,12 @@ void GameEngine::update( void )fpsRadarTotal = fpsAudioTotal = fpsDrawTotal = fpsDrawMax = 0.0f;fpsSceneTotal = fpsUITotal = fpsPostTotal = fpsWinTotal = 0.0f;fpsStripGatherTotal = fpsStripDrawTotal = 0.0f;+ fpsShadowTotal = fpsFillTotal = fpsTranslucentTotal = 0.0f;+ fpsPostChainTotal = fpsIconTotal = 0.0f;+ fpsSortTotal = fpsCopyTotal = fpsSortDrawTotal = 0.0f;+ fpsCasterTotal = 0;+ fpsShadowDrawTotal = fpsSceneDrawTotal = fpsTranslucentDrawTotal = 0;+ fpsSortEntryTotal = fpsOnScreenTotal = 0;fpsClientMax = fpsLogicMax = 0.0f;fpsWindowStart = nowMS;}diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cppindex 6b53995af..de7442ef2 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp@@ -133,6 +133,26 @@ Real TheTranslucentMS = 0.0f; ///< DoParticles() and SortingRendererClass::FUnsignedInt TheTranslucentDraws = 0; ///< draw calls made by the fill and the flushUnsignedInt TheSortingPolygonsRefused = 0; ///< polygons the sorting pool had no room for, so never drawnUnsignedInt TheParticlesPastGroupLimit = 0; ///< on-screen particles doParticles cut at MAX_POINTS_PER_GROUP a system+//+// The scene number above is still four different jobs. The sun's depth pass draws every caster a+// second time, the post chain runs before the health bars, and the bars themselves walk every+// drawable in view. A slow second that only says "scene" cannot tell those apart.+//+Real TheShadowMapMS = 0.0f; ///< W3DVolumetricShadowManager::renderShadowMap()+Int TheShadowMapCasters = 0; ///< casters that pass submitted+UnsignedInt TheShadowMapDraws = 0; ///< draw calls that pass made+Real ThePostChainMS = 0.0f; ///< Direct3D11_Finish_Scene(), inside the scene timer+Real TheIconDrawMS = 0.0f; ///< health bars and the other drawable icons+UnsignedInt TheSceneDrawCalls = 0; ///< DX8Wrapper draws from Begin_Render through drawViews+//+// The translucent number is still three jobs that fail for different reasons: sorting every+// see-through polygon, copying the sorted vertices into a dynamic buffer, and handing the runs+// to the device. The copy is where a buffer lock waits.+//+Real TheSortingSortMS = 0.0f;+Real TheSortingCopyMS = 0.0f;+Real TheSortingDrawMS = 0.0f;+UnsignedInt TheSortingEntries = 0; ///< triangles and quads the flushes sorted#endif//-------------------------------------------------------------------------------------------------diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cppindex d2ac3638e..1c47e2660 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp@@ -3835,6 +3835,17 @@ void W3DVolumetricShadowManager::renderShadowMap( CameraClass &sceneCamera )if (!Direct3D11_Begin_Shadow_Map( SHADOW_MAP_TEXELS ))return; //no Direct3D 11 device, or it refused the surface: the volumes keep the frame+#ifdef DEBUG_LOGGING+ // The scene timer includes this pass and cannot say so.+ extern Real TheShadowMapMS;+ extern Int TheShadowMapCasters;+ extern UnsignedInt TheShadowMapDraws;+ Int castersCounted = 0;+ Int64 tShadowStart;+ const unsigned shadowDrawsBefore = DX8Wrapper::Get_Draw_Calls();+ QueryPerformanceCounter( (LARGE_INTEGER *)&tShadowStart );+#endif+Coord3D look;TheTacticalView->getPosition( &look );const Vector3 focus( look.x, look.y, TheTerrainLogic->getGroundHeight( look.x, look.y ) );@@ -3887,7 +3898,9 @@ void W3DVolumetricShadowManager::renderShadowMap( CameraClass &sceneCamera )DX8Wrapper::Set_DX8_Render_State( D3DRS_CULLMODE, D3DCULL_CW );RenderInfoClass sunInfo( sun );- Int casters = 0;+#ifndef DEBUG_LOGGING+ Int castersCounted = 0;+#endiffor (W3DVolumetricShadow *shadow = m_shadowList; shadow; shadow = shadow->m_next){RenderObjClass *robj = shadow->getRenderObject();@@ -3905,7 +3918,7 @@ void W3DVolumetricShadowManager::renderShadowMap( CameraClass &sceneCamera )continue;robj->Render( sunInfo );- ++casters;+ ++castersCounted;}TheDX8MeshRenderer.Flush();/* A mesh the material system calls translucent goes to the sort lists rather than to the mesh@@ -3962,17 +3975,29 @@ void W3DVolumetricShadowManager::renderShadowMap( CameraClass &sceneCamera )shadows changed style and back again as the camera moved. */theShadowMapHoldsTheFrame = TRUE;+#ifdef DEBUG_LOGGING+ {+ Int64 tShadowEnd, freq;+ QueryPerformanceCounter( (LARGE_INTEGER *)&tShadowEnd );+ QueryPerformanceFrequency( (LARGE_INTEGER *)&freq );+ if( freq > 0 )+ TheShadowMapMS += (Real)((double)(tShadowEnd - tShadowStart) * 1000.0 / (double)freq);+ TheShadowMapCasters += castersCounted;+ TheShadowMapDraws += DX8Wrapper::Get_Draw_Calls() - shadowDrawsBefore;+ }+#endif+// The report costs a full stall of the pipeline, so it is one line a second rather than one a// frame: what it answers is whether the pass draws the world at all, and that does not change// thirty times a second.- if (TheGlobalData->m_shadowMapReport && casters > 0)+ if (TheGlobalData->m_shadowMapReport && castersCounted > 0){static UnsignedInt nextReportFrame = 0;const UnsignedInt frame = TheGameLogic ? TheGameLogic->getFrame() : 0;if (frame >= nextReportFrame){nextReportFrame = frame + LOGICFRAMES_PER_SECOND;- DEBUG_LOG(("SHADOWMAP: %d casters, %s\n", casters,+ DEBUG_LOG(("SHADOWMAP: %d casters, %s\n", castersCounted,Direct3D11_Shadow_Map_Report().c_str()));}}diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cppindex 96afb17e4..bb8191e61 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp@@ -2038,6 +2038,7 @@ static void captureVideoFrame(void);extern Real TheSceneDrawMS;extern Real TheUIDrawMS;extern Real TheParticleUpdateMS;+extern UnsignedInt TheSceneDrawCalls;static Real w3dElapsedMS( const Int64 &from, const Int64 &to ){@@ -2379,6 +2380,7 @@ AGAIN:QueryPerformanceCounter( (LARGE_INTEGER *)&tUIEnd );TheSceneDrawMS = w3dElapsedMS( tSceneStart, tSceneEnd );TheUIDrawMS = w3dElapsedMS( tSceneEnd, tUIEnd );+ TheSceneDrawCalls = DX8Wrapper::Get_Draw_Calls();#endif// end of video example codediff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cppindex 61d43b383..b4aeec9cd 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp@@ -863,6 +863,10 @@ DECLARE_PERF_TIMER(translucentRender)extern Real TheTranslucentMS;extern UnsignedInt TheTranslucentDraws;extern UnsignedInt TheSortingPolygonsRefused;+extern Real TheSortingSortMS;+extern Real TheSortingCopyMS;+extern Real TheSortingDrawMS;+extern UnsignedInt TheSortingEntries;static Real sceneElapsedMS( const Int64 &from, const Int64 &to ){@@ -913,6 +917,7 @@ void RTS3DScene::Flush(RenderInfoClass & rinfo)Int64 tTranslucentStart, tTranslucentEnd;const unsigned drawsBefore = DX8Wrapper::Get_Draw_Calls();const unsigned refusedBefore = SortingRendererClass::Get_Refused_Polygon_Count();+ SortingRendererClass::Reset_Flush_Profile();QueryPerformanceCounter( (LARGE_INTEGER *)&tTranslucentStart );#endif@@ -926,6 +931,15 @@ void RTS3DScene::Flush(RenderInfoClass & rinfo)TheTranslucentMS += sceneElapsedMS( tTranslucentStart, tTranslucentEnd );TheTranslucentDraws += DX8Wrapper::Get_Draw_Calls() - drawsBefore;TheSortingPolygonsRefused += SortingRendererClass::Get_Refused_Polygon_Count() - refusedBefore;+ {+ unsigned entries = 0;+ float sortMS = 0.0f, copyMS = 0.0f, drawMS = 0.0f;+ SortingRendererClass::Get_Flush_Profile( entries, sortMS, copyMS, drawMS );+ TheSortingEntries += entries;+ TheSortingSortMS += sortMS;+ TheSortingCopyMS += copyMS;+ TheSortingDrawMS += drawMS;+ }#endif}TheDX8MeshRenderer.Clear_Pending_Delete_Lists();diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cppindex 82ec55328..ea0766462 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp@@ -1979,6 +1979,20 @@ void W3DView::drawView( void )}DECLARE_PERF_TIMER(W3DView_drawView)++#ifdef DEBUG_LOGGING+extern Real ThePostChainMS;+extern Real TheIconDrawMS;+static Real viewElapsedMS( const Int64 &from, const Int64 &to )+{+ Int64 freq;+ QueryPerformanceFrequency( (LARGE_INTEGER *)&freq );+ if( freq < 1 )+ return 0.0f;+ return (Real)((double)(to - from) * 1000.0 / (double)freq);+}+#endif+void W3DView::draw( void ){USE_PERF_TIMER(W3DView_drawView)@@ -2322,12 +2336,27 @@ void W3DView::draw( void )// the command bar first, where it was doubling the strokes of the font.//// Nothing happens here unless a chain was asked for, and only the first view of a frame runs it.+#ifdef DEBUG_LOGGING+ Int64 tPostChainStart, tPostChainEnd, tIconStart, tIconEnd;+ QueryPerformanceCounter( (LARGE_INTEGER *)&tPostChainStart );+#endifDirect3D11_Finish_Scene();+#ifdef DEBUG_LOGGING+ QueryPerformanceCounter( (LARGE_INTEGER *)&tPostChainEnd );+ ThePostChainMS = viewElapsedMS( tPostChainStart, tPostChainEnd );+#endifTheGameClient->resetRenderedObjectCount();// the post draw is where health bars are drawn, and each one records where it landedTheGameClient->clearHealthBarPickRegions();+#ifdef DEBUG_LOGGING+ QueryPerformanceCounter( (LARGE_INTEGER *)&tIconStart );+#endifTheGameClient->iterateDrawablesInRegion( &axisAlignedRegion, drawablePostDraw, this );+#ifdef DEBUG_LOGGING+ QueryPerformanceCounter( (LARGE_INTEGER *)&tIconEnd );+ TheIconDrawMS = viewElapsedMS( tIconStart, tIconEnd );+#endifTheGameClient->flushTextBearingDrawables();diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cppindex 355e82ff0..0d7f720a5 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp@@ -381,6 +381,37 @@ unsigned SortingRendererClass::Get_Refused_Polygon_Count()return refused_polygon_count;}+static unsigned flush_profile_entries;+static float flush_profile_sort_ms;+static float flush_profile_copy_ms;+static float flush_profile_draw_ms;++static float flushProfileElapsedMS(__int64 from, __int64 to)+{+ static __int64 freq = 0;+ if (freq == 0)+ QueryPerformanceFrequency((LARGE_INTEGER *)&freq);+ if (freq < 1)+ return 0.0f;+ return (float)((double)(to - from) * 1000.0 / (double)freq);+}++void SortingRendererClass::Reset_Flush_Profile()+{+ flush_profile_entries = 0;+ flush_profile_sort_ms = 0.0f;+ flush_profile_copy_ms = 0.0f;+ flush_profile_draw_ms = 0.0f;+}++void SortingRendererClass::Get_Flush_Profile(unsigned &entries, float &sort_ms, float ©_ms, float &draw_ms)+{+ entries = flush_profile_entries;+ sort_ms = flush_profile_sort_ms;+ copy_ms = flush_profile_copy_ms;+ draw_ms = flush_profile_draw_ms;+}+static SortingRendererClass::ParallelForFunc parallel_for_hook=NULL;void SortingRendererClass::Set_Parallel_For(ParallelForFunc parallel_for)@@ -613,6 +644,9 @@ static void Flush_Sorting_Batch(const TempIndexStruct* entries,unsigned entry_cojob.indices=NULL;const int chunks=(int)((entry_count+ENTRIES_PER_COPY_CHUNK-1)/ENTRIES_PER_COPY_CHUNK);+ __int64 tCopyStart, tCopyEnd, tDrawEnd;+ QueryPerformanceCounter((LARGE_INTEGER *)&tCopyStart);+DynamicVBAccessClass dyn_vb_access(BUFFER_TYPE_DYNAMIC_DX8,dynamic_fvf_type,(unsigned short)vertex_count);{DynamicVBAccessClass::WriteLockClass lock(&dyn_vb_access);@@ -640,6 +674,9 @@ static void Flush_Sorting_Batch(const TempIndexStruct* entries,unsigned entry_coDX8Wrapper::Set_Index_Buffer(dyn_ib_access,0); // Override with this buffer (do something to prevent need for this!)DX8Wrapper::Set_Vertex_Buffer(dyn_vb_access); // Override with this buffer (do something to prevent need for this!)+ QueryPerformanceCounter((LARGE_INTEGER *)&tCopyEnd);+ flush_profile_copy_ms += flushProfileElapsedMS(tCopyStart, tCopyEnd);+DX8Wrapper::Apply_Render_State_Changes();unsigned run_first_index=0;@@ -669,6 +706,9 @@ static void Flush_Sorting_Batch(const TempIndexStruct* entries,unsigned entry_coApply_Render_State(overlapping_nodes[node_id]->sorting_state);DX8Wrapper::Draw_Triangles(run_first_index,run_triangles,run_first_vertex,vertex_cursor-run_first_vertex);++ QueryPerformanceCounter((LARGE_INTEGER *)&tDrawEnd);+ flush_profile_draw_ms += flushProfileElapsedMS(tCopyEnd, tDrawEnd);}// ----------------------------------------------------------------------------@@ -687,6 +727,10 @@ void SortingRendererClass::Flush_Sorting_Pool()SNAPSHOT_SAY(("SortingSystem - Flush \n"));+ flush_profile_entries += overlapping_entry_count;+ __int64 tSortStart, tSortEnd;+ QueryPerformanceCounter((LARGE_INTEGER *)&tSortStart);+TempIndexStruct* tis=Get_Temp_Index_Array(overlapping_entry_count);// Every entry's depth, with its indices kept relative to its own node's first vertex. Each node@@ -798,6 +842,9 @@ void SortingRendererClass::Flush_Sorting_Pool()const TempIndexStruct* sorted=Sort_By_Depth(tis,temp_sort_scratch_array,overlapping_entry_count);+ QueryPerformanceCounter((LARGE_INTEGER *)&tSortEnd);+ flush_profile_sort_ms += flushProfileElapsedMS(tSortStart, tSortEnd);+unsigned batch_start=0;while (batch_start<overlapping_entry_count) {unsigned batch_end=batch_start;diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.hindex 04159b652..e4b120eeb 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.h+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.h@@ -73,6 +73,11 @@ public:/// Polygons refused since the start because the pool's node list was full; they are not drawn.static unsigned Get_Refused_Polygon_Count();+ /// Phases of every flush since the reset. Depth and the radix are sort, filling the dynamic+ /// buffers is copy, and Draw_Triangles is draw. A frame flushes more than once.+ static void Reset_Flush_Profile();+ static void Get_Flush_Profile(unsigned &entries, float &sort_ms, float ©_ms, float &draw_ms);+/// Where the flush can hand work to more threads: work(0..count-1, context), returning once all of/// it is done. WW3D2 cannot see the game's job pool, so the device layer installs one; without it/// the work runs inline. The work never allocates and never touches the device.