Fix Model SDF texture streaming to properly mark highest loaded mip as resident

This commit is contained in:
Wojtek Figat
2024-05-24 14:58:57 +02:00
parent 2c80f4402d
commit 23efaed29e

View File

@@ -83,12 +83,16 @@ protected:
auto texture = _texture.Get();
if (texture)
{
// Check if the new mips has been just uploaded
if (_mipIndex == texture->HighestResidentMipIndex() - 1)
{
// Mark as mip loaded
// Mark the new mip as loaded
texture->SetResidentMipLevels(texture->ResidentMipLevels() + 1);
}
else
{
// Mark the new mip and all lower ones as loaded (eg. when loading Model SDF texture mips at once but out of order)
texture->SetResidentMipLevels(Math::Max(texture->ResidentMipLevels(), texture->MipLevels() - _mipIndex));
}
}
// Base