D3D12 Memory Allocator
|
#include <d3d12.h>
#include <dxgi1_4.h>
Classes | |
struct | D3D12MA::ALLOCATION_CALLBACKS |
Custom callbacks to CPU memory allocation functions. More... | |
struct | D3D12MA::ALLOCATION_DESC |
Parameters of created D3D12MA::Allocation object. To be used with Allocator::CreateResource. More... | |
struct | D3D12MA::Statistics |
Calculated statistics of memory usage e.g. in a specific memory heap type, memory segment group, custom pool, or total. More... | |
struct | D3D12MA::DetailedStatistics |
More detailed statistics than D3D12MA::Statistics. More... | |
struct | D3D12MA::TotalStatistics |
General statistics from current state of the allocator - total memory usage across all memory heaps and segments. More... | |
struct | D3D12MA::Budget |
Statistics of current memory usage and available budget for a specific memory segment group. More... | |
struct | D3D12MA::VirtualAllocation |
Represents single memory allocation done inside VirtualBlock. More... | |
class | D3D12MA::Allocation |
Represents single memory allocation. More... | |
struct | D3D12MA::DEFRAGMENTATION_DESC |
Parameters for defragmentation. More... | |
struct | D3D12MA::DEFRAGMENTATION_MOVE |
Single move of an allocation to be done for defragmentation. More... | |
struct | D3D12MA::DEFRAGMENTATION_PASS_MOVE_INFO |
Parameters for incremental defragmentation steps. More... | |
struct | D3D12MA::DEFRAGMENTATION_STATS |
Statistics returned for defragmentation process by function DefragmentationContext::GetStats(). More... | |
class | D3D12MA::DefragmentationContext |
Represents defragmentation process in progress. More... | |
struct | D3D12MA::POOL_DESC |
Parameters of created D3D12MA::Pool object. To be used with D3D12MA::Allocator::CreatePool. More... | |
class | D3D12MA::Pool |
Custom memory pool. More... | |
struct | D3D12MA::ALLOCATOR_DESC |
Parameters of created Allocator object. To be used with CreateAllocator(). More... | |
class | D3D12MA::Allocator |
Represents main object of this library initialized for particular ID3D12Device . More... | |
struct | D3D12MA::VIRTUAL_BLOCK_DESC |
Parameters of created D3D12MA::VirtualBlock object to be passed to CreateVirtualBlock(). More... | |
struct | D3D12MA::VIRTUAL_ALLOCATION_DESC |
Parameters of created virtual allocation to be passed to VirtualBlock::Allocate(). More... | |
struct | D3D12MA::VIRTUAL_ALLOCATION_INFO |
Parameters of an existing virtual allocation, returned by VirtualBlock::GetAllocationInfo(). More... | |
class | D3D12MA::VirtualBlock |
Represents pure allocation algorithm and a data structure with allocations in some memory block, without actually allocating any GPU memory. More... | |
struct | D3D12MA::CALLOCATION_DESC |
Helper structure that helps with complete and conscise initialization of the D3D12MA::ALLOCATION_DESC structure. More... | |
struct | D3D12MA::CPOOL_DESC |
Helper structure that helps with complete and conscise initialization of the D3D12MA::POOL_DESC structure. More... | |
struct | D3D12MA::CVIRTUAL_BLOCK_DESC |
Helper structure that helps with complete and conscise initialization of the D3D12MA::VIRTUAL_BLOCK_DESC structure. More... | |
struct | D3D12MA::CVIRTUAL_ALLOCATION_DESC |
Helper structure that helps with complete and conscise initialization of the D3D12MA::VIRTUAL_ALLOCATION_DESC structure. More... | |
Namespaces | |
namespace | D3D12MA |
Macros | |
#define | D3D12MA_DXGI_1_4 1 |
Define this macro to 0 to disable usage of DXGI 1.4 (which is used for IDXGIAdapter3 and query for memory budget). | |
#define | D3D12MA_CREATE_NOT_ZEROED_AVAILABLE 1 |
This macro is defined to 0 or 1 automatically. Define it to 0 to disable support for D3D12_HEAP_FLAG_CREATE_NOT_ZEROED . | |
#define | D3D12MA_USE_SMALL_RESOURCE_PLACEMENT_ALIGNMENT 1 |
When defined to value other than 0, the library will try to use D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT or D3D12_SMALL_MSAA_RESOURCE_PLACEMENT_ALIGNMENT for created textures when possible, which can save memory because some small textures may get their alignment 4 KB and their size a multiply of 4 KB instead of 64 KB. | |
#define | D3D12MA_RECOMMENDED_ALLOCATOR_FLAGS (ALLOCATOR_FLAG_DEFAULT_POOLS_NOT_ZEROED | ALLOCATOR_FLAG_MSAA_TEXTURES_ALWAYS_COMMITTED) |
Set of flags recommended for use in D3D12MA::ALLOCATOR_DESC::Flags for optimal performance. | |
#define | D3D12MA_RECOMMENDED_HEAP_FLAGS (D3D12_HEAP_FLAG_NONE) |
Set of flags recommended for use in D3D12MA::POOL_DESC::HeapFlags for optimal performance. | |
#define | D3D12MA_RECOMMENDED_POOL_FLAGS (POOL_FLAG_MSAA_TEXTURES_ALWAYS_COMMITTED) |
Set of flags recommended for use in D3D12MA::POOL_DESC::Flags for optimal performance. | |
Typedefs | |
typedef UINT64 | D3D12MA::AllocHandle |
Unique identifier of single allocation done inside the memory heap. | |
using | D3D12MA::ALLOCATE_FUNC_PTR = void* (*)(size_t Size, size_t Alignment, void* pPrivateData) |
Pointer to custom callback function that allocates CPU memory. | |
using | D3D12MA::FREE_FUNC_PTR = void (*)(void* pMemory, void* pPrivateData) |
Pointer to custom callback function that deallocates CPU memory. | |
Functions | |
D3D12MA_API HRESULT | D3D12MA::CreateAllocator (const ALLOCATOR_DESC *pDesc, Allocator **ppAllocator) |
Creates new main D3D12MA::Allocator object and returns it through ppAllocator . | |
D3D12MA_API HRESULT | D3D12MA::CreateVirtualBlock (const VIRTUAL_BLOCK_DESC *pDesc, VirtualBlock **ppVirtualBlock) |
Creates new D3D12MA::VirtualBlock object and returns it through ppVirtualBlock . | |
#define D3D12MA_CREATE_NOT_ZEROED_AVAILABLE 1 |
This macro is defined to 0 or 1 automatically. Define it to 0 to disable support for D3D12_HEAP_FLAG_CREATE_NOT_ZEROED
.
#define D3D12MA_DXGI_1_4 1 |
Define this macro to 0 to disable usage of DXGI 1.4 (which is used for IDXGIAdapter3
and query for memory budget).
#define D3D12MA_RECOMMENDED_ALLOCATOR_FLAGS (ALLOCATOR_FLAG_DEFAULT_POOLS_NOT_ZEROED | ALLOCATOR_FLAG_MSAA_TEXTURES_ALWAYS_COMMITTED) |
Set of flags recommended for use in D3D12MA::ALLOCATOR_DESC::Flags for optimal performance.
#define D3D12MA_RECOMMENDED_HEAP_FLAGS (D3D12_HEAP_FLAG_NONE) |
Set of flags recommended for use in D3D12MA::POOL_DESC::HeapFlags for optimal performance.
#define D3D12MA_RECOMMENDED_POOL_FLAGS (POOL_FLAG_MSAA_TEXTURES_ALWAYS_COMMITTED) |
Set of flags recommended for use in D3D12MA::POOL_DESC::Flags for optimal performance.
#define D3D12MA_USE_SMALL_RESOURCE_PLACEMENT_ALIGNMENT 1 |
When defined to value other than 0, the library will try to use D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT
or D3D12_SMALL_MSAA_RESOURCE_PLACEMENT_ALIGNMENT
for created textures when possible, which can save memory because some small textures may get their alignment 4 KB and their size a multiply of 4 KB instead of 64 KB.
#define D3D12MA_USE_SMALL_RESOURCE_PLACEMENT_ALIGNMENT 0
- Disables small texture alignment.#define D3D12MA_USE_SMALL_RESOURCE_PLACEMENT_ALIGNMENT 1
(the default) - Enables conservative algorithm that will use small alignment only for some textures that are surely known to support it.#define D3D12MA_USE_SMALL_RESOURCE_PLACEMENT_ALIGNMENT 2
- Enables query for small alignment to D3D12 (based on Microsoft sample) which will enable small alignment for more textures, but will also generate D3D Debug Layer error #721 on call to ID3D12Device::GetResourceAllocationInfo
, which you should just ignore.