MCPcopy Create free account
hub / github.com/axmolengine/axmol / getCachedTextureInfo

Method getCachedTextureInfo

core/renderer/TextureCache.cpp:762–791  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

760}
761
762std::string TextureCache::getCachedTextureInfo() const
763{
764 std::string ret;
765
766 char tmp[1024];
767
768 unsigned int count = 0;
769 unsigned int totalBytes = 0;
770
771 for (auto&& texture : _textures)
772 {
773 Texture2D* tex = texture.second;
774 unsigned int bpp = tex->getBitsPerPixelForFormat();
775 // Each texture takes up width * height * bytesPerPixel bytes.
776 auto bytes = tex->getPixelsWide() * tex->getPixelsHigh() * bpp / 8;
777 totalBytes += bytes;
778 count++;
779 auto msg = fmt::format_to_z(tmp, "\"{}\" rc={} id={} {} x {} @ {} bpp => {} KB\n", texture.first,
780 tex->getReferenceCount(), fmt::ptr(tex->getBackendTexture()), tex->getPixelsWide(),
781 tex->getPixelsHigh(), bpp, bytes / 1024);
782
783 ret += msg;
784 }
785
786 auto msg = fmt::format_to_z(tmp, "TextureCache dumpDebugInfo: {} textures, for {} KB ({:.2f} MB)\n", count,
787 totalBytes / 1024, totalBytes / (1024.0f * 1024.0f));
788 ret += msg;
789
790 return ret;
791}
792
793void TextureCache::renameTextureWithKey(std::string_view srcName, std::string_view dstName)
794{

Callers 4

purgeCachedDataMethod · 0.80
commandTexturesMethod · 0.80
onEnterMethod · 0.80
~TextureDemoMethod · 0.80

Calls 7

format_to_zFunction · 0.85
getPixelsWideMethod · 0.80
getPixelsHighMethod · 0.80
getBackendTextureMethod · 0.80
ptrFunction · 0.50
getReferenceCountMethod · 0.45

Tested by 2

onEnterMethod · 0.64
~TextureDemoMethod · 0.64