Navigation
API > API/Runtime > API/Runtime/Core
TMipField is a binary tree bit field container, used by the page allocators.
Individual bits in the tree are addressable via a (mip, slot, bit) scheme. Each level of the tree (aka "mip") contains multiple "slots". Each "slot" contains 'n' bits.
The following diagram shows a TMipField which represents 32 pages, with 1 bit per slot. Mip Level 1 0 1-------------------------------1 1 1---------------1 1---------------1 2 1----1 1----1 1----1 *----1 3 11 11 11 11 11 11 11 11 4 1-1 1-1 1-1 1-1 1-1 1-1 1-1 1-1 1-1 1-1 1-1 1-1 1-1 1-1 1-1 1-1 5 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 Page Index
For example, the highlighted bit (*) in the above tree has a (mip, slot, bit) address of (3, 6, 0). That particular bit represents a 4 page region, starting at the 24th page (i.e. pages 24, 25, 26, and 27).
The TMipFieldAllocator class uses a TMipField to store 2 bits per page: "ANY" and "ALL". When these bits are set to '1', they indicate that "any" or "all" child slots have the same bit set. e.g. If the highlighted slot's "ALL" bit was '1', this indicates the entire 4-page region (24 to 27) is allocated. Likewise, if the "ANY" bit is set, this indicates at least 1 page in this region is allocated.
The storage for the binary tree structure is provided by the TAllocator template argument. This allows for TMipField instances to use pre-allocated space at compile time before the general purpose allocators are initialized.
| Name | TMipField |
| Type | struct |
| Header File | /Engine/Source/Runtime/Core/Public/HAL/MipFieldPageAllocator.h |
| Include Path | #include "HAL/MipFieldPageAllocator.h" |
Syntax
template<typename TAllocator, uint64 InBitsPerSlot>
struct TMipField
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TMipField
(
uint64 InNumSlots |
HAL/MipFieldPageAllocator.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~TMipField() |
HAL/MipFieldPageAllocator.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FMipFieldElement | uint8_t | Underlying storage type. | HAL/MipFieldPageAllocator.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| BitsPerElement | uint64 const | Number of bits in a single element. | HAL/MipFieldPageAllocator.h |
| BitsPerSlot | uint64 const | Total number of bits to allocate for each slot. | HAL/MipFieldPageAllocator.h |
| SlotsPerElement | uint64 const | The number of unique slots that can be packed into a single element. | HAL/MipFieldPageAllocator.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Elements | FMipFieldElement * | HAL/MipFieldPageAllocator.h | ||
| MipLevelOffsets | uint64 * | HAL/MipFieldPageAllocator.h | ||
| NumElements | uint64 const | The total number of elements, which provide the storage for the entire mip chain. | HAL/MipFieldPageAllocator.h | |
| NumLevels | uint64 const | The total number of levels in the mip chain. | HAL/MipFieldPageAllocator.h | |
| NumSlots | uint64 const | Total number of slots in the largest mip. | HAL/MipFieldPageAllocator.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddressSingleMipBit
(
uint64 Mip, |
HAL/MipFieldPageAllocator.h | ||
bool GetMipBit
(
uint64 Mip, |
HAL/MipFieldPageAllocator.h | ||
bool SetMipBit
(
uint64 Mip, |
Also returns the old value of the bit. | HAL/MipFieldPageAllocator.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static uint64 GetTotalNumElements
(
uint64 NumSlotsThisMip |
Computes the total number of elements across all mips in the mipfield. | HAL/MipFieldPageAllocator.h |