diff --git a/3rdparty/ocornut-imgui/imgui.cpp b/3rdparty/ocornut-imgui/imgui.cpp index eab90ad5b..bee941a49 100644 --- a/3rdparty/ocornut-imgui/imgui.cpp +++ b/3rdparty/ocornut-imgui/imgui.cpp @@ -602,6 +602,7 @@ #pragma clang diagnostic ignored "-Wmissing-noreturn" // warning : function xx could be declared with attribute 'noreturn' warning // GetDefaultFontData() asserts which some implementation makes it never return. #pragma clang diagnostic ignored "-Wdeprecated-declarations"// warning : 'xx' is deprecated: The POSIX name for this item.. // for strdup used in demo code (so user can copy & paste the code) #pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int' +#pragma clang diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used #endif #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used diff --git a/3rdparty/stb/stb_image.c b/3rdparty/stb/stb_image.c index 401895aed..ad26b74f5 100644 --- a/3rdparty/stb/stb_image.c +++ b/3rdparty/stb/stb_image.c @@ -5,6 +5,8 @@ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" # endif // __clang__ #elif defined(_MSC_VER) +# pragma warning(disable:4244) // warning C4244: '=': conversion from 'int' to 'stbi__uint16', possible loss of data +# pragma warning(disable:4245) // warning C4245: 'argument': conversion from 'int' to 'char', signed/unsigned mismatch # pragma warning(disable:4312) // warning C4312: 'type cast': conversion from '' to '' of greater size # pragma warning(disable:4456) // warning C4456: declaration of 'k' hides previous local declaration # pragma warning(disable:4457) // warning C4457: declaration of 'y' hides function parameter diff --git a/src/image.cpp b/src/image.cpp index 9d337c3d4..2aa69de0a 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -252,24 +252,12 @@ namespace bgfx const uint16_t minBlockX = blockInfo.minBlockX; const uint16_t minBlockY = blockInfo.minBlockY; - _width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth); - _height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight); - _depth = bx::uint16_max(1, _depth); + _width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth); + _height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight); + _depth = bx::uint16_max(1, _depth); - uint8_t numMips = 0; - - for (uint32_t width = _width, height = _height, depth = _depth - ; blockWidth < width || blockHeight < height || 1 < depth - ; ++numMips) - { - width = bx::uint32_max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth); - height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight); - depth = bx::uint32_max(1, depth); - - width >>= 1; - height >>= 1; - depth >>= 1; - } + uint32_t max = bx::uint32_max(_width, bx::uint32_max(_height, _depth) ); + uint8_t numMips = uint8_t(bx::flog2(float(max) ) ); return numMips; }