MCPcopy Create free account
hub / github.com/crownengine/crown / imageGetNumMips

Function imageGetNumMips

3rdparty/bimg/src/image.cpp:310–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308 }
309
310 uint8_t imageGetNumMips(TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth)
311 {
312 const ImageBlockInfo& blockInfo = getBlockInfo(_format);
313 const uint16_t blockWidth = blockInfo.blockWidth;
314 const uint16_t blockHeight = blockInfo.blockHeight;
315 const uint16_t minBlockX = blockInfo.minBlockX;
316 const uint16_t minBlockY = blockInfo.minBlockY;
317
318 _width = bx::max<uint16_t>(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth )*blockWidth);
319 _height = bx::max<uint16_t>(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight);
320 _depth = bx::max<uint16_t>(1, _depth);
321
322 uint8_t numMips = calcNumMips(true, _width, _height, _depth);
323
324 return numMips;
325 }
326
327 uint32_t imageGetSize(TextureInfo* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format)
328 {

Callers 1

imageAllocFunction · 0.85

Calls 1

calcNumMipsFunction · 0.70

Tested by

no test coverage detected