diff --git a/gli/core/storage.inl b/gli/core/storage.inl index 9fdce72ce..046d90730 100644 --- a/gli/core/storage.inl +++ b/gli/core/storage.inl @@ -43,7 +43,7 @@ namespace gli , Faces(Faces) , Levels(Levels) , BlockSize(gli::block_size(Format)) - , BlockCount(glm::max(Dimensions / gli::block_dimensions(Format), texelcoord_type(1))) + , BlockCount(glm::max(texelcoord_type(glm::ceil(glm::vec3(Dimensions) / glm::vec3(gli::block_dimensions(Format)))), texelcoord_type(1))) , BlockDimensions(gli::block_dimensions(Format)) , Dimensions(Dimensions) { @@ -89,7 +89,7 @@ namespace gli { GLI_ASSERT(Level >= 0 && Level < this->Levels); - return glm::max(this->BlockCount >> storage::texelcoord_type(static_cast(Level)), storage::texelcoord_type(1)); + return glm::max(texelcoord_type(glm::ceil(glm::vec3(dimensions(Level)) / glm::vec3(block_dimensions()))), texelcoord_type(1)); } inline storage::texelcoord_type storage::dimensions(size_type Level) const