struct MeshCacheParams { UPInt MemReserve; UPInt MemLimit; UPInt MemGranularity; UPInt LRUTailSize; UPInt StagingBufferSize; UPInt VBLockEvictSizeLimit; unsigned MaxBatchInstances; unsigned InstancingThreshold; unsigned NoBatchVerticesSizeThreshold; unsigned MaxVerticesSizeInBatch; unsigned MaxIndicesInBatch; enum PCDefaultsType { PC_Defaults }; enum ConsoleDefaultsType { Console_Defaults }; };
MeshCacheParams holds mesh cache parameters that control buffer sizes, batching and allocation policies of MeshCache. Mesh cache memory is allocated in large chunks, with the first chunk pre-allocated on HAL initialization and can then grow up to a fixed limit. MemReserve defines the initial amount of cache memory allocated and MemLimit defines the maximum locatable amount. If both of these values are the same, no cache allocation will take place after initialization. MeshCache grows in blocks, specified by MemGranularity, and shrinks once there is more LRU cache content than provided for by LRUTailSize. StagingBufferSize is a system-memory buffer used for building batches; it can be set to 64K on consoles (the default value there), but must be larger on PC as it also serves as a secondary cache.
Data Member |
Description |
The number of consecutive meshes that forces the use of instancing. | |
The size up to which LRU Tail will be allowed to grow without data being discarded, assuming that MemLimit hasn't yet been reached. Dynamic size of the cache will be roughly [sizeof(LastFrame) + LRUTailSize] * 1.125, where 1.125 is a fragmentation adjustment factor. | |
Maximum number of instances in a batch; set based on the hardware capabilities. | |
The maximum number of indices of meshes in a single batch. | |
The maximum size of vertices in a single batch; once this threshold is exceeded new batch is created. | |
The default block size for the growth of mesh cache (the size multiple by which the heap will grow). | |
Limit on the maximum amount of memory set aside for mesh cache. | |
Memory that is reserved ahead for mesh cache growth. | |
If mesh vertex size is exceeded, it cannot be batched. Note that it can still be instanced. | |
Mesh Staging buffer size; must be at least 2 * (MaxVerticesSizeInBatch + Indices). Serves as secondary cache on PC. Meshes larger than NoBatchVerticesSizeThreshold are not placed in a staging buffer. | |
Maximum VBSize (vertex buffer size) evicted during a single lock. This should be set low to avoid unnecessary thrashing that reduces MRU effectiveness. |
Enumeration |
Description |
Console parameters constructor tag. | |
PC parameters constructor tag. |
Method |
Description |
Default MeshCacheParams constructor for PC/Consoles. | |
Constructs MeshCacheParams based on previous value, overriding specified non-zero arguments. |
Render_MeshCacheConfig.h