From 42d7226413f83a280f273efe69b58a2213fcdf4e Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 1 May 2022 15:23:35 -0700 Subject: [PATCH] Vulkan: Correct size for tex mip level readback. Used by the GE debugger to display the texture levels. --- GPU/Vulkan/TextureCacheVulkan.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/GPU/Vulkan/TextureCacheVulkan.cpp b/GPU/Vulkan/TextureCacheVulkan.cpp index a53ef9618f..972b93d04d 100644 --- a/GPU/Vulkan/TextureCacheVulkan.cpp +++ b/GPU/Vulkan/TextureCacheVulkan.cpp @@ -1088,6 +1088,13 @@ bool TextureCacheVulkan::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int leve int w = texture->GetWidth(); int h = texture->GetHeight(); + if (level > 0) { + // In the future, maybe this could do something for 3D textures... + if (level >= texture->GetNumMips()) + return false; + w >>= level; + h >>= level; + } buffer.Allocate(w, h, bufferFormat); renderManager->CopyImageToMemorySync(texture->GetImage(), level, 0, 0, w, h, drawFormat, (uint8_t *)buffer.GetData(), w, "GetCurrentTextureDebug");