Fix texture streaming minimum mips to load for block compressed textures

This commit is contained in:
Wojtek Figat
2021-06-18 14:42:09 +02:00
parent f582ca5051
commit 4681d8da56
3 changed files with 13 additions and 11 deletions

View File

@@ -110,6 +110,14 @@ bool StreamingTexture::Create(const TextureHeader& header)
// That's one of the main advantages of the current resources streaming system.
_header = header;
_isBlockCompressed = PixelFormatExtensions::IsCompressed(_header.Format);
if (_isBlockCompressed)
{
// Ensure that streaming doesn't go too low because the hardware expects the texture to be min in size of compressed texture block
int32 lastMip = header.MipLevels - 1;
while (header.Width >> lastMip < 4 && header.Height >> lastMip < 4)
lastMip--;
_minMipCountBlockCompressed = header.MipLevels - lastMip + 1;
}
// Request resource streaming
#if GPU_ENABLE_TEXTURES_STREAMING