From 91f1eca95e415f6de0ca7a5dce77ad030d2675b6 Mon Sep 17 00:00:00 2001 From: TellowKrinkle Date: Thu, 9 Sep 2021 16:38:57 -0500 Subject: [PATCH] GS: Fix prim count in SW renderer debug stats Previously was actually draw count, not prim count --- pcsx2/GS/Renderers/Common/GSFunctionMap.h | 4 ++-- pcsx2/GS/Renderers/SW/GSDrawScanline.cpp | 4 ++-- pcsx2/GS/Renderers/SW/GSDrawScanline.h | 2 +- pcsx2/GS/Renderers/SW/GSRasterizer.cpp | 14 +++++++++++++- pcsx2/GS/Renderers/SW/GSRasterizer.h | 3 ++- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/pcsx2/GS/Renderers/Common/GSFunctionMap.h b/pcsx2/GS/Renderers/Common/GSFunctionMap.h index 59726b0ada..56cd727f2f 100644 --- a/pcsx2/GS/Renderers/Common/GSFunctionMap.h +++ b/pcsx2/GS/Renderers/Common/GSFunctionMap.h @@ -80,7 +80,7 @@ public: return m_active->f; } - void UpdateStats(uint64 frame, uint64 ticks, int actual, int total) + void UpdateStats(uint64 frame, uint64 ticks, int actual, int total, int prims) { if (m_active) { @@ -90,7 +90,7 @@ public: m_active->frames++; } - m_active->prims++; + m_active->prims += prims; m_active->ticks += ticks; m_active->actual += actual; m_active->total += total; diff --git a/pcsx2/GS/Renderers/SW/GSDrawScanline.cpp b/pcsx2/GS/Renderers/SW/GSDrawScanline.cpp index 029a79ff31..70808b4a44 100644 --- a/pcsx2/GS/Renderers/SW/GSDrawScanline.cpp +++ b/pcsx2/GS/Renderers/SW/GSDrawScanline.cpp @@ -103,9 +103,9 @@ void GSDrawScanline::BeginDraw(const GSRasterizerData* data) m_sp = m_sp_map[sel]; } -void GSDrawScanline::EndDraw(uint64 frame, uint64 ticks, int actual, int total) +void GSDrawScanline::EndDraw(uint64 frame, uint64 ticks, int actual, int total, int prims) { - m_ds_map.UpdateStats(frame, ticks, actual, total); + m_ds_map.UpdateStats(frame, ticks, actual, total, prims); } #ifndef ENABLE_JIT_RASTERIZER diff --git a/pcsx2/GS/Renderers/SW/GSDrawScanline.h b/pcsx2/GS/Renderers/SW/GSDrawScanline.h index 7ec8354259..fa9e9c2e14 100644 --- a/pcsx2/GS/Renderers/SW/GSDrawScanline.h +++ b/pcsx2/GS/Renderers/SW/GSDrawScanline.h @@ -62,7 +62,7 @@ public: // IDrawScanline void BeginDraw(const GSRasterizerData* data); - void EndDraw(uint64 frame, uint64 ticks, int actual, int total); + void EndDraw(uint64 frame, uint64 ticks, int actual, int total, int prims); void DrawRect(const GSVector4i& r, const GSVertexSW& v); diff --git a/pcsx2/GS/Renderers/SW/GSRasterizer.cpp b/pcsx2/GS/Renderers/SW/GSRasterizer.cpp index c3cd313a73..61deaf053f 100644 --- a/pcsx2/GS/Renderers/SW/GSRasterizer.cpp +++ b/pcsx2/GS/Renderers/SW/GSRasterizer.cpp @@ -42,6 +42,7 @@ GSRasterizer::GSRasterizer(IDrawScanline* ds, int id, int threads, GSPerfMon* pe , m_threads(threads) { memset(&m_pixels, 0, sizeof(m_pixels)); + m_primcount = 0; m_thread_height = compute_best_thread_height(threads); @@ -138,6 +139,7 @@ void GSRasterizer::Draw(GSRasterizerData* data) m_pixels.actual = 0; m_pixels.total = 0; + m_primcount = 0; data->start = GetCPUTicks(); @@ -249,12 +251,14 @@ void GSRasterizer::Draw(GSRasterizerData* data) m_pixels.sum += m_pixels.actual; - m_ds->EndDraw(data->frame, ticks, m_pixels.actual, m_pixels.total); + m_ds->EndDraw(data->frame, ticks, m_pixels.actual, m_pixels.total, m_primcount); } template void GSRasterizer::DrawPoint(const GSVertexSW* vertex, int vertex_count, const uint32* index, int index_count) { + m_primcount++; + if (index != NULL) { for (int i = 0; i < index_count; i++, index++) @@ -299,6 +303,8 @@ void GSRasterizer::DrawPoint(const GSVertexSW* vertex, int vertex_count, const u void GSRasterizer::DrawLine(const GSVertexSW* vertex, const uint32* index) { + m_primcount++; + const GSVertexSW& v0 = vertex[index[0]]; const GSVertexSW& v1 = vertex[index[1]]; @@ -415,6 +421,8 @@ static const uint8 s_ysort[8][4] = void GSRasterizer::DrawTriangle(const GSVertexSW* vertex, const uint32* index) { + m_primcount++; + GSVertexSW2 dv[3]; GSVertexSW2 edge; GSVertexSW2 dedge; @@ -606,6 +614,8 @@ void GSRasterizer::DrawTriangleSection(int top, int bottom, GSVertexSW2& edge, c void GSRasterizer::DrawTriangle(const GSVertexSW* vertex, const uint32* index) { + m_primcount++; + GSVertexSW dv[3]; GSVertexSW edge; GSVertexSW dedge; @@ -799,6 +809,8 @@ void GSRasterizer::DrawTriangleSection(int top, int bottom, GSVertexSW& edge, co void GSRasterizer::DrawSprite(const GSVertexSW* vertex, const uint32* index) { + m_primcount++; + const GSVertexSW& v0 = vertex[index[0]]; const GSVertexSW& v1 = vertex[index[1]]; diff --git a/pcsx2/GS/Renderers/SW/GSRasterizer.h b/pcsx2/GS/Renderers/SW/GSRasterizer.h index be85d7b987..a186ecb637 100644 --- a/pcsx2/GS/Renderers/SW/GSRasterizer.h +++ b/pcsx2/GS/Renderers/SW/GSRasterizer.h @@ -87,7 +87,7 @@ public: virtual ~IDrawScanline() {} virtual void BeginDraw(const GSRasterizerData* data) = 0; - virtual void EndDraw(uint64 frame, uint64 ticks, int actual, int total) = 0; + virtual void EndDraw(uint64 frame, uint64 ticks, int actual, int total, int prims) = 0; #ifdef ENABLE_JIT_RASTERIZER @@ -137,6 +137,7 @@ protected: GSVector4 m_fscissor_y; struct { GSVertexSW* buff; int count; } m_edge; struct { int sum, actual, total; } m_pixels; + int m_primcount; typedef void (GSRasterizer::*DrawPrimPtr)(const GSVertexSW* v, int count);