The cache manager now differentiates between mipmapped and non-mipmapped images.

This commit is contained in:
Leon Styhre 2022-11-05 20:41:17 +01:00
parent ad0cfdba8b
commit 486942c792
2 changed files with 3 additions and 3 deletions

View file

@ -179,7 +179,7 @@ std::shared_ptr<TextureResource> TextureResource::get(const std::string& path,
const bool isScalable {Utils::String::toLower(canonicalPath.substr( const bool isScalable {Utils::String::toLower(canonicalPath.substr(
canonicalPath.size() - 4, std::string::npos)) == ".svg"}; canonicalPath.size() - 4, std::string::npos)) == ".svg"};
TextureKeyType key {canonicalPath, tile, linearMagnify, isScalable, width, height}; TextureKeyType key {canonicalPath, tile, linearMagnify, mipmapping, isScalable, width, height};
auto foundTexture = sTextureMap.find(key); auto foundTexture = sTextureMap.find(key);
std::string resolutionInfo; std::string resolutionInfo;

View file

@ -105,8 +105,8 @@ private:
bool mInvalidSVGFile; bool mInvalidSVGFile;
bool mForceLoad; bool mForceLoad;
// File path, tile, linear interpolation, scalable/SVG, width, height. // File path, tile, linear interpolation, mipmapping, scalable/SVG, width, height.
using TextureKeyType = std::tuple<std::string, bool, bool, bool, size_t, size_t>; using TextureKeyType = std::tuple<std::string, bool, bool, bool, bool, size_t, size_t>;
// Map of textures, used to prevent duplicate textures. // Map of textures, used to prevent duplicate textures.
static inline std::map<TextureKeyType, std::weak_ptr<TextureResource>> sTextureMap; static inline std::map<TextureKeyType, std::weak_ptr<TextureResource>> sTextureMap;
// Set of all textures, used for memory management. // Set of all textures, used for memory management.