@@ -93,6 +93,9 @@ const int DEFAULT_BIT_DEPTH = 32;
9393const int DEFAULT_TEXTURE_BIT_DEPTH = 16 ;
9494const D3DMULTISAMPLE_TYPE DEFAULT_MSAA = D3DMULTISAMPLE_NONE;
9595
96+ DX8FrameStatistics DX8Wrapper::FrameStatistics = { 0 };
97+ static DX8FrameStatistics LastFrameStatistics = { 0 };
98+
9699bool DX8Wrapper_IsWindowed = true ;
97100
98101// FPU_PRESERVE
@@ -155,15 +158,6 @@ IDirect3DSurface8 * DX8Wrapper::DefaultRenderTarget = nullptr;
155158IDirect3DSurface8 * DX8Wrapper::DefaultDepthBuffer = nullptr ;
156159bool DX8Wrapper::IsRenderToTexture = false ;
157160
158- unsigned DX8Wrapper::matrix_changes = 0 ;
159- unsigned DX8Wrapper::material_changes = 0 ;
160- unsigned DX8Wrapper::vertex_buffer_changes = 0 ;
161- unsigned DX8Wrapper::index_buffer_changes = 0 ;
162- unsigned DX8Wrapper::light_changes = 0 ;
163- unsigned DX8Wrapper::texture_changes = 0 ;
164- unsigned DX8Wrapper::render_state_changes = 0 ;
165- unsigned DX8Wrapper::texture_stage_state_changes = 0 ;
166- unsigned DX8Wrapper::draw_calls = 0 ;
167161unsigned DX8Wrapper::_MainThreadID = 0 ;
168162bool DX8Wrapper::CurrentDX8LightEnables[4 ];
169163bool DX8Wrapper::IsDeviceLost;
@@ -183,18 +177,7 @@ D3DADAPTER_IDENTIFIER8 DX8Wrapper::CurrentAdapterIdentifier;
183177unsigned long DX8Wrapper::FrameCount = 0 ;
184178
185179bool _DX8SingleThreaded = false ;
186-
187180unsigned number_of_DX8_calls = 0 ;
188- static unsigned last_frame_matrix_changes = 0 ;
189- static unsigned last_frame_material_changes = 0 ;
190- static unsigned last_frame_vertex_buffer_changes = 0 ;
191- static unsigned last_frame_index_buffer_changes = 0 ;
192- static unsigned last_frame_light_changes = 0 ;
193- static unsigned last_frame_texture_changes = 0 ;
194- static unsigned last_frame_render_state_changes = 0 ;
195- static unsigned last_frame_texture_stage_state_changes = 0 ;
196- static unsigned last_frame_number_of_DX8_calls = 0 ;
197- static unsigned last_frame_draw_calls = 0 ;
198181
199182static D3DDISPLAYMODE DesktopMode;
200183
@@ -1676,71 +1659,26 @@ bool DX8Wrapper::Test_Z_Mode(D3DFORMAT colorbuffer,D3DFORMAT backbuffer, D3DFORM
16761659
16771660void DX8Wrapper::Reset_Statistics ()
16781661{
1679- matrix_changes = 0 ;
1680- material_changes = 0 ;
1681- vertex_buffer_changes = 0 ;
1682- index_buffer_changes = 0 ;
1683- light_changes = 0 ;
1684- texture_changes = 0 ;
1685- render_state_changes =0 ;
1686- texture_stage_state_changes =0 ;
1687- draw_calls =0 ;
1688-
1689- number_of_DX8_calls = 0 ;
1690- last_frame_matrix_changes = 0 ;
1691- last_frame_material_changes = 0 ;
1692- last_frame_vertex_buffer_changes = 0 ;
1693- last_frame_index_buffer_changes = 0 ;
1694- last_frame_light_changes = 0 ;
1695- last_frame_texture_changes = 0 ;
1696- last_frame_render_state_changes = 0 ;
1697- last_frame_texture_stage_state_changes = 0 ;
1698- last_frame_number_of_DX8_calls = 0 ;
1699- last_frame_draw_calls =0 ;
1662+ memset (&FrameStatistics, 0 , sizeof (FrameStatistics));
1663+ memset (&LastFrameStatistics, 0 , sizeof (FrameStatistics));
1664+ number_of_DX8_calls=0 ;
17001665}
17011666
17021667void DX8Wrapper::Begin_Statistics ()
17031668{
1704- matrix_changes=0 ;
1705- material_changes=0 ;
1706- vertex_buffer_changes=0 ;
1707- index_buffer_changes=0 ;
1708- light_changes=0 ;
1709- texture_changes = 0 ;
1710- render_state_changes =0 ;
1711- texture_stage_state_changes =0 ;
1669+ memset (&FrameStatistics, 0 , sizeof (FrameStatistics));
17121670 number_of_DX8_calls=0 ;
1713- draw_calls=0 ;
17141671}
17151672
17161673void DX8Wrapper::End_Statistics ()
17171674{
1718- last_frame_matrix_changes=matrix_changes;
1719- last_frame_material_changes=material_changes;
1720- last_frame_vertex_buffer_changes=vertex_buffer_changes;
1721- last_frame_index_buffer_changes=index_buffer_changes;
1722- last_frame_light_changes=light_changes;
1723- last_frame_texture_changes = texture_changes;
1724- last_frame_render_state_changes = render_state_changes;
1725- last_frame_texture_stage_state_changes = texture_stage_state_changes;
1726- last_frame_number_of_DX8_calls=number_of_DX8_calls;
1727- last_frame_draw_calls=draw_calls;
1675+ LastFrameStatistics = FrameStatistics;
1676+ LastFrameStatistics.dx8_calls = number_of_DX8_calls;
17281677}
17291678
1730- DX8FrameStatistics DX8Wrapper::Get_Last_Frame_Statistics ()
1679+ const DX8FrameStatistics& DX8Wrapper::Get_Last_Frame_Statistics ()
17311680{
1732- DX8FrameStatistics stats;
1733- stats.matrix_changes = last_frame_matrix_changes;
1734- stats.material_changes = last_frame_material_changes;
1735- stats.vertex_buffer_changes = last_frame_vertex_buffer_changes;
1736- stats.index_buffer_changes = last_frame_index_buffer_changes;
1737- stats.light_changes = last_frame_light_changes;
1738- stats.texture_changes = last_frame_texture_changes;
1739- stats.render_state_changes = last_frame_render_state_changes;
1740- stats.texture_stage_state_changes = last_frame_texture_stage_state_changes;
1741- stats.dx8_calls = last_frame_number_of_DX8_calls;
1742- stats.draw_calls = last_frame_draw_calls;
1743- return stats;
1681+ return LastFrameStatistics;
17441682}
17451683
17461684unsigned long DX8Wrapper::Get_FrameCount () {return FrameCount;}
0 commit comments