@@ -89,6 +89,9 @@ const int DEFAULT_BIT_DEPTH = 32;
8989const int DEFAULT_TEXTURE_BIT_DEPTH = 16 ;
9090const D3DMULTISAMPLE_TYPE DEFAULT_MSAA = D3DMULTISAMPLE_NONE;
9191
92+ DX8FrameStatistics DX8Wrapper::FrameStatistics;
93+ static DX8FrameStatistics LastFrameStatistics;
94+
9295bool DX8Wrapper_IsWindowed = true ;
9396
9497// FPU_PRESERVE
@@ -146,15 +149,6 @@ IDirect3DSurface8 * DX8Wrapper::DefaultRenderTarget = nullptr;
146149IDirect3DSurface8 * DX8Wrapper::DefaultDepthBuffer = nullptr ;
147150bool DX8Wrapper::IsRenderToTexture = false ;
148151
149- unsigned DX8Wrapper::matrix_changes = 0 ;
150- unsigned DX8Wrapper::material_changes = 0 ;
151- unsigned DX8Wrapper::vertex_buffer_changes = 0 ;
152- unsigned DX8Wrapper::index_buffer_changes = 0 ;
153- unsigned DX8Wrapper::light_changes = 0 ;
154- unsigned DX8Wrapper::texture_changes = 0 ;
155- unsigned DX8Wrapper::render_state_changes = 0 ;
156- unsigned DX8Wrapper::texture_stage_state_changes = 0 ;
157- unsigned DX8Wrapper::draw_calls = 0 ;
158152unsigned DX8Wrapper::_MainThreadID = 0 ;
159153bool DX8Wrapper::CurrentDX8LightEnables[4 ];
160154bool DX8Wrapper::IsDeviceLost;
@@ -175,18 +169,6 @@ unsigned long DX8Wrapper::FrameCount = 0;
175169
176170bool _DX8SingleThreaded = false ;
177171
178- unsigned number_of_DX8_calls = 0 ;
179- static unsigned last_frame_matrix_changes = 0 ;
180- static unsigned last_frame_material_changes = 0 ;
181- static unsigned last_frame_vertex_buffer_changes = 0 ;
182- static unsigned last_frame_index_buffer_changes = 0 ;
183- static unsigned last_frame_light_changes = 0 ;
184- static unsigned last_frame_texture_changes = 0 ;
185- static unsigned last_frame_render_state_changes = 0 ;
186- static unsigned last_frame_texture_stage_state_changes = 0 ;
187- static unsigned last_frame_number_of_DX8_calls = 0 ;
188- static unsigned last_frame_draw_calls = 0 ;
189-
190172static D3DPRESENT_PARAMETERS _PresentParameters;
191173static DynamicVectorClass<StringClass> _RenderDeviceNameTable;
192174static DynamicVectorClass<StringClass> _RenderDeviceShortNameTable;
@@ -1527,67 +1509,25 @@ bool DX8Wrapper::Test_Z_Mode(D3DFORMAT colorbuffer,D3DFORMAT backbuffer, D3DFORM
15271509
15281510void DX8Wrapper::Reset_Statistics ()
15291511{
1530- matrix_changes = 0 ;
1531- material_changes = 0 ;
1532- vertex_buffer_changes = 0 ;
1533- index_buffer_changes = 0 ;
1534- light_changes = 0 ;
1535- texture_changes = 0 ;
1536- render_state_changes =0 ;
1537- texture_stage_state_changes =0 ;
1538- draw_calls =0 ;
1539-
1540- number_of_DX8_calls = 0 ;
1541- last_frame_matrix_changes = 0 ;
1542- last_frame_material_changes = 0 ;
1543- last_frame_vertex_buffer_changes = 0 ;
1544- last_frame_index_buffer_changes = 0 ;
1545- last_frame_light_changes = 0 ;
1546- last_frame_texture_changes = 0 ;
1547- last_frame_render_state_changes = 0 ;
1548- last_frame_texture_stage_state_changes = 0 ;
1549- last_frame_number_of_DX8_calls = 0 ;
1550- last_frame_draw_calls =0 ;
1512+ FrameStatistics = DX8FrameStatistics ();
1513+ LastFrameStatistics = DX8FrameStatistics ();
15511514}
15521515
15531516void DX8Wrapper::Begin_Statistics ()
15541517{
1555- matrix_changes=0 ;
1556- material_changes=0 ;
1557- vertex_buffer_changes=0 ;
1558- index_buffer_changes=0 ;
1559- light_changes=0 ;
1560- texture_changes = 0 ;
1561- render_state_changes =0 ;
1562- texture_stage_state_changes =0 ;
1563- number_of_DX8_calls=0 ;
1564- draw_calls=0 ;
1518+ FrameStatistics = DX8FrameStatistics ();
15651519}
15661520
15671521void DX8Wrapper::End_Statistics ()
15681522{
1569- last_frame_matrix_changes=matrix_changes;
1570- last_frame_material_changes=material_changes;
1571- last_frame_vertex_buffer_changes=vertex_buffer_changes;
1572- last_frame_index_buffer_changes=index_buffer_changes;
1573- last_frame_light_changes=light_changes;
1574- last_frame_texture_changes = texture_changes;
1575- last_frame_render_state_changes = render_state_changes;
1576- last_frame_texture_stage_state_changes = texture_stage_state_changes;
1577- last_frame_number_of_DX8_calls=number_of_DX8_calls;
1578- last_frame_draw_calls=draw_calls;
1523+ LastFrameStatistics = FrameStatistics;
1524+ }
1525+
1526+ const DX8FrameStatistics& DX8Wrapper::Get_Last_Frame_Statistics ()
1527+ {
1528+ return LastFrameStatistics;
15791529}
15801530
1581- unsigned DX8Wrapper::Get_Last_Frame_Matrix_Changes () { return last_frame_matrix_changes; }
1582- unsigned DX8Wrapper::Get_Last_Frame_Material_Changes () { return last_frame_material_changes; }
1583- unsigned DX8Wrapper::Get_Last_Frame_Vertex_Buffer_Changes () { return last_frame_vertex_buffer_changes; }
1584- unsigned DX8Wrapper::Get_Last_Frame_Index_Buffer_Changes () { return last_frame_index_buffer_changes; }
1585- unsigned DX8Wrapper::Get_Last_Frame_Light_Changes () { return last_frame_light_changes; }
1586- unsigned DX8Wrapper::Get_Last_Frame_Texture_Changes () { return last_frame_texture_changes; }
1587- unsigned DX8Wrapper::Get_Last_Frame_Render_State_Changes () { return last_frame_render_state_changes; }
1588- unsigned DX8Wrapper::Get_Last_Frame_Texture_Stage_State_Changes () { return last_frame_texture_stage_state_changes; }
1589- unsigned DX8Wrapper::Get_Last_Frame_DX8_Calls () { return last_frame_number_of_DX8_calls; }
1590- unsigned DX8Wrapper::Get_Last_Frame_Draw_Calls () { return last_frame_draw_calls; }
15911531unsigned long DX8Wrapper::Get_FrameCount () {return FrameCount;}
15921532
15931533void DX8_Assert ()
@@ -1624,7 +1564,7 @@ void DX8Wrapper::End_Scene(bool flip_frames)
16241564 hr=_Get_D3D_Device8 ()->Present (nullptr , nullptr , nullptr , nullptr );
16251565 }
16261566
1627- number_of_DX8_calls++ ;
1567+ DX8_RECORD_DX8_CALLS () ;
16281568
16291569 if (SUCCEEDED (hr)) {
16301570#ifdef EXTENDED_STATS
@@ -2982,7 +2922,7 @@ DX8Wrapper::Create_Render_Target (int width, int height, WW3DFormat format)
29822922{
29832923 DX8_THREAD_ASSERT ();
29842924 DX8_Assert ();
2985- number_of_DX8_calls++ ;
2925+ DX8_RECORD_DX8_CALLS () ;
29862926
29872927 // Use the current display format if format isn't specified
29882928 if (format==WW3D_FORMAT_UNKNOWN) {
@@ -3048,7 +2988,7 @@ void DX8Wrapper::Create_Render_Target
30482988{
30492989 DX8_THREAD_ASSERT ();
30502990 DX8_Assert ();
3051- number_of_DX8_calls++ ;
2991+ DX8_RECORD_DX8_CALLS () ;
30522992
30532993 // Use the current display format if format isn't specified
30542994 if (format==WW3D_FORMAT_UNKNOWN)
@@ -3449,7 +3389,7 @@ void DX8Wrapper::Flush_DX8_Resource_Manager(unsigned int bytes)
34493389unsigned int DX8Wrapper::Get_Free_Texture_RAM ()
34503390{
34513391 DX8_Assert ();
3452- number_of_DX8_calls++ ;
3392+ DX8_RECORD_DX8_CALLS () ;
34533393 return DX8Wrapper::_Get_D3D_Device8 ()->GetAvailableTextureMem ();
34543394}
34553395
@@ -3465,7 +3405,7 @@ void DX8Wrapper::Set_Gamma(float gamma,float bright,float contrast,bool calibrat
34653405 float oo_gamma=1 .0f /gamma;
34663406
34673407 DX8_Assert ();
3468- number_of_DX8_calls++ ;
3408+ DX8_RECORD_DX8_CALLS () ;
34693409
34703410 DWORD flag=(calibrate?D3DSGR_CALIBRATE:D3DSGR_NO_CALIBRATION);
34713411
0 commit comments