2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 21:09:55 -06:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2016-01-17 14:54:31 -07:00
|
|
|
#include <cstring>
|
2014-05-25 18:52:58 -06:00
|
|
|
#include <string>
|
2014-02-04 17:35:27 -07:00
|
|
|
#include <utility>
|
2008-12-07 22:30:24 -07:00
|
|
|
|
2018-10-09 08:26:31 -06:00
|
|
|
#include "imgui.h"
|
|
|
|
|
2014-05-25 18:52:58 -06:00
|
|
|
#include "Common/StringUtil.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "VideoCommon/Statistics.h"
|
|
|
|
#include "VideoCommon/VertexLoaderManager.h"
|
2015-10-09 12:50:36 -06:00
|
|
|
#include "VideoCommon/VideoConfig.h"
|
2008-12-07 22:30:24 -07:00
|
|
|
|
|
|
|
Statistics stats;
|
|
|
|
|
|
|
|
void Statistics::ResetFrame()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
memset(&thisFrame, 0, sizeof(ThisFrame));
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Statistics::SwapDL()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
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);
|
2008-12-07 22:30:24 -07:00
|
|
|
}
|
2009-09-03 13:42:45 -06:00
|
|
|
|
2018-10-09 08:26:31 -06:00
|
|
|
void Statistics::Display()
|
2009-09-03 13:42:45 -06:00
|
|
|
{
|
2018-10-09 08:26:31 -06:00
|
|
|
const float scale = ImGui::GetIO().DisplayFramebufferScale.x;
|
|
|
|
ImGui::SetNextWindowPos(ImVec2(10.0f * scale, 10.0f * scale), ImGuiCond_FirstUseEver);
|
|
|
|
ImGui::SetNextWindowSizeConstraints(ImVec2(275.0f * scale, 400.0f * scale),
|
|
|
|
ImGui::GetIO().DisplaySize);
|
|
|
|
if (!ImGui::Begin("Statistics", nullptr, ImGuiWindowFlags_NoNavInputs))
|
|
|
|
{
|
|
|
|
ImGui::End();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::Columns(2, "Statistics", true);
|
|
|
|
|
|
|
|
#define DRAW_STAT(name, format, ...) \
|
|
|
|
ImGui::Text(name); \
|
|
|
|
ImGui::NextColumn(); \
|
|
|
|
ImGui::Text(format, __VA_ARGS__); \
|
|
|
|
ImGui::NextColumn();
|
2015-10-09 12:50:36 -06:00
|
|
|
|
2016-07-21 17:04:57 -06:00
|
|
|
if (g_ActiveConfig.backend_info.api_type == APIType::Nothing)
|
2016-06-24 02:43:46 -06:00
|
|
|
{
|
2018-10-09 08:26:31 -06:00
|
|
|
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);
|
2016-06-24 02:43:46 -06:00
|
|
|
}
|
2015-10-09 12:50:36 -06:00
|
|
|
|
2018-10-09 08:26:31 -06:00
|
|
|
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);
|
|
|
|
|
|
|
|
#undef DRAW_STAT
|
|
|
|
|
|
|
|
ImGui::Columns(1);
|
|
|
|
|
|
|
|
ImGui::End();
|
2009-09-03 13:42:45 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Is this really needed?
|
2018-10-09 08:26:31 -06:00
|
|
|
void Statistics::DisplayProj()
|
2013-04-24 07:21:54 -06:00
|
|
|
{
|
2018-10-09 08:26:31 -06:00
|
|
|
if (!ImGui::Begin("Projection Statistics", nullptr, ImGuiWindowFlags_NoNavInputs))
|
|
|
|
{
|
|
|
|
ImGui::End();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::Text("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::End();
|
2009-09-03 13:42:45 -06:00
|
|
|
}
|