From 24e56a825eb0a07b0679b2fd022d7576f48dfe9d Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 28 Mar 2024 18:07:53 +0100 Subject: [PATCH] Fix streaming astc 6x6 textures that have higher block size --- Source/Engine/Graphics/Textures/StreamingTexture.cpp | 3 ++- Source/Engine/Streaming/StreamingHandlers.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Graphics/Textures/StreamingTexture.cpp b/Source/Engine/Graphics/Textures/StreamingTexture.cpp index a3927a30c..14874abf1 100644 --- a/Source/Engine/Graphics/Textures/StreamingTexture.cpp +++ b/Source/Engine/Graphics/Textures/StreamingTexture.cpp @@ -113,8 +113,9 @@ bool StreamingTexture::Create(const TextureHeader& header) 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 + const int32 blockSize = PixelFormatExtensions::ComputeBlockSize(_header.Format); int32 lastMip = header.MipLevels - 1; - while ((header.Width >> lastMip) < 4 && (header.Height >> lastMip) < 4 && lastMip > 0) + while ((header.Width >> lastMip) < blockSize && (header.Height >> lastMip) < blockSize && lastMip > 0) lastMip--; _minMipCountBlockCompressed = Math::Min(header.MipLevels - lastMip + 1, header.MipLevels); } diff --git a/Source/Engine/Streaming/StreamingHandlers.cpp b/Source/Engine/Streaming/StreamingHandlers.cpp index 44ea60774..0b10fba1b 100644 --- a/Source/Engine/Streaming/StreamingHandlers.cpp +++ b/Source/Engine/Streaming/StreamingHandlers.cpp @@ -59,7 +59,7 @@ int32 TexturesStreamingHandler::CalculateResidency(StreamableResource* resource, if (mipLevels > 0 && mipLevels < texture._minMipCountBlockCompressed && texture._isBlockCompressed) { - // Block compressed textures require minimum size of 4 + // Block compressed textures require minimum size of block size (eg. 4 for BC formats) mipLevels = texture._minMipCountBlockCompressed; }