From 847e05140b0032b4314164f953545c725968557d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 29 Aug 2022 15:57:39 +0200 Subject: [PATCH] Add another stat, for self-tex --- GPU/Common/FramebufferManagerCommon.cpp | 6 +++++- GPU/GPU.h | 2 ++ GPU/GPUCommon.cpp | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 704a1aab26..c9c49da6bb 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -1050,6 +1050,8 @@ bool FramebufferManagerCommon::BindFramebufferAsColorTexture(int stage, VirtualF // Currently rendering to this framebuffer. Need to make a copy. if (!skipCopy && framebuffer == currentRenderVfb_) { + // Self-texturing, need a copy currently (some backends can potentially support it though). + WARN_LOG_REPORT_ONCE(selfTextureCopy, G3D, "Attempting to texture from current render target (src=%08x / target=%08x / flags=%d), making a copy", framebuffer->fb_address, currentRenderVfb_->fb_address, flags); // TODO: Maybe merge with bvfbs_? Not sure if those could be packing, and they're created at a different size. Draw::Framebuffer *renderCopy = GetTempFBO(TempFBO::COPY, framebuffer->renderWidth, framebuffer->renderHeight); if (renderCopy) { @@ -1058,7 +1060,9 @@ bool FramebufferManagerCommon::BindFramebufferAsColorTexture(int stage, VirtualF CopyFramebufferForColorTexture(©Info, framebuffer, flags); RebindFramebuffer("After BindFramebufferAsColorTexture"); draw_->BindFramebufferAsTexture(renderCopy, stage, Draw::FB_COLOR_BIT, 0); + gpuStats.numCopiesForSelfTex++; } else { + // Failed to get temp FBO? Weird. draw_->BindFramebufferAsTexture(framebuffer->fbo, stage, Draw::FB_COLOR_BIT, 0); } return true; @@ -1066,7 +1070,7 @@ bool FramebufferManagerCommon::BindFramebufferAsColorTexture(int stage, VirtualF draw_->BindFramebufferAsTexture(framebuffer->fbo, stage, Draw::FB_COLOR_BIT, 0); return true; } else { - ERROR_LOG_REPORT_ONCE(vulkanSelfTexture, G3D, "Attempting to texture from target (src=%08x / target=%08x / flags=%d)", framebuffer->fb_address, currentRenderVfb_->fb_address, flags); + ERROR_LOG_REPORT_ONCE(selfTextureFail, G3D, "Attempting to texture from target (src=%08x / target=%08x / flags=%d)", framebuffer->fb_address, currentRenderVfb_->fb_address, flags); // To do this safely in Vulkan, we need to use input attachments. // Actually if the texture region and render regions don't overlap, this is safe, but we need // to transition to GENERAL image layout which will take some trickery. diff --git a/GPU/GPU.h b/GPU/GPU.h index 73afcb9860..93f81fb67c 100644 --- a/GPU/GPU.h +++ b/GPU/GPU.h @@ -88,6 +88,7 @@ struct GPUStatistics { numReinterpretCopies = 0; numColorCopies = 0; numCopiesForShaderBlend = 0; + numCopiesForSelfTex = 0; msProcessingDisplayLists = 0; vertexGPUCycles = 0; otherGPUCycles = 0; @@ -118,6 +119,7 @@ struct GPUStatistics { int numReinterpretCopies; int numColorCopies; int numCopiesForShaderBlend; + int numCopiesForSelfTex; double msProcessingDisplayLists; int vertexGPUCycles; int otherGPUCycles; diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 40f0a461f4..18f1cab9d4 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -3061,8 +3061,8 @@ size_t GPUCommon::FormatGPUStatsCommon(char *buffer, size_t size) { "Vertices: %d cached: %d uncached: %d\n" "FBOs active: %d (evaluations: %d)\n" "Textures: %d, dec: %d, invalidated: %d, hashed: %d kB\n" - "Readbacks: %d, uploads: %d, depal: %d\n" - "Copies: depth %d, color %d, reint: %d, sh_blend: %d\n" + "readbacks %d, uploads %d, depal %d\n" + "Copies: depth %d, color %d, reint %d, blend %d, selftex %d\n" "GPU cycles executed: %d (%f per vertex)\n", gpuStats.msProcessingDisplayLists * 1000.0f, gpuStats.numDrawCalls, @@ -3087,6 +3087,7 @@ size_t GPUCommon::FormatGPUStatsCommon(char *buffer, size_t size) { gpuStats.numColorCopies, gpuStats.numReinterpretCopies, gpuStats.numCopiesForShaderBlend, + gpuStats.numCopiesForSelfTex, gpuStats.vertexGPUCycles + gpuStats.otherGPUCycles, vertexAverageCycles );