Skip to content

Commit

Permalink
fix max lod level computation in IBLPrefilter
Browse files Browse the repository at this point in the history
FIXES=[308012116]
  • Loading branch information
pixelflinger committed Oct 27, 2023
1 parent 2b86c8d commit cfd851e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion filament/src/details/Texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class FTexture : public Texture {

// Returns the max number of levels for a texture of given dimensions
static inline uint8_t maxLevelCount(uint32_t width, uint32_t height) noexcept {
uint32_t maxDimension = std::max(width, height);
uint32_t const maxDimension = std::max(width, height);
return maxLevelCount(maxDimension);
}

Expand Down
2 changes: 1 addition & 1 deletion libs/iblprefilter/src/IBLPrefilterContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Texture* IBLPrefilterContext::EquirectangularToCubemap::operator()(
"equirect must be a 2D texture.");

UTILS_UNUSED_IN_RELEASE
const uint8_t maxLevelCount = uint8_t(std::log2(equirect->getWidth()) + 0.5f) + 1u;
const uint8_t maxLevelCount = std::max(1, std::ilogbf(float(equirect->getWidth())) + 1);

ASSERT_PRECONDITION(equirect->getLevels() == maxLevelCount,
"equirect must have %u mipmap levels allocated.", +maxLevelCount);
Expand Down

0 comments on commit cfd851e

Please sign in to comment.