Direct3D 12 Memory Allocator
|
Represents single memory allocation. More...
#include <D3D12MemAlloc.h>
Public Member Functions | |
UINT64 | GetOffset () const |
Returns offset in bytes from the start of memory heap. | |
UINT64 | GetAlignment () const |
Returns alignment that resource was created with. | |
UINT64 | GetSize () const |
Returns size in bytes of the allocation. | |
ID3D12Resource * | GetResource () const |
Returns D3D12 resource associated with this object. | |
void | SetResource (ID3D12Resource *pResource) |
Releases the resource currently pointed by the allocation (if any), sets it to new one, incrementing its reference counter (if not null). | |
ID3D12Heap * | GetHeap () const |
Returns memory heap that the resource is created in. | |
void | SetPrivateData (void *pPrivateData) |
Changes custom pointer for an allocation to a new value. | |
void * | GetPrivateData () const |
Get custom pointer associated with the allocation. | |
void | SetName (LPCWSTR Name) |
Associates a name with the allocation object. This name is for use in debug diagnostics and tools. | |
LPCWSTR | GetName () const |
Returns the name associated with the allocation object. | |
Represents single memory allocation.
It may be either implicit memory heap dedicated to a single resource or a specific region of a bigger heap plus unique offset.
To create such object, fill structure D3D12MA::ALLOCATION_DESC and call function Allocator::CreateResource.
The object remembers size and some other information. To retrieve this information, use methods of this class.
The object also remembers ID3D12Resource
and "owns" a reference to it, so it calls Release()
on the resource when destroyed.
|
inline |
Returns alignment that resource was created with.
ID3D12Heap * D3D12MA::Allocation::GetHeap | ( | ) | const |
Returns memory heap that the resource is created in.
If the Allocation represents committed resource with implicit heap, returns NULL.
|
inline |
Returns the name associated with the allocation object.
Returned string points to an internal copy.
If no name was associated with the allocation, returns null.
UINT64 D3D12MA::Allocation::GetOffset | ( | ) | const |
Returns offset in bytes from the start of memory heap.
You usually don't need to use this offset. If you create a buffer or a texture together with the allocation using function D3D12MA::Allocator::CreateResource, functions that operate on that resource refer to the beginning of the resource, not entire memory heap.
If the Allocation represents committed resource with implicit heap, returns 0.
|
inline |
Get custom pointer associated with the allocation.
|
inline |
Returns D3D12 resource associated with this object.
Calling this method doesn't increment resource's reference counter.
|
inline |
Returns size in bytes of the allocation.
ID3D12Device::GetResourceAllocationInfo
.ID3D12Resource::GetGPUVirtualAddress()
+ Allocation::GetSize() to overlap in memory and still work correctly. void D3D12MA::Allocation::SetName | ( | LPCWSTR | Name | ) |
Associates a name with the allocation object. This name is for use in debug diagnostics and tools.
Internal copy of the string is made, so the memory pointed by the argument can be changed of freed immediately after this call.
Name
can be null.
|
inline |
Changes custom pointer for an allocation to a new value.
void D3D12MA::Allocation::SetResource | ( | ID3D12Resource * | pResource | ) |
Releases the resource currently pointed by the allocation (if any), sets it to new one, incrementing its reference counter (if not null).
AllocHandle D3D12MA::Allocation::allocHandle |
NormalBlock* D3D12MA::Allocation::block |
ID3D12Heap* D3D12MA::Allocation::heap |
CommittedAllocationList* D3D12MA::Allocation::list |
struct { ... } D3D12MA::Allocation::m_Committed |
struct { ... } D3D12MA::Allocation::m_Heap |
struct { ... } D3D12MA::Allocation::m_Placed |
Allocation* D3D12MA::Allocation::next |
Allocation* D3D12MA::Allocation::prev |