XII Release 0.1.0
Loading...
Searching...
No Matches
xiiD3D12MemoryAllocator Class Reference

#include <MemoryAllocatorD3D12.h>

Public Member Functions

xiiResult Initialize (xiiGALDeviceD3D12 *pDeviceD3D12, xiiUInt32 uiPreferredBlockSize=0U)
void DeInitialize ()
 Cleans up internal resources.
xiiResult CreateBuffer (const D3D12_RESOURCE_DESC &resourceDescription, const xiiD3D12MemoryAllocationCreateInfo &allocationCreateInfo, ID3D12Resource **out_ppResource, xiiD3D12Allocation *out_pAllocation)
void DestroyBuffer (ID3D12Resource *&pResource, xiiD3D12Allocation &pAllocation)
xiiResult CreateImage (const D3D12_RESOURCE_DESC &resourceDescription, const xiiD3D12MemoryAllocationCreateInfo &allocationCreateInfo, const xiiGALOptimizedClearValue *pOptimizedClearValue, ID3D12Resource **out_ppResource, xiiD3D12Allocation *out_pAllocation)
void DestroyImage (ID3D12Resource *&pResource, xiiD3D12Allocation &pAllocation)

Friends

void * xiiD3D12AllocatePtr (size_t uiSize, size_t uiAlignment, void *pPrivateData)
 Internal implementation details.
void xiiD3D12FreePtr (void *pMemory, void *pPrivateData)

Detailed Description

Direct3D 12 memory allocator wrapper.

Provides high-level allocation and resource management for D3D12 buffers and images. Internally wraps D3D12 Memory Allocator (D3D12MA) and custom logic to simplify memory handling.

Member Function Documentation

◆ CreateBuffer()

xiiResult xiiD3D12MemoryAllocator::CreateBuffer ( const D3D12_RESOURCE_DESC & resourceDescription,
const xiiD3D12MemoryAllocationCreateInfo & allocationCreateInfo,
ID3D12Resource ** out_ppResource,
xiiD3D12Allocation * out_pAllocation )

Creates a D3D12 buffer resource with the specified description and memory allocation parameters.

Parameters
resourceDescription- D3D12 resource description defining the buffer properties (size, usage, etc.).
allocationCreateInfo- Parameters that control how memory should be allocated for the buffer, including heap type, flags, and optional user data.
out_ppResource- Output pointer to the created buffer resource.
out_pAllocation- Output pointer to the memory allocation info.

◆ CreateImage()

xiiResult xiiD3D12MemoryAllocator::CreateImage ( const D3D12_RESOURCE_DESC & resourceDescription,
const xiiD3D12MemoryAllocationCreateInfo & allocationCreateInfo,
const xiiGALOptimizedClearValue * pOptimizedClearValue,
ID3D12Resource ** out_ppResource,
xiiD3D12Allocation * out_pAllocation )

Creates a D3D12 image resource with the specified description and memory allocation parameters.

Parameters
resourceDescription- D3D12 resource description defining the image properties (dimensions, format, usage, etc.).
allocationCreateInfo- Parameters that control how memory should be allocated for the image including heap type, flags, and optional user data.
pOptimizedClearValue- Optional pointer to an optimized clear value for render target or depth stencil images, which can improve clear performance.
out_ppResource- Output pointer to the created image resource.
out_pAllocation- Output pointer to the memory allocation info.

◆ DestroyBuffer()

void xiiD3D12MemoryAllocator::DestroyBuffer ( ID3D12Resource *& pResource,
xiiD3D12Allocation & pAllocation )

Destroys a D3D12 buffer resource and frees its associated memory allocation.

Parameters
pResource- Pointer to the buffer resource to destroy.
pAllocation- The memory allocation info for the buffer.

◆ DestroyImage()

void xiiD3D12MemoryAllocator::DestroyImage ( ID3D12Resource *& pResource,
xiiD3D12Allocation & pAllocation )

Destroys a D3D12 image resource and frees its associated memory allocation.

Parameters
pResource- Pointer to the image resource to destroy.
pAllocation- The memory allocation info for the image.

◆ Initialize()

xiiResult xiiD3D12MemoryAllocator::Initialize ( xiiGALDeviceD3D12 * pDeviceD3D12,
xiiUInt32 uiPreferredBlockSize = 0U )

Constructs the memory allocator with D3D12 device.

Parameters
pDeviceD3D12- The D3D12 device implementation.
uiPreferredBlockSize- Optional preferred block size for allocations (Set to 0 to use default, which is currently 64 MiB.).

The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/GraphicsD3D12/MemoryAllocator/MemoryAllocatorD3D12.h
  • /home/runner/work/XII/XII/Source/Engine/GraphicsD3D12/MemoryAllocator/Implementation/MemoryAllocatorD3D12.cpp