From 17bb4dce49289ee16c783c2bc437c3a2aa2d8040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Thu, 11 Nov 2021 15:21:59 -0800 Subject: [PATCH] 08-update: Fixed BC texture update. --- examples/08-update/update.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/08-update/update.cpp b/examples/08-update/update.cpp index 6a2b003fd..9bfebea80 100644 --- a/examples/08-update/update.cpp +++ b/examples/08-update/update.cpp @@ -173,18 +173,17 @@ bgfx::TextureHandle loadTextureWithUpdate(const char* _filePath, uint64_t _flags , NULL ); - uint32_t width = imageContainer->m_width; + const bimg::ImageBlockInfo& blockInfo = getBlockInfo(imageContainer->m_format); + const uint32_t blockWidth = blockInfo.blockWidth; + const uint32_t blockHeight = blockInfo.blockHeight; + + uint32_t width = imageContainer->m_width; uint32_t height = imageContainer->m_height; for (uint8_t lod = 0, num = imageContainer->m_numMips; lod < num; ++lod) { - if (width < 4 || height < 4) - { - break; - } - - width = bx::max(1u, width); - height = bx::max(1u, height); + width = bx::max(blockWidth, width); + height = bx::max(blockHeight, height); bimg::ImageMip mip;