From 9ed96921e1e0ae1ec257e79fdedd1a2fcacf7199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 30 Jul 2022 16:51:29 +0200 Subject: [PATCH] Cleanup --- GPU/Common/TextureCacheCommon.cpp | 2 ++ GPU/D3D11/TextureCacheD3D11.cpp | 2 -- GPU/Directx9/TextureCacheDX9.cpp | 1 - GPU/GLES/TextureCacheGLES.cpp | 2 -- GPU/Vulkan/TextureCacheVulkan.cpp | 13 ++++++------- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index a6530aa374..601ce11908 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -2011,6 +2011,8 @@ std::string AttachCandidate::ToString() { } bool TextureCacheCommon::PrepareBuildTexture(BuildTexturePlan &plan, TexCacheEntry *entry) { + gpuStats.numTexturesDecoded++; + // For the estimate, we assume cluts always point to 8888 for simplicity. cacheSizeEstimate_ += EstimateTexMemoryUsage(entry); diff --git a/GPU/D3D11/TextureCacheD3D11.cpp b/GPU/D3D11/TextureCacheD3D11.cpp index 00df99ac60..ec845d7eb9 100644 --- a/GPU/D3D11/TextureCacheD3D11.cpp +++ b/GPU/D3D11/TextureCacheD3D11.cpp @@ -598,8 +598,6 @@ void TextureCacheD3D11::LoadTextureLevel(TexCacheEntry &entry, uint8_t *mapData, int w = gstate.getTextureWidth(srcLevel); int h = gstate.getTextureHeight(srcLevel); - gpuStats.numTexturesDecoded++; - if (replaced.GetSize(srcLevel, w, h)) { double replaceStart = time_now_d(); replaced.Load(srcLevel, mapData, mapRowPitch); diff --git a/GPU/Directx9/TextureCacheDX9.cpp b/GPU/Directx9/TextureCacheDX9.cpp index be56de79bc..8bd1d7a6e1 100644 --- a/GPU/Directx9/TextureCacheDX9.cpp +++ b/GPU/Directx9/TextureCacheDX9.cpp @@ -508,7 +508,6 @@ void TextureCacheDX9::LoadTextureLevel(TexCacheEntry &entry, uint8_t *data, int int w = gstate.getTextureWidth(level); int h = gstate.getTextureHeight(level); - gpuStats.numTexturesDecoded++; if (replaced.GetSize(level, w, h)) { double replaceStart = time_now_d(); replaced.Load(level, data, stride); diff --git a/GPU/GLES/TextureCacheGLES.cpp b/GPU/GLES/TextureCacheGLES.cpp index b1b70bde06..2c63f40b1b 100644 --- a/GPU/GLES/TextureCacheGLES.cpp +++ b/GPU/GLES/TextureCacheGLES.cpp @@ -530,8 +530,6 @@ void TextureCacheGLES::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &r uint8_t *pixelData; int decPitch = 0; - gpuStats.numTexturesDecoded++; - if (replaced.GetSize(srcLevel, w, h)) { int bpp = (int)DataFormatSizeInBytes(replaced.Format(srcLevel)); diff --git a/GPU/Vulkan/TextureCacheVulkan.cpp b/GPU/Vulkan/TextureCacheVulkan.cpp index 8d9a19bb01..b64851656b 100644 --- a/GPU/Vulkan/TextureCacheVulkan.cpp +++ b/GPU/Vulkan/TextureCacheVulkan.cpp @@ -845,8 +845,6 @@ void TextureCacheVulkan::LoadTextureLevel(TexCacheEntry &entry, uint8_t *writePt int w = gstate.getTextureWidth(level); int h = gstate.getTextureHeight(level); - gpuStats.numTexturesDecoded++; - PROFILE_THIS_SCOPE("decodetex"); GETextureFormat tfmt = (GETextureFormat)entry.format; @@ -858,21 +856,22 @@ void TextureCacheVulkan::LoadTextureLevel(TexCacheEntry &entry, uint8_t *writePt int bufw = GetTextureBufw(level, texaddr, tfmt); int bpp = dstFmt == VULKAN_8888_FORMAT ? 4 : 2; - u32 *pixelData = (u32 *)writePtr; - int decPitch = rowPitch; + u32 *pixelData; + int decPitch; - bool expand32 = !gstate_c.Supports(GPU_SUPPORTS_16BIT_FORMATS) || dstFmt == VK_FORMAT_R8G8B8A8_UNORM || scaleFactor > 1; + bool expand32 = !gstate_c.Supports(GPU_SUPPORTS_16BIT_FORMATS) || scaleFactor > 1; if (scaleFactor > 1) { tmpTexBufRearrange_.resize(std::max(bufw, w) * h); pixelData = tmpTexBufRearrange_.data(); // We want to end up with a neatly packed texture for scaling. decPitch = w * bpp; + } else { + pixelData = (u32 *)writePtr; + decPitch = rowPitch; } CheckAlphaResult alphaResult = DecodeTextureLevel((u8 *)pixelData, decPitch, tfmt, clutformat, texaddr, level, bufw, false, expand32); - - // WARN_LOG(G3D, "Alpha: full=%d w=%d h=%d level=%d %s/%s", (int)(alphaResult == CHECKALPHA_FULL), w, h, level, GeTextureFormatToString(tfmt), GEPaletteFormatToString(clutformat)); entry.SetAlphaStatus(alphaResult, level); if (scaleFactor > 1) {