summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Statistics.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2019-06-20 13:29:27 +0200
committerGitHub <noreply@github.com>2019-06-20 13:29:27 +0200
commitbaf02194c1bf4a55620e3aee7d9c0a1658a61168 (patch)
treef816abce5af6a2fc44dfe6fb3a03c2ba3aaf8eae /Source/Core/VideoCommon/Statistics.cpp
parent49adbcb9ce7efa7100270ae6a73e81949005d0b9 (diff)
parent5cafce3cc43240ab73cd67fc0376431e9c24d9fb (diff)
Merge pull request #8195 from lioncash/macro
VideoCommon/Statistics: Remove preprocessor macro
Diffstat (limited to 'Source/Core/VideoCommon/Statistics.cpp')
-rw-r--r--Source/Core/VideoCommon/Statistics.cpp96
1 files changed, 46 insertions, 50 deletions
diff --git a/Source/Core/VideoCommon/Statistics.cpp b/Source/Core/VideoCommon/Statistics.cpp
index 716dee4f73..6350bb5c81 100644
--- a/Source/Core/VideoCommon/Statistics.cpp
+++ b/Source/Core/VideoCommon/Statistics.cpp
@@ -2,22 +2,19 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
-#include <cstring>
-#include <string>
+#include "VideoCommon/Statistics.h"
+
#include <utility>
-#include "imgui.h"
+#include <imgui.h>
-#include "Common/StringUtil.h"
-#include "VideoCommon/Statistics.h"
-#include "VideoCommon/VertexLoaderManager.h"
#include "VideoCommon/VideoConfig.h"
Statistics stats;
void Statistics::ResetFrame()
{
- memset(&thisFrame, 0, sizeof(ThisFrame));
+ thisFrame = {};
}
void Statistics::SwapDL()
@@ -42,53 +39,52 @@ void Statistics::Display()
ImGui::Columns(2, "Statistics", true);
-#define DRAW_STAT(name, format, ...) \
- ImGui::Text(name); \
- ImGui::NextColumn(); \
- ImGui::Text(format, __VA_ARGS__); \
- ImGui::NextColumn();
+ const auto draw_statistic = [](const char* name, const char* format, auto&&... args) {
+ ImGui::TextUnformatted(name);
+ ImGui::NextColumn();
+ ImGui::Text(format, std::forward<decltype(args)>(args)...);
+ ImGui::NextColumn();
+ };
if (g_ActiveConfig.backend_info.api_type == APIType::Nothing)
{
- DRAW_STAT("Objects", "%d", stats.thisFrame.numDrawnObjects);
- DRAW_STAT("Vertices Loaded", "%d", stats.thisFrame.numVerticesLoaded);
- DRAW_STAT("Triangles Input", "%d", stats.thisFrame.numTrianglesIn);
- DRAW_STAT("Triangles Rejected", "%d", stats.thisFrame.numTrianglesRejected);
- DRAW_STAT("Triangles Culled", "%d", stats.thisFrame.numTrianglesCulled);
- DRAW_STAT("Triangles Clipped", "%d", stats.thisFrame.numTrianglesClipped);
- DRAW_STAT("Triangles Drawn", "%d", stats.thisFrame.numTrianglesDrawn);
- DRAW_STAT("Rasterized Pix", "%d", stats.thisFrame.rasterizedPixels);
- DRAW_STAT("TEV Pix In", "%d", stats.thisFrame.tevPixelsIn);
- DRAW_STAT("TEV Pix Out", "%d", stats.thisFrame.tevPixelsOut);
+ 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_STAT("Textures created", "%d", stats.numTexturesCreated);
- DRAW_STAT("Textures uploaded", "%d", stats.numTexturesUploaded);
- DRAW_STAT("Textures alive", "%d", stats.numTexturesAlive);
- DRAW_STAT("pshaders created", "%d", stats.numPixelShadersCreated);
- DRAW_STAT("pshaders alive", "%d", stats.numPixelShadersAlive);
- DRAW_STAT("vshaders created", "%d", stats.numVertexShadersCreated);
- DRAW_STAT("vshaders alive", "%d", stats.numVertexShadersAlive);
- DRAW_STAT("shaders changes", "%d", stats.thisFrame.numShaderChanges);
- DRAW_STAT("dlists called", "%d", stats.thisFrame.numDListsCalled);
- DRAW_STAT("Primitive joins", "%d", stats.thisFrame.numPrimitiveJoins);
- DRAW_STAT("Draw calls", "%d", stats.thisFrame.numDrawCalls);
- DRAW_STAT("Primitives", "%d", stats.thisFrame.numPrims);
- DRAW_STAT("Primitives (DL)", "%d", stats.thisFrame.numDLPrims);
- DRAW_STAT("XF loads", "%d", stats.thisFrame.numXFLoads);
- DRAW_STAT("XF loads (DL)", "%d", stats.thisFrame.numXFLoadsInDL);
- DRAW_STAT("CP loads", "%d", stats.thisFrame.numCPLoads);
- DRAW_STAT("CP loads (DL)", "%d", stats.thisFrame.numCPLoadsInDL);
- DRAW_STAT("BP loads", "%d", stats.thisFrame.numBPLoads);
- DRAW_STAT("BP loads (DL)", "%d", stats.thisFrame.numBPLoadsInDL);
- DRAW_STAT("Vertex streamed", "%i kB", stats.thisFrame.bytesVertexStreamed / 1024);
- DRAW_STAT("Index streamed", "%i kB", stats.thisFrame.bytesIndexStreamed / 1024);
- DRAW_STAT("Uniform streamed", "%i kB", stats.thisFrame.bytesUniformStreamed / 1024);
- DRAW_STAT("Vertex Loaders", "%d", stats.numVertexLoaders);
- DRAW_STAT("EFB peeks:", "%d", stats.thisFrame.numEFBPeeks);
- DRAW_STAT("EFB pokes:", "%d", stats.thisFrame.numEFBPokes);
-
-#undef DRAW_STAT
+ 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);
ImGui::Columns(1);
@@ -104,7 +100,7 @@ void Statistics::DisplayProj()
return;
}
- ImGui::Text("Projection #: X for Raw 6=0 (X for Raw 6!=0)");
+ 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);