mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:58:51 +02:00
Merge pull request #9741 from jherico/smarter_textures
Prevent name collisions in KTX from causing crashes
This commit is contained in:
commit
19c6056b51
2 changed files with 4 additions and 2 deletions
|
@ -117,6 +117,9 @@ ktx::KTXUniquePointer Texture::serialize(const Texture& texture) {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ktxBuffer = ktx::KTX::create(header, images);
|
auto ktxBuffer = ktx::KTX::create(header, images);
|
||||||
|
auto expectedMipCount = texture.evalNumMips();
|
||||||
|
assert(expectedMipCount == ktxBuffer->_images.size());
|
||||||
|
assert(expectedMipCount == header.numberOfMipmapLevels);
|
||||||
|
|
||||||
assert(0 == memcmp(&header, ktxBuffer->getHeader(), sizeof(ktx::Header)));
|
assert(0 == memcmp(&header, ktxBuffer->getHeader(), sizeof(ktx::Header)));
|
||||||
assert(ktxBuffer->_images.size() == images.size());
|
assert(ktxBuffer->_images.size() == images.size());
|
||||||
|
|
|
@ -103,8 +103,7 @@ gpu::Texture* cacheTexture(const std::string& name, gpu::Texture* srcTexture, bo
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
std::string cleanedName = name;
|
std::string cleanedName = QUrl::toPercentEncoding(name.c_str()).toStdString();
|
||||||
cleanedName = cleanedName.substr(cleanedName.find_last_of((char) '//') + 1);
|
|
||||||
std::string cacheFilename(ktxCacheFolder.toStdString());
|
std::string cacheFilename(ktxCacheFolder.toStdString());
|
||||||
cacheFilename += "/";
|
cacheFilename += "/";
|
||||||
cacheFilename += cleanedName;
|
cacheFilename += cleanedName;
|
||||||
|
|
Loading…
Reference in a new issue