From 1c50d3e4b3fd2d2248b8a7cf6331a5f13b98a3a5 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 28 Mar 2022 21:49:39 +1000 Subject: [PATCH] GS: Add stat for barriers --- pcsx2/GS/GS.cpp | 6 ++++-- pcsx2/GS/GSPerfMon.h | 1 + pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp | 4 ++++ pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp | 3 +++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pcsx2/GS/GS.cpp b/pcsx2/GS/GS.cpp index b0b62c1144..e1e20a178d 100644 --- a/pcsx2/GS/GS.cpp +++ b/pcsx2/GS/GS.cpp @@ -727,23 +727,25 @@ void GSgetStats(std::string& info) { if (GSConfig.TexturePreloading == TexturePreloadingLevel::Full) { - info = format("%s HW | HC: %d MB | %d P | %d D | %d DC | %d RB | %d TC | %d TU", + info = format("%s HW | HC: %d MB | %d P | %d D | %d DC | %d B | %d RB | %d TC | %d TU", api_name, (int)std::ceil(static_cast(s_gs.get())->GetTextureCache()->GetHashCacheMemoryUsage() / 1048576.0f), (int)pm.Get(GSPerfMon::Prim), (int)pm.Get(GSPerfMon::Draw), (int)std::ceil(pm.Get(GSPerfMon::DrawCalls)), + (int)std::ceil(pm.Get(GSPerfMon::Barriers)), (int)std::ceil(pm.Get(GSPerfMon::Readbacks)), (int)std::ceil(pm.Get(GSPerfMon::TextureCopies)), (int)std::ceil(pm.Get(GSPerfMon::TextureUploads))); } else { - info = format("%s HW | %d P | %d D | %d DC | %d RB | %d TC | %d TU", + info = format("%s HW | %d P | %d D | %d DC | %d B | %d RB | %d TC | %d TU", api_name, (int)pm.Get(GSPerfMon::Prim), (int)pm.Get(GSPerfMon::Draw), (int)std::ceil(pm.Get(GSPerfMon::DrawCalls)), + (int)std::ceil(pm.Get(GSPerfMon::Barriers)), (int)std::ceil(pm.Get(GSPerfMon::Readbacks)), (int)std::ceil(pm.Get(GSPerfMon::TextureCopies)), (int)std::ceil(pm.Get(GSPerfMon::TextureUploads))); diff --git a/pcsx2/GS/GSPerfMon.h b/pcsx2/GS/GSPerfMon.h index 18964e0898..15e8359ed5 100644 --- a/pcsx2/GS/GSPerfMon.h +++ b/pcsx2/GS/GSPerfMon.h @@ -29,6 +29,7 @@ public: Fillrate, Quad, SyncPoint, + Barriers, CounterLast, // Reused counters for HW. diff --git a/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp b/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp index 7c1d027c1c..d66c19687f 100644 --- a/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp +++ b/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp @@ -2045,6 +2045,8 @@ void GSDeviceOGL::SendHWDraw(const GSHWDrawConfig& config, bool needs_barrier) config.nindices / config.indices_per_prim, config.drawlist->size(), message.c_str()); #endif + g_perfmon.Put(GSPerfMon::Barriers, static_cast(config.drawlist->size())); + for (size_t count = 0, p = 0, n = 0; n < config.drawlist->size(); p += count, ++n) { count = (*config.drawlist)[n] * config.indices_per_prim; @@ -2063,6 +2065,7 @@ void GSDeviceOGL::SendHWDraw(const GSHWDrawConfig& config, bool needs_barrier) GL_PUSH("Split the draw"); GL_PERF("Split single draw in %d draw", config.nindices / config.indices_per_prim); + g_perfmon.Put(GSPerfMon::Barriers, config.nindices / config.indices_per_prim); for (size_t p = 0; p < config.nindices; p += config.indices_per_prim) { @@ -2077,6 +2080,7 @@ void GSDeviceOGL::SendHWDraw(const GSHWDrawConfig& config, bool needs_barrier) { // The common renderer code doesn't put a barrier here because D3D/VK need to copy the DS, so we need to check it. // One barrier needed for non-overlapping draw. + g_perfmon.Put(GSPerfMon::Barriers, 1); glTextureBarrier(); DrawIndexedPrimitive(); return; diff --git a/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp b/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp index 027d189fe9..68c33b139a 100644 --- a/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp +++ b/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp @@ -3145,6 +3145,7 @@ void GSDeviceVK::SendHWDraw(const GSHWDrawConfig& config, GSTextureVK* draw_rt) if (config.drawlist) { GL_PUSH("Split the draw (SPRITE)"); + g_perfmon.Put(GSPerfMon::Barriers, static_cast(config.drawlist->size())); for (u32 count = 0, p = 0, n = 0; n < static_cast(config.drawlist->size()); p += count, ++n) { @@ -3161,6 +3162,7 @@ void GSDeviceVK::SendHWDraw(const GSHWDrawConfig& config, GSTextureVK* draw_rt) if (config.require_full_barrier) { GL_PUSH("Split single draw in %d draw", config.nindices / config.indices_per_prim); + g_perfmon.Put(GSPerfMon::Barriers, config.nindices / config.indices_per_prim); for (u32 p = 0; p < config.nindices; p += config.indices_per_prim) { @@ -3173,6 +3175,7 @@ void GSDeviceVK::SendHWDraw(const GSHWDrawConfig& config, GSTextureVK* draw_rt) if (config.require_one_barrier) { + g_perfmon.Put(GSPerfMon::Barriers, 1); ColorBufferBarrier(draw_rt); DrawIndexedPrimitive(); return;