MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / GetMemoryUsage

Method GetMemoryUsage

src/Nazara/Utility/Image.cpp:667–692  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

665 }
666
667 std::size_t Image::GetMemoryUsage() const
668 {
669 unsigned int width = m_sharedImage->width;
670 unsigned int height = m_sharedImage->height;
671 unsigned int depth = m_sharedImage->depth;
672
673 unsigned int size = 0;
674 for (unsigned int i = 0; i < m_sharedImage->levels.size(); ++i)
675 {
676 size += width * height * depth;
677
678 if (width > 1)
679 width >>= 1;
680
681 if (height > 1)
682 height >>= 1;
683
684 if (depth > 1)
685 depth >>= 1;
686 }
687
688 if (m_sharedImage->type == ImageType_Cubemap)
689 size *= 6;
690
691 return size * PixelFormat::GetBytesPerPixel(m_sharedImage->format);
692 }
693
694 std::size_t Image::GetMemoryUsage(UInt8 level) const
695 {

Callers 2

LuaBinding_UtilityMethod · 0.45
MemoryAllocatorMethod · 0.45

Calls 1

GetLevelSizeFunction · 0.70

Tested by

no test coverage detected