From a99c7d01e1b043df9c09a3047bf0442f88ad94d3 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 10 Jul 2019 23:11:14 -0400 Subject: VideoCommon/Statistics: Normalize statistic variable names Normalizes all variables related to statistics so that they follow our coding style. These are relatively low traffic areas, so this modification isn't too noisy. --- Source/Core/VideoCommon/Statistics.cpp | 80 +++++++++++++++++----------------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'Source/Core/VideoCommon/Statistics.cpp') diff --git a/Source/Core/VideoCommon/Statistics.cpp b/Source/Core/VideoCommon/Statistics.cpp index b3a7b9f470..98a34eec46 100644 --- a/Source/Core/VideoCommon/Statistics.cpp +++ b/Source/Core/VideoCommon/Statistics.cpp @@ -14,15 +14,15 @@ Statistics stats; void Statistics::ResetFrame() { - thisFrame = {}; + this_frame = {}; } void Statistics::SwapDL() { - std::swap(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims); - std::swap(stats.thisFrame.numXFLoadsInDL, stats.thisFrame.numXFLoads); - std::swap(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads); - std::swap(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads); + std::swap(stats.this_frame.num_dl_prims, stats.this_frame.num_prims); + std::swap(stats.this_frame.num_xf_loads_in_dl, stats.this_frame.num_xf_loads); + std::swap(stats.this_frame.num_cp_loads_in_dl, stats.this_frame.num_cp_loads); + std::swap(stats.this_frame.num_bp_loads_in_dl, stats.this_frame.num_bp_loads); } void Statistics::Display() @@ -48,43 +48,43 @@ void Statistics::Display() if (g_ActiveConfig.backend_info.api_type == APIType::Nothing) { - draw_statistic("Objects", "%d", stats.thisFrame.numDrawnObjects); - draw_statistic("Vertices Loaded", "%d", stats.thisFrame.numVerticesLoaded); - draw_statistic("Triangles Input", "%d", stats.thisFrame.numTrianglesIn); - draw_statistic("Triangles Rejected", "%d", stats.thisFrame.numTrianglesRejected); - draw_statistic("Triangles Culled", "%d", stats.thisFrame.numTrianglesCulled); - draw_statistic("Triangles Clipped", "%d", stats.thisFrame.numTrianglesClipped); - draw_statistic("Triangles Drawn", "%d", stats.thisFrame.numTrianglesDrawn); - draw_statistic("Rasterized Pix", "%d", stats.thisFrame.rasterizedPixels); - draw_statistic("TEV Pix In", "%d", stats.thisFrame.tevPixelsIn); - draw_statistic("TEV Pix Out", "%d", stats.thisFrame.tevPixelsOut); + draw_statistic("Objects", "%d", stats.this_frame.num_drawn_objects); + draw_statistic("Vertices Loaded", "%d", stats.this_frame.num_vertices_loaded); + draw_statistic("Triangles Input", "%d", stats.this_frame.num_triangles_in); + draw_statistic("Triangles Rejected", "%d", stats.this_frame.num_triangles_rejected); + draw_statistic("Triangles Culled", "%d", stats.this_frame.num_triangles_culled); + draw_statistic("Triangles Clipped", "%d", stats.this_frame.num_triangles_clipped); + draw_statistic("Triangles Drawn", "%d", stats.this_frame.num_triangles_drawn); + draw_statistic("Rasterized Pix", "%d", stats.this_frame.rasterized_pixels); + draw_statistic("TEV Pix In", "%d", stats.this_frame.tev_pixels_in); + draw_statistic("TEV Pix Out", "%d", stats.this_frame.tev_pixels_out); } - draw_statistic("Textures created", "%d", stats.numTexturesCreated); - draw_statistic("Textures uploaded", "%d", stats.numTexturesUploaded); - draw_statistic("Textures alive", "%d", stats.numTexturesAlive); - draw_statistic("pshaders created", "%d", stats.numPixelShadersCreated); - draw_statistic("pshaders alive", "%d", stats.numPixelShadersAlive); - draw_statistic("vshaders created", "%d", stats.numVertexShadersCreated); - draw_statistic("vshaders alive", "%d", stats.numVertexShadersAlive); - draw_statistic("shaders changes", "%d", stats.thisFrame.numShaderChanges); - draw_statistic("dlists called", "%d", stats.thisFrame.numDListsCalled); - draw_statistic("Primitive joins", "%d", stats.thisFrame.numPrimitiveJoins); - draw_statistic("Draw calls", "%d", stats.thisFrame.numDrawCalls); - draw_statistic("Primitives", "%d", stats.thisFrame.numPrims); - draw_statistic("Primitives (DL)", "%d", stats.thisFrame.numDLPrims); - draw_statistic("XF loads", "%d", stats.thisFrame.numXFLoads); - draw_statistic("XF loads (DL)", "%d", stats.thisFrame.numXFLoadsInDL); - draw_statistic("CP loads", "%d", stats.thisFrame.numCPLoads); - draw_statistic("CP loads (DL)", "%d", stats.thisFrame.numCPLoadsInDL); - draw_statistic("BP loads", "%d", stats.thisFrame.numBPLoads); - draw_statistic("BP loads (DL)", "%d", stats.thisFrame.numBPLoadsInDL); - draw_statistic("Vertex streamed", "%i kB", stats.thisFrame.bytesVertexStreamed / 1024); - draw_statistic("Index streamed", "%i kB", stats.thisFrame.bytesIndexStreamed / 1024); - draw_statistic("Uniform streamed", "%i kB", stats.thisFrame.bytesUniformStreamed / 1024); - draw_statistic("Vertex Loaders", "%d", stats.numVertexLoaders); - draw_statistic("EFB peeks:", "%d", stats.thisFrame.numEFBPeeks); - draw_statistic("EFB pokes:", "%d", stats.thisFrame.numEFBPokes); + draw_statistic("Textures created", "%d", stats.num_textures_created); + draw_statistic("Textures uploaded", "%d", stats.num_textures_uploaded); + draw_statistic("Textures alive", "%d", stats.num_textures_alive); + draw_statistic("pshaders created", "%d", stats.num_pixel_shaders_created); + draw_statistic("pshaders alive", "%d", stats.num_pixel_shaders_alive); + draw_statistic("vshaders created", "%d", stats.num_vertex_shaders_created); + draw_statistic("vshaders alive", "%d", stats.num_vertex_shaders_alive); + draw_statistic("shaders changes", "%d", stats.this_frame.num_shader_changes); + draw_statistic("dlists called", "%d", stats.this_frame.num_dlists_called); + draw_statistic("Primitive joins", "%d", stats.this_frame.num_primitive_joins); + draw_statistic("Draw calls", "%d", stats.this_frame.num_draw_calls); + draw_statistic("Primitives", "%d", stats.this_frame.num_prims); + draw_statistic("Primitives (DL)", "%d", stats.this_frame.num_dl_prims); + draw_statistic("XF loads", "%d", stats.this_frame.num_xf_loads); + draw_statistic("XF loads (DL)", "%d", stats.this_frame.num_xf_loads_in_dl); + draw_statistic("CP loads", "%d", stats.this_frame.num_cp_loads); + draw_statistic("CP loads (DL)", "%d", stats.this_frame.num_cp_loads_in_dl); + draw_statistic("BP loads", "%d", stats.this_frame.num_bp_loads); + draw_statistic("BP loads (DL)", "%d", stats.this_frame.num_bp_loads_in_dl); + draw_statistic("Vertex streamed", "%i kB", stats.this_frame.bytes_vertex_streamed / 1024); + draw_statistic("Index streamed", "%i kB", stats.this_frame.bytes_index_streamed / 1024); + draw_statistic("Uniform streamed", "%i kB", stats.this_frame.bytes_uniform_streamed / 1024); + draw_statistic("Vertex Loaders", "%d", stats.num_vertex_loaders); + draw_statistic("EFB peeks:", "%d", stats.this_frame.num_efb_peeks); + draw_statistic("EFB pokes:", "%d", stats.this_frame.num_efb_pokes); ImGui::Columns(1); -- cgit v1.2.3 From 9802a5e16b5860d1c6b42beeb1b8ca883467e1b1 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 10 Jul 2019 23:24:35 -0400 Subject: VideoCommon/Statistics: Make all member functions non-static Rather than making Statistics' member functions operate on the global variable instance of itself, we can make these functions member functions and operate on a by-instance state, removing the direct dependency on the global variable itself. This also makes for less reading, as there's no need to repeat "stats." for all variable accesses. --- Source/Core/VideoCommon/Statistics.cpp | 114 ++++++++++++++++----------------- 1 file changed, 57 insertions(+), 57 deletions(-) (limited to 'Source/Core/VideoCommon/Statistics.cpp') diff --git a/Source/Core/VideoCommon/Statistics.cpp b/Source/Core/VideoCommon/Statistics.cpp index 98a34eec46..081e20353c 100644 --- a/Source/Core/VideoCommon/Statistics.cpp +++ b/Source/Core/VideoCommon/Statistics.cpp @@ -19,13 +19,13 @@ void Statistics::ResetFrame() void Statistics::SwapDL() { - std::swap(stats.this_frame.num_dl_prims, stats.this_frame.num_prims); - std::swap(stats.this_frame.num_xf_loads_in_dl, stats.this_frame.num_xf_loads); - std::swap(stats.this_frame.num_cp_loads_in_dl, stats.this_frame.num_cp_loads); - std::swap(stats.this_frame.num_bp_loads_in_dl, stats.this_frame.num_bp_loads); + std::swap(this_frame.num_dl_prims, this_frame.num_prims); + std::swap(this_frame.num_xf_loads_in_dl, this_frame.num_xf_loads); + std::swap(this_frame.num_cp_loads_in_dl, this_frame.num_cp_loads); + std::swap(this_frame.num_bp_loads_in_dl, this_frame.num_bp_loads); } -void Statistics::Display() +void Statistics::Display() const { const float scale = ImGui::GetIO().DisplayFramebufferScale.x; ImGui::SetNextWindowPos(ImVec2(10.0f * scale, 10.0f * scale), ImGuiCond_FirstUseEver); @@ -48,43 +48,43 @@ void Statistics::Display() if (g_ActiveConfig.backend_info.api_type == APIType::Nothing) { - draw_statistic("Objects", "%d", stats.this_frame.num_drawn_objects); - draw_statistic("Vertices Loaded", "%d", stats.this_frame.num_vertices_loaded); - draw_statistic("Triangles Input", "%d", stats.this_frame.num_triangles_in); - draw_statistic("Triangles Rejected", "%d", stats.this_frame.num_triangles_rejected); - draw_statistic("Triangles Culled", "%d", stats.this_frame.num_triangles_culled); - draw_statistic("Triangles Clipped", "%d", stats.this_frame.num_triangles_clipped); - draw_statistic("Triangles Drawn", "%d", stats.this_frame.num_triangles_drawn); - draw_statistic("Rasterized Pix", "%d", stats.this_frame.rasterized_pixels); - draw_statistic("TEV Pix In", "%d", stats.this_frame.tev_pixels_in); - draw_statistic("TEV Pix Out", "%d", stats.this_frame.tev_pixels_out); + draw_statistic("Objects", "%d", this_frame.num_drawn_objects); + draw_statistic("Vertices Loaded", "%d", this_frame.num_vertices_loaded); + draw_statistic("Triangles Input", "%d", this_frame.num_triangles_in); + draw_statistic("Triangles Rejected", "%d", this_frame.num_triangles_rejected); + draw_statistic("Triangles Culled", "%d", this_frame.num_triangles_culled); + draw_statistic("Triangles Clipped", "%d", this_frame.num_triangles_clipped); + draw_statistic("Triangles Drawn", "%d", this_frame.num_triangles_drawn); + draw_statistic("Rasterized Pix", "%d", this_frame.rasterized_pixels); + draw_statistic("TEV Pix In", "%d", this_frame.tev_pixels_in); + draw_statistic("TEV Pix Out", "%d", this_frame.tev_pixels_out); } - draw_statistic("Textures created", "%d", stats.num_textures_created); - draw_statistic("Textures uploaded", "%d", stats.num_textures_uploaded); - draw_statistic("Textures alive", "%d", stats.num_textures_alive); - draw_statistic("pshaders created", "%d", stats.num_pixel_shaders_created); - draw_statistic("pshaders alive", "%d", stats.num_pixel_shaders_alive); - draw_statistic("vshaders created", "%d", stats.num_vertex_shaders_created); - draw_statistic("vshaders alive", "%d", stats.num_vertex_shaders_alive); - draw_statistic("shaders changes", "%d", stats.this_frame.num_shader_changes); - draw_statistic("dlists called", "%d", stats.this_frame.num_dlists_called); - draw_statistic("Primitive joins", "%d", stats.this_frame.num_primitive_joins); - draw_statistic("Draw calls", "%d", stats.this_frame.num_draw_calls); - draw_statistic("Primitives", "%d", stats.this_frame.num_prims); - draw_statistic("Primitives (DL)", "%d", stats.this_frame.num_dl_prims); - draw_statistic("XF loads", "%d", stats.this_frame.num_xf_loads); - draw_statistic("XF loads (DL)", "%d", stats.this_frame.num_xf_loads_in_dl); - draw_statistic("CP loads", "%d", stats.this_frame.num_cp_loads); - draw_statistic("CP loads (DL)", "%d", stats.this_frame.num_cp_loads_in_dl); - draw_statistic("BP loads", "%d", stats.this_frame.num_bp_loads); - draw_statistic("BP loads (DL)", "%d", stats.this_frame.num_bp_loads_in_dl); - draw_statistic("Vertex streamed", "%i kB", stats.this_frame.bytes_vertex_streamed / 1024); - draw_statistic("Index streamed", "%i kB", stats.this_frame.bytes_index_streamed / 1024); - draw_statistic("Uniform streamed", "%i kB", stats.this_frame.bytes_uniform_streamed / 1024); - draw_statistic("Vertex Loaders", "%d", stats.num_vertex_loaders); - draw_statistic("EFB peeks:", "%d", stats.this_frame.num_efb_peeks); - draw_statistic("EFB pokes:", "%d", stats.this_frame.num_efb_pokes); + draw_statistic("Textures created", "%d", num_textures_created); + draw_statistic("Textures uploaded", "%d", num_textures_uploaded); + draw_statistic("Textures alive", "%d", num_textures_alive); + draw_statistic("pshaders created", "%d", num_pixel_shaders_created); + draw_statistic("pshaders alive", "%d", num_pixel_shaders_alive); + draw_statistic("vshaders created", "%d", num_vertex_shaders_created); + draw_statistic("vshaders alive", "%d", num_vertex_shaders_alive); + draw_statistic("shaders changes", "%d", this_frame.num_shader_changes); + draw_statistic("dlists called", "%d", this_frame.num_dlists_called); + draw_statistic("Primitive joins", "%d", this_frame.num_primitive_joins); + draw_statistic("Draw calls", "%d", this_frame.num_draw_calls); + draw_statistic("Primitives", "%d", this_frame.num_prims); + draw_statistic("Primitives (DL)", "%d", this_frame.num_dl_prims); + draw_statistic("XF loads", "%d", this_frame.num_xf_loads); + draw_statistic("XF loads (DL)", "%d", this_frame.num_xf_loads_in_dl); + draw_statistic("CP loads", "%d", this_frame.num_cp_loads); + draw_statistic("CP loads (DL)", "%d", this_frame.num_cp_loads_in_dl); + draw_statistic("BP loads", "%d", this_frame.num_bp_loads); + draw_statistic("BP loads (DL)", "%d", this_frame.num_bp_loads_in_dl); + draw_statistic("Vertex streamed", "%i kB", this_frame.bytes_vertex_streamed / 1024); + draw_statistic("Index streamed", "%i kB", this_frame.bytes_index_streamed / 1024); + draw_statistic("Uniform streamed", "%i kB", this_frame.bytes_uniform_streamed / 1024); + draw_statistic("Vertex Loaders", "%d", num_vertex_loaders); + draw_statistic("EFB peeks:", "%d", this_frame.num_efb_peeks); + draw_statistic("EFB pokes:", "%d", this_frame.num_efb_pokes); ImGui::Columns(1); @@ -92,7 +92,7 @@ void Statistics::Display() } // Is this really needed? -void Statistics::DisplayProj() +void Statistics::DisplayProj() const { if (!ImGui::Begin("Projection Statistics", nullptr, ImGuiWindowFlags_NoNavInputs)) { @@ -102,22 +102,22 @@ void Statistics::DisplayProj() ImGui::TextUnformatted("Projection #: X for Raw 6=0 (X for Raw 6!=0)"); ImGui::NewLine(); - ImGui::Text("Projection 0: %f (%f) Raw 0: %f", stats.gproj[0], stats.g2proj[0], stats.proj[0]); - ImGui::Text("Projection 1: %f (%f)", stats.gproj[1], stats.g2proj[1]); - ImGui::Text("Projection 2: %f (%f) Raw 1: %f", stats.gproj[2], stats.g2proj[2], stats.proj[1]); - ImGui::Text("Projection 3: %f (%f)", stats.gproj[3], stats.g2proj[3]); - ImGui::Text("Projection 4: %f (%f)", stats.gproj[4], stats.g2proj[4]); - ImGui::Text("Projection 5: %f (%f) Raw 2: %f", stats.gproj[5], stats.g2proj[5], stats.proj[2]); - ImGui::Text("Projection 6: %f (%f) Raw 3: %f", stats.gproj[6], stats.g2proj[6], stats.proj[3]); - ImGui::Text("Projection 7: %f (%f)", stats.gproj[7], stats.g2proj[7]); - ImGui::Text("Projection 8: %f (%f)", stats.gproj[8], stats.g2proj[8]); - ImGui::Text("Projection 9: %f (%f)", stats.gproj[9], stats.g2proj[9]); - ImGui::Text("Projection 10: %f (%f) Raw 4: %f", stats.gproj[10], stats.g2proj[10], stats.proj[4]); - ImGui::Text("Projection 11: %f (%f) Raw 5: %f", stats.gproj[11], stats.g2proj[11], stats.proj[5]); - ImGui::Text("Projection 12: %f (%f)", stats.gproj[12], stats.g2proj[12]); - ImGui::Text("Projection 13: %f (%f)", stats.gproj[13], stats.g2proj[13]); - ImGui::Text("Projection 14: %f (%f)", stats.gproj[14], stats.g2proj[14]); - ImGui::Text("Projection 15: %f (%f)", stats.gproj[15], stats.g2proj[15]); + ImGui::Text("Projection 0: %f (%f) Raw 0: %f", gproj[0], g2proj[0], proj[0]); + ImGui::Text("Projection 1: %f (%f)", gproj[1], g2proj[1]); + ImGui::Text("Projection 2: %f (%f) Raw 1: %f", gproj[2], g2proj[2], proj[1]); + ImGui::Text("Projection 3: %f (%f)", gproj[3], g2proj[3]); + ImGui::Text("Projection 4: %f (%f)", gproj[4], g2proj[4]); + ImGui::Text("Projection 5: %f (%f) Raw 2: %f", gproj[5], g2proj[5], proj[2]); + ImGui::Text("Projection 6: %f (%f) Raw 3: %f", gproj[6], g2proj[6], proj[3]); + ImGui::Text("Projection 7: %f (%f)", gproj[7], g2proj[7]); + ImGui::Text("Projection 8: %f (%f)", gproj[8], g2proj[8]); + ImGui::Text("Projection 9: %f (%f)", gproj[9], g2proj[9]); + ImGui::Text("Projection 10: %f (%f) Raw 4: %f", gproj[10], g2proj[10], proj[4]); + ImGui::Text("Projection 11: %f (%f) Raw 5: %f", gproj[11], g2proj[11], proj[5]); + ImGui::Text("Projection 12: %f (%f)", gproj[12], g2proj[12]); + ImGui::Text("Projection 13: %f (%f)", gproj[13], g2proj[13]); + ImGui::Text("Projection 14: %f (%f)", gproj[14], g2proj[14]); + ImGui::Text("Projection 15: %f (%f)", gproj[15], g2proj[15]); ImGui::End(); } -- cgit v1.2.3 From d4337eebdeb999df380394cdd20d054f5e9fe375 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 10 Jul 2019 23:34:50 -0400 Subject: VideoCommon/Statistics: Rename stats global to g_stats Makes the global variable follow our convention of prefixing g_ on global variables to make it obvious in surrounding code that it's not a local variable. --- Source/Core/VideoCommon/Statistics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/Statistics.cpp') diff --git a/Source/Core/VideoCommon/Statistics.cpp b/Source/Core/VideoCommon/Statistics.cpp index 081e20353c..98b60dd5da 100644 --- a/Source/Core/VideoCommon/Statistics.cpp +++ b/Source/Core/VideoCommon/Statistics.cpp @@ -10,7 +10,7 @@ #include "VideoCommon/VideoConfig.h" -Statistics stats; +Statistics g_stats; void Statistics::ResetFrame() { -- cgit v1.2.3