handle 16 byte hash while reading in TextureCache

This commit is contained in:
Stephen Birarda 2017-04-20 18:19:29 -07:00 committed by Atlante45
parent 3c5754282f
commit e708a71b64

View file

@ -559,13 +559,16 @@ void NetworkTexture::maybeHandleFinishedInitialLoad() {
});
std::string filename;
std::string hash;
if (found == keyValues.end() || found->_value.size() != 32) {
if (found == keyValues.end() || found->_value.size() != gpu::SOURCE_HASH_BYTES) {
qWarning("Invalid source hash key found, bailing");
_ktxResourceState = FAILED_TO_LOAD;
finishedLoading(false);
return;
} else {
hash = filename = std::string(reinterpret_cast<char*>(found->_value.data()), 32);
// at this point the source hash is in binary 16-byte form
// and we need it in a hexadecimal string
auto binaryHash = QByteArray(reinterpret_cast<char*>(found->_value.data()), gpu::SOURCE_HASH_BYTES);
hash = filename = binaryHash.toHex().toStdString();
}
auto textureCache = DependencyManager::get<TextureCache>();