From 1544e4049d538f5b6f4851f711ed69ac6708e35b Mon Sep 17 00:00:00 2001 From: degasus Date: Wed, 2 Mar 2016 23:25:04 +0100 Subject: [PATCH] CustomTextures: Fix loading of the last mipmaps. Non-square textures still have mipmaps down to 1x1. --- Source/Core/VideoCommon/HiresTextures.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Source/Core/VideoCommon/HiresTextures.cpp b/Source/Core/VideoCommon/HiresTextures.cpp index b03b489305..5d177a0257 100644 --- a/Source/Core/VideoCommon/HiresTextures.cpp +++ b/Source/Core/VideoCommon/HiresTextures.cpp @@ -417,13 +417,17 @@ std::unique_ptr HiresTexture::Load(const std::string& base_filenam break; } - // calculate the size of the next mipmap - width >>= 1; - height >>= 1; - if (!ret) ret = std::unique_ptr(new HiresTexture); ret->m_levels.push_back(std::move(l)); + + // no more mipmaps available + if (width == 1 && height == 1) + break; + + // calculate the size of the next mipmap + width = std::max(1u, width >> 1); + height = std::max(1u, height >> 1); } else {