From ea552bc5739731214227c8bbc5d4d84f0e0b0a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 30 May 2023 00:51:10 +0200 Subject: [PATCH] Add a new GPU stat (DrawPixels), kinda heavy since creates textures. GoW does 20-ish per frame. --- GPU/Common/FramebufferManagerCommon.cpp | 6 ++++-- GPU/GPU.h | 2 ++ GPU/GPUCommonHW.cpp | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 9876952f39..b80d47d40b 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -1418,10 +1418,12 @@ Draw::Texture *FramebufferManagerCommon::MakePixelTexture(const u8 *srcPixels, G }; // Hot Shots Golf (#12355) does tons of these in a frame in some situations! So creating textures - // better be fast. + // better be fast. So does God of War, a lot of the time, a bit unclear what it's doing. Draw::Texture *tex = draw_->CreateTexture(desc); - if (!tex) + if (!tex) { ERROR_LOG(G3D, "Failed to create DrawPixels texture"); + } + gpuStats.numDrawPixels++; return tex; } diff --git a/GPU/GPU.h b/GPU/GPU.h index c44749cb63..ba5ada12e8 100644 --- a/GPU/GPU.h +++ b/GPU/GPU.h @@ -100,6 +100,7 @@ struct GPUStatistics { numColorCopies = 0; numCopiesForShaderBlend = 0; numCopiesForSelfTex = 0; + numDrawPixels = 0; numReplacerTrackedTex = 0; numCachedReplacedTextures = 0; msProcessingDisplayLists = 0; @@ -135,6 +136,7 @@ struct GPUStatistics { int numColorCopies; int numCopiesForShaderBlend; int numCopiesForSelfTex; + int numDrawPixels; int numReplacerTrackedTex; int numCachedReplacedTextures; double msProcessingDisplayLists; diff --git a/GPU/GPUCommonHW.cpp b/GPU/GPUCommonHW.cpp index f95ad480cd..c326d2630f 100644 --- a/GPU/GPUCommonHW.cpp +++ b/GPU/GPUCommonHW.cpp @@ -1652,7 +1652,7 @@ size_t GPUCommonHW::FormatGPUStatsCommon(char *buffer, size_t size) { "Textures: %d, dec: %d, invalidated: %d, hashed: %d kB\n" "readbacks %d (%d non-block), uploads %d, depal %d\n" "replacer: tracks %d references, %d unique textures\n" - "Copies: depth %d, color %d, reint %d, blend %d, selftex %d\n" + "Cpy: depth %d, color %d, reint %d, blend %d, self %d, drawpix %d\n" "GPU cycles executed: %d (%f per vertex)\n", gpuStats.msProcessingDisplayLists * 1000.0f, gpuStats.numDrawSyncs, @@ -1682,6 +1682,7 @@ size_t GPUCommonHW::FormatGPUStatsCommon(char *buffer, size_t size) { gpuStats.numReinterpretCopies, gpuStats.numCopiesForShaderBlend, gpuStats.numCopiesForSelfTex, + gpuStats.numDrawPixels, gpuStats.vertexGPUCycles + gpuStats.otherGPUCycles, vertexAverageCycles );