llmemtype.cpp
上传用户:king477883
上传日期:2021-03-01
资源大小:9553k
文件大小:13k
源码类别:

游戏引擎

开发平台:

C++ Builder

  1. /** 
  2.  * @file llmemtype.cpp
  3.  * @brief Simple memory allocation/deallocation tracking stuff here
  4.  *
  5.  * $LicenseInfo:firstyear=2002&license=viewergpl$
  6.  * 
  7.  * Copyright (c) 2002-2010, Linden Research, Inc.
  8.  * 
  9.  * Second Life Viewer Source Code
  10.  * The source code in this file ("Source Code") is provided by Linden Lab
  11.  * to you under the terms of the GNU General Public License, version 2.0
  12.  * ("GPL"), unless you have obtained a separate licensing agreement
  13.  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  14.  * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15.  * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16.  * 
  17.  * There are special exceptions to the terms and conditions of the GPL as
  18.  * it is applied to this Source Code. View the full text of the exception
  19.  * in the file doc/FLOSS-exception.txt in this software distribution, or
  20.  * online at
  21.  * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22.  * 
  23.  * By copying, modifying or distributing this software, you acknowledge
  24.  * that you have read and understood your obligations described above,
  25.  * and agree to abide by those obligations.
  26.  * 
  27.  * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28.  * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29.  * COMPLETENESS OR PERFORMANCE.
  30.  * $/LicenseInfo$
  31.  */
  32. #include "llmemtype.h"
  33. #include "llallocator.h"
  34. std::vector<char const *> LLMemType::DeclareMemType::mNameList;
  35. LLMemType::DeclareMemType LLMemType::MTYPE_INIT("Init");
  36. LLMemType::DeclareMemType LLMemType::MTYPE_STARTUP("Startup");
  37. LLMemType::DeclareMemType LLMemType::MTYPE_MAIN("Main");
  38. LLMemType::DeclareMemType LLMemType::MTYPE_FRAME("Frame");
  39. LLMemType::DeclareMemType LLMemType::MTYPE_GATHER_INPUT("GatherInput");
  40. LLMemType::DeclareMemType LLMemType::MTYPE_JOY_KEY("JoyKey");
  41. LLMemType::DeclareMemType LLMemType::MTYPE_IDLE("Idle");
  42. LLMemType::DeclareMemType LLMemType::MTYPE_IDLE_PUMP("IdlePump");
  43. LLMemType::DeclareMemType LLMemType::MTYPE_IDLE_NETWORK("IdleNetwork");
  44. LLMemType::DeclareMemType LLMemType::MTYPE_IDLE_UPDATE_REGIONS("IdleUpdateRegions");
  45. LLMemType::DeclareMemType LLMemType::MTYPE_IDLE_UPDATE_VIEWER_REGION("IdleUpdateViewerRegion");
  46. LLMemType::DeclareMemType LLMemType::MTYPE_IDLE_UPDATE_SURFACE("IdleUpdateSurface");
  47. LLMemType::DeclareMemType LLMemType::MTYPE_IDLE_UPDATE_PARCEL_OVERLAY("IdleUpdateParcelOverlay");
  48. LLMemType::DeclareMemType LLMemType::MTYPE_IDLE_AUDIO("IdleAudio");
  49. LLMemType::DeclareMemType LLMemType::MTYPE_CACHE_PROCESS_PENDING("CacheProcessPending");
  50. LLMemType::DeclareMemType LLMemType::MTYPE_CACHE_PROCESS_PENDING_ASKS("CacheProcessPendingAsks");
  51. LLMemType::DeclareMemType LLMemType::MTYPE_CACHE_PROCESS_PENDING_REPLIES("CacheProcessPendingReplies");
  52. LLMemType::DeclareMemType LLMemType::MTYPE_MESSAGE_CHECK_ALL("MessageCheckAll");
  53. LLMemType::DeclareMemType LLMemType::MTYPE_MESSAGE_PROCESS_ACKS("MessageProcessAcks");
  54. LLMemType::DeclareMemType LLMemType::MTYPE_RENDER("Render");
  55. LLMemType::DeclareMemType LLMemType::MTYPE_SLEEP("Sleep");
  56. LLMemType::DeclareMemType LLMemType::MTYPE_NETWORK("Network");
  57. LLMemType::DeclareMemType LLMemType::MTYPE_PHYSICS("Physics");
  58. LLMemType::DeclareMemType LLMemType::MTYPE_INTERESTLIST("InterestList");
  59. LLMemType::DeclareMemType LLMemType::MTYPE_IMAGEBASE("ImageBase");
  60. LLMemType::DeclareMemType LLMemType::MTYPE_IMAGERAW("ImageRaw");
  61. LLMemType::DeclareMemType LLMemType::MTYPE_IMAGEFORMATTED("ImageFormatted");
  62. LLMemType::DeclareMemType LLMemType::MTYPE_APPFMTIMAGE("AppFmtImage");
  63. LLMemType::DeclareMemType LLMemType::MTYPE_APPRAWIMAGE("AppRawImage");
  64. LLMemType::DeclareMemType LLMemType::MTYPE_APPAUXRAWIMAGE("AppAuxRawImage");
  65. LLMemType::DeclareMemType LLMemType::MTYPE_DRAWABLE("Drawable");
  66. LLMemType::DeclareMemType LLMemType::MTYPE_OBJECT("Object");
  67. LLMemType::DeclareMemType LLMemType::MTYPE_OBJECT_PROCESS_UPDATE("ObjectProcessUpdate");
  68. LLMemType::DeclareMemType LLMemType::MTYPE_OBJECT_PROCESS_UPDATE_CORE("ObjectProcessUpdateCore");
  69. LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY("Display");
  70. LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_UPDATE("DisplayUpdate");
  71. LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_UPDATE_CAMERA("DisplayUpdateCam");
  72. LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_UPDATE_GEOM("DisplayUpdateGeom");
  73. LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_SWAP("DisplaySwap");
  74. LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_UPDATE_HUD("DisplayUpdateHud");
  75. LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_GEN_REFLECTION("DisplayGenRefl");
  76. LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_IMAGE_UPDATE("DisplayImageUpdate");
  77. LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_STATE_SORT("DisplayStateSort");
  78. LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_SKY("DisplaySky");
  79. LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_RENDER_GEOM("DisplayRenderGeom");
  80. LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_RENDER_FLUSH("DisplayRenderFlush");
  81. LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_RENDER_UI("DisplayRenderUI");
  82. LLMemType::DeclareMemType LLMemType::MTYPE_DISPLAY_RENDER_ATTACHMENTS("DisplayRenderAttach");
  83. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_DATA("VertexData");
  84. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_CONSTRUCTOR("VertexConstr");
  85. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_DESTRUCTOR("VertexDestr");
  86. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_CREATE_VERTICES("VertexCreateVerts");
  87. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_CREATE_INDICES("VertexCreateIndices");
  88. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_DESTROY_BUFFER("VertexDestroyBuff");
  89. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_DESTROY_INDICES("VertexDestroyIndices");
  90. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_UPDATE_VERTS("VertexUpdateVerts");
  91. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_UPDATE_INDICES("VertexUpdateIndices");
  92. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_ALLOCATE_BUFFER("VertexAllocateBuffer");
  93. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_RESIZE_BUFFER("VertexResizeBuffer");
  94. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_MAP_BUFFER("VertexMapBuffer");
  95. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_MAP_BUFFER_VERTICES("VertexMapBufferVerts");
  96. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_MAP_BUFFER_INDICES("VertexMapBufferIndices");
  97. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_UNMAP_BUFFER("VertexUnmapBuffer");
  98. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_SET_STRIDE("VertexSetStride");
  99. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_SET_BUFFER("VertexSetBuffer");
  100. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_SETUP_VERTEX_BUFFER("VertexSetupVertBuff");
  101. LLMemType::DeclareMemType LLMemType::MTYPE_VERTEX_CLEANUP_CLASS("VertexCleanupClass");
  102. LLMemType::DeclareMemType LLMemType::MTYPE_SPACE_PARTITION("SpacePartition");
  103. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE("Pipeline");
  104. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_INIT("PipelineInit");
  105. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_CREATE_BUFFERS("PipelineCreateBuffs");
  106. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RESTORE_GL("PipelineRestroGL");
  107. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_UNLOAD_SHADERS("PipelineUnloadShaders");
  108. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_LIGHTING_DETAIL("PipelineLightingDetail");
  109. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_GET_POOL_TYPE("PipelineGetPoolType");
  110. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_ADD_POOL("PipelineAddPool");
  111. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_ALLOCATE_DRAWABLE("PipelineAllocDrawable");
  112. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_ADD_OBJECT("PipelineAddObj");
  113. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_CREATE_OBJECTS("PipelineCreateObjs");
  114. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_UPDATE_MOVE("PipelineUpdateMove");
  115. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_UPDATE_GEOM("PipelineUpdateGeom");
  116. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_MARK_VISIBLE("PipelineMarkVisible");
  117. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_MARK_MOVED("PipelineMarkMoved");
  118. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_MARK_SHIFT("PipelineMarkShift");
  119. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_SHIFT_OBJECTS("PipelineShiftObjs");
  120. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_MARK_TEXTURED("PipelineMarkTextured");
  121. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_MARK_REBUILD("PipelineMarkRebuild");
  122. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_UPDATE_CULL("PipelineUpdateCull");
  123. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_STATE_SORT("PipelineStateSort");
  124. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_POST_SORT("PipelinePostSort");
  125. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_HUD_ELS("PipelineHudEls");
  126. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_HL("PipelineRenderHL");
  127. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_GEOM("PipelineRenderGeom");
  128. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_GEOM_DEFFERRED("PipelineRenderGeomDef");
  129. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_GEOM_POST_DEF("PipelineRenderGeomPostDef");
  130. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_GEOM_SHADOW("PipelineRenderGeomShadow");
  131. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_SELECT("PipelineRenderSelect");
  132. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_REBUILD_POOLS("PipelineRebuildPools");
  133. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_QUICK_LOOKUP("PipelineQuickLookup");
  134. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_OBJECTS("PipelineRenderObjs");
  135. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_GENERATE_IMPOSTOR("PipelineGenImpostors");
  136. LLMemType::DeclareMemType LLMemType::MTYPE_PIPELINE_RENDER_BLOOM("PipelineRenderBloom");
  137. LLMemType::DeclareMemType LLMemType::MTYPE_UPKEEP_POOLS("UpkeepPools");
  138. LLMemType::DeclareMemType LLMemType::MTYPE_AVATAR("Avatar");
  139. LLMemType::DeclareMemType LLMemType::MTYPE_AVATAR_MESH("AvatarMesh");
  140. LLMemType::DeclareMemType LLMemType::MTYPE_PARTICLES("Particles");
  141. LLMemType::DeclareMemType LLMemType::MTYPE_REGIONS("Regions");
  142. LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY("Inventory");
  143. LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_DRAW("InventoryDraw");
  144. LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_BUILD_NEW_VIEWS("InventoryBuildNewViews");
  145. LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_DO_FOLDER("InventoryDoFolder");
  146. LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_POST_BUILD("InventoryPostBuild");
  147. LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_FROM_XML("InventoryFromXML");
  148. LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_CREATE_NEW_ITEM("InventoryCreateNewItem");
  149. LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_VIEW_INIT("InventoryViewInit");
  150. LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_VIEW_SHOW("InventoryViewShow");
  151. LLMemType::DeclareMemType LLMemType::MTYPE_INVENTORY_VIEW_TOGGLE("InventoryViewToggle");
  152. LLMemType::DeclareMemType LLMemType::MTYPE_ANIMATION("Animation");
  153. LLMemType::DeclareMemType LLMemType::MTYPE_VOLUME("Volume");
  154. LLMemType::DeclareMemType LLMemType::MTYPE_PRIMITIVE("Primitive");
  155. LLMemType::DeclareMemType LLMemType::MTYPE_SCRIPT("Script");
  156. LLMemType::DeclareMemType LLMemType::MTYPE_SCRIPT_RUN("ScriptRun");
  157. LLMemType::DeclareMemType LLMemType::MTYPE_SCRIPT_BYTECODE("ScriptByteCode");
  158. LLMemType::DeclareMemType LLMemType::MTYPE_IO_PUMP("IoPump");
  159. LLMemType::DeclareMemType LLMemType::MTYPE_IO_TCP("IoTCP");
  160. LLMemType::DeclareMemType LLMemType::MTYPE_IO_BUFFER("IoBuffer");
  161. LLMemType::DeclareMemType LLMemType::MTYPE_IO_HTTP_SERVER("IoHttpServer");
  162. LLMemType::DeclareMemType LLMemType::MTYPE_IO_SD_SERVER("IoSDServer");
  163. LLMemType::DeclareMemType LLMemType::MTYPE_IO_SD_CLIENT("IoSDClient");
  164. LLMemType::DeclareMemType LLMemType::MTYPE_IO_URL_REQUEST("IOUrlRequest");
  165. LLMemType::DeclareMemType LLMemType::MTYPE_DIRECTX_INIT("DirectXInit");
  166. LLMemType::DeclareMemType LLMemType::MTYPE_TEMP1("Temp1");
  167. LLMemType::DeclareMemType LLMemType::MTYPE_TEMP2("Temp2");
  168. LLMemType::DeclareMemType LLMemType::MTYPE_TEMP3("Temp3");
  169. LLMemType::DeclareMemType LLMemType::MTYPE_TEMP4("Temp4");
  170. LLMemType::DeclareMemType LLMemType::MTYPE_TEMP5("Temp5");
  171. LLMemType::DeclareMemType LLMemType::MTYPE_TEMP6("Temp6");
  172. LLMemType::DeclareMemType LLMemType::MTYPE_TEMP7("Temp7");
  173. LLMemType::DeclareMemType LLMemType::MTYPE_TEMP8("Temp8");
  174. LLMemType::DeclareMemType LLMemType::MTYPE_TEMP9("Temp9");
  175. LLMemType::DeclareMemType LLMemType::MTYPE_OTHER("Other");
  176. LLMemType::DeclareMemType::DeclareMemType(char const * st)
  177. {
  178. mID = (S32)mNameList.size();
  179. mName = st;
  180. mNameList.push_back(mName);
  181. }
  182. LLMemType::DeclareMemType::~DeclareMemType()
  183. {
  184. }
  185. LLMemType::LLMemType(LLMemType::DeclareMemType& dt)
  186. {
  187. mTypeIndex = dt.mID;
  188. LLAllocator::pushMemType(dt.mID);
  189. }
  190. LLMemType::~LLMemType()
  191. {
  192. LLAllocator::popMemType();
  193. }
  194. char const * LLMemType::getNameFromID(S32 id)
  195. {
  196. if (id < 0 || id >= (S32)DeclareMemType::mNameList.size())
  197. {
  198. return "INVALID";
  199. }
  200. return DeclareMemType::mNameList[id];
  201. }