Fix gfx::memory_usage(texture)

This commit is contained in:
Nikita Lisitsa 2023-03-08 22:24:49 +03:00
parent c639e533fe
commit 23f818078f

View file

@ -610,7 +610,10 @@ namespace psemek::gfx
template <std::size_t D, GLenum Target>
std::size_t memory_usage(basic_texture<D, Target> const & texture)
{
return texture.width() * texture.height() * texture.depth() * pixel_size(texture.internal_format());
auto size = texture.width() * texture.height() * texture.depth();
if (size == 0)
return 0;
return size * pixel_size(texture.internal_format());
}
}