From 3eb9a1b9ba79de2652ab93d359e67f84f3dbc67e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Mon, 10 Oct 2016 05:01:37 -0700 Subject: [PATCH] Fixed issue #943. --- src/image.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/image.cpp b/src/image.cpp index 3b8a17e6d..9284aad20 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -258,9 +258,9 @@ namespace bgfx _depth = bx::uint16_max(1, _depth); uint32_t max = bx::uint32_max(_width, bx::uint32_max(_height, _depth) ); - uint8_t numMips = uint8_t(bx::flog2(float(max) ) ); + uint32_t numMips = bx::uint32_max(1, uint8_t(bx::flog2(float(max) ) ) ); - return numMips; + return uint8_t(numMips); } uint32_t imageGetSize(TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, uint16_t _numLayers, bool _cubeMap, uint8_t _numMips)