From d50da7dc5519397999b1d79737400af95aefe4fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 8 Mar 2022 19:46:00 +0100 Subject: [PATCH 1/2] Don't track small wide-stride block transfers --- GPU/GPUCommon.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 03fc75aabcc6..bb860f75f2a4 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -2771,9 +2771,12 @@ void GPUCommon::DoBlockTransfer(u32 skipDrawReason) { framebufferManager_->NotifyBlockTransferAfter(dstBasePtr, dstStride, dstX, dstY, srcBasePtr, srcStride, srcX, srcY, width, height, bpp, skipDrawReason); } + const uint32_t numBytes = width * height * bpp; const uint32_t srcSize = height * srcStride * bpp; const uint32_t dstSize = height * dstStride * bpp; - if (MemBlockInfoDetailed(srcSize, dstSize)) { + // We do the check here on the number of bytes to avoid marking really tiny images. + // Helps perf in GT menu which does insane amounts of these, one for each text character per frame. + if (MemBlockInfoDetailed(numBytes, numBytes)) { const uint32_t src = srcBasePtr + (srcY * srcStride + srcX) * bpp; const uint32_t dst = dstBasePtr + (dstY * dstStride + dstX) * bpp; const std::string tag = "GPUBlockTransfer/" + GetMemWriteTagAt(src, srcSize); From 7cab540fcafef4d56900a652d86d7bfbd415778b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 8 Mar 2022 19:46:27 +0100 Subject: [PATCH 2/2] Short circuit the texture replacement code --- GPU/Common/TextureCacheCommon.cpp | 7 +++++++ GPU/Vulkan/TextureCacheVulkan.cpp | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 076899015de4..7397b22c96f4 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -1277,6 +1277,13 @@ u32 TextureCacheCommon::EstimateTexMemoryUsage(const TexCacheEntry *entry) { } ReplacedTexture &TextureCacheCommon::FindReplacement(TexCacheEntry *entry, int &w, int &h) { + // Short circuit the non-enabled case. + // Otherwise, due to bReplaceTexturesAllowLate, we'll still spawn tasks looking for replacements + // that then won't be used. + if (!replacer_.Enabled()) { + return replacer_.FindNone(); + } + // Allow some delay to reduce pop-in. constexpr double MAX_BUDGET_PER_TEX = 0.25 / 60.0; diff --git a/GPU/Vulkan/TextureCacheVulkan.cpp b/GPU/Vulkan/TextureCacheVulkan.cpp index de04a1b46015..d8369eb2bab1 100644 --- a/GPU/Vulkan/TextureCacheVulkan.cpp +++ b/GPU/Vulkan/TextureCacheVulkan.cpp @@ -657,7 +657,6 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) { badMipSizes = false; } - // Don't scale the PPGe texture. if (entry->addr > 0x05000000 && entry->addr < PSP_GetKernelMemoryEnd()) { scaleFactor = 1;