SleakEngine 0.1.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Sleak::RenderEngine::DirectX12UploadContext Class Reference

#include <DirectX12UploadContext.hpp>

Public Member Functions

 DirectX12UploadContext ()=default
 DirectX12UploadContext (const DirectX12UploadContext &)=delete
 ~DirectX12UploadContext ()
void * AllocateStaging (uint64_t size, ID3D12Resource **resource)
 Returns a mapped upload buffer that lives until the open batch is done.
void Flush ()
 Submits and blocks until every batch has finished on the GPU.
ID3D12GraphicsCommandList * GetCommandList ()
 Returns the open copy command list, starting a new batch if needed.
bool Initialize (ID3D12Device *device, ID3D12CommandQueue *queue)
 Creates the fence used to track submitted batches.
DirectX12UploadContext & operator= (const DirectX12UploadContext &)=delete
void Release ()
 Flushes outstanding work and frees everything.
void Retire ()
 Frees staging memory of batches the GPU has finished.
void Submit ()
 Executes the recorded copies without waiting for them.

Detailed Description

Batches CPU to GPU copies into one command list on the direct queue. Staging memory is freed once the batch that used it is done on the GPU.

Definition at line 15 of file DirectX12UploadContext.hpp.

Constructor & Destructor Documentation

◆ DirectX12UploadContext() [1/2]

Sleak::RenderEngine::DirectX12UploadContext::DirectX12UploadContext ( )
default

◆ ~DirectX12UploadContext()

Sleak::RenderEngine::DirectX12UploadContext::~DirectX12UploadContext ( )
inline

Definition at line 18 of file DirectX12UploadContext.hpp.

◆ DirectX12UploadContext() [2/2]

Sleak::RenderEngine::DirectX12UploadContext::DirectX12UploadContext ( const DirectX12UploadContext & )
delete

Member Function Documentation

◆ AllocateStaging()

void * Sleak::RenderEngine::DirectX12UploadContext::AllocateStaging ( uint64_t size,
ID3D12Resource ** resource )

Returns a mapped upload buffer that lives until the open batch is done.

Definition at line 72 of file DirectX12UploadContext.cpp.

◆ Flush()

void Sleak::RenderEngine::DirectX12UploadContext::Flush ( )

Submits and blocks until every batch has finished on the GPU.

Definition at line 134 of file DirectX12UploadContext.cpp.

◆ GetCommandList()

ID3D12GraphicsCommandList * Sleak::RenderEngine::DirectX12UploadContext::GetCommandList ( )

Returns the open copy command list, starting a new batch if needed.

Definition at line 33 of file DirectX12UploadContext.cpp.

◆ Initialize()

bool Sleak::RenderEngine::DirectX12UploadContext::Initialize ( ID3D12Device * device,
ID3D12CommandQueue * queue )

Creates the fence used to track submitted batches.

Definition at line 8 of file DirectX12UploadContext.cpp.

◆ operator=()

DirectX12UploadContext & Sleak::RenderEngine::DirectX12UploadContext::operator= ( const DirectX12UploadContext & )
delete

◆ Release()

void Sleak::RenderEngine::DirectX12UploadContext::Release ( )

Flushes outstanding work and frees everything.

Definition at line 157 of file DirectX12UploadContext.cpp.

◆ Retire()

void Sleak::RenderEngine::DirectX12UploadContext::Retire ( )

Frees staging memory of batches the GPU has finished.

Definition at line 144 of file DirectX12UploadContext.cpp.

◆ Submit()

void Sleak::RenderEngine::DirectX12UploadContext::Submit ( )

Executes the recorded copies without waiting for them.

Definition at line 113 of file DirectX12UploadContext.cpp.