MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / listResources

Method listResources

Engine/source/gfx/gfxDevice.cpp:955–1005  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

953#endif
954
955void GFXDevice::listResources(bool unflaggedOnly)
956{
957 U32 numTextures = 0, numShaders = 0, numRenderToTextureTargs = 0, numWindowTargs = 0;
958 U32 numCubemaps = 0, numVertexBuffers = 0, numPrimitiveBuffers = 0, numFences = 0;
959 U32 numStateBlocks = 0;
960
961 GFXResource* walk = mResourceListHead;
962 while(walk)
963 {
964 if(unflaggedOnly && walk->isFlagged())
965 {
966 walk = walk->getNextResource();
967 continue;
968 }
969
970 if(dynamic_cast<GFXTextureObject*>(walk))
971 numTextures++;
972 else if(dynamic_cast<GFXShader*>(walk))
973 numShaders++;
974 else if(dynamic_cast<GFXTextureTarget*>(walk))
975 numRenderToTextureTargs++;
976 else if(dynamic_cast<GFXWindowTarget*>(walk))
977 numWindowTargs++;
978 else if(dynamic_cast<GFXCubemap*>(walk))
979 numCubemaps++;
980 else if(dynamic_cast<GFXVertexBuffer*>(walk))
981 numVertexBuffers++;
982 else if(dynamic_cast<GFXPrimitiveBuffer*>(walk))
983 numPrimitiveBuffers++;
984 else if(dynamic_cast<GFXFence*>(walk))
985 numFences++;
986 else if (dynamic_cast<GFXStateBlock*>(walk))
987 numStateBlocks++;
988 else
989 Con::warnf("Unknown resource: %x", walk);
990
991 walk = walk->getNextResource();
992 }
993 const char* flag = unflaggedOnly ? "unflagged" : "allocated";
994
995 Con::printf("GFX currently has:");
996 Con::printf(" %i %s textures", numTextures, flag);
997 Con::printf(" %i %s shaders", numShaders, flag);
998 Con::printf(" %i %s texture targets", numRenderToTextureTargs, flag);
999 Con::printf(" %i %s window targets", numWindowTargs, flag);
1000 Con::printf(" %i %s cubemaps", numCubemaps, flag);
1001 Con::printf(" %i %s vertex buffers", numVertexBuffers, flag);
1002 Con::printf(" %i %s primitive buffers", numPrimitiveBuffers, flag);
1003 Con::printf(" %i %s fences", numFences, flag);
1004 Con::printf(" %i %s state blocks", numStateBlocks, flag);
1005}
1006
1007void GFXDevice::fillResourceVectors(const char* resNames, bool unflaggedOnly, Vector<GFXResource*> &textureObjects,
1008 Vector<GFXResource*> &textureTargets, Vector<GFXResource*> &windowTargets, Vector<GFXResource*> &vertexBuffers,

Callers 1

gfxDevice.cppFile · 0.80

Calls 4

printfFunction · 0.85
isFlaggedMethod · 0.80
getNextResourceMethod · 0.80
warnfFunction · 0.50

Tested by

no test coverage detected