Fix KTX requests thrashing if a mip level can't be assigned

When downloading a mip level and assigning it to the underlying
resource, we weren't checking to see if the assignment was successful.
If it was unsuccessful, we would queue up a request for the next mip
which would end up being a request for the same mip that was just
attempted. This change fixes this problem by checking to see if the
texture's available mip level is at least <= the assigned mip level.
This commit is contained in:
Ryan Huffman 2017-10-11 09:44:01 -07:00
parent b105248dd7
commit c6672fc4ac

View file

@ -620,6 +620,12 @@ void NetworkTexture::ktxMipRequestFinished() {
texture->assignStoredMip(mipLevel, data.size(), reinterpret_cast<const uint8_t*>(data.data()));
// If mip level assigned above is still unavailable, then we assume future requests will also fail.
auto minMipLevel = texture->minAvailableMipLevel();
if (minMipLevel > mipLevel) {
return;
}
QMetaObject::invokeMethod(resource.data(), "setImage",
Q_ARG(gpu::TexturePointer, texture),
Q_ARG(int, texture->getWidth()),