From f91c6faaf2bccc0c549da6740a2d7d91ac1cd3d1 Mon Sep 17 00:00:00 2001 From: Jamil Halabi Date: Mon, 11 Dec 2023 18:39:02 +0300 Subject: [PATCH] Fixed calcNumMips for non-power-of-2 texture dimensions (#3219) --- src/bgfx_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 7d617d341d..1084f6987b 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -635,7 +635,7 @@ namespace bgfx if (_hasMips) { const uint32_t max = bx::max(_width, _height, _depth); - const uint32_t num = 1 + bx::ceilLog2(max); + const uint32_t num = 1 + bx::floorLog2(max); return uint8_t(num); }