Foundation
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Foundation::RenderCore::ImmediateUpload Struct Reference

Single persistent staging buffer + immediate context for quick, batchable uploads. More...

#include <ImmediateContext.hpp>

Public Member Functions

 ImmediateUpload (RHIDevice *device, size_t capacity)
 
void Begin ()
 
charUpload (RHIBuffer *dst, size_t dataSize, size_t dstOffset)
 
charUpload (RHITexture *dst, size_t dataSize, RHITextureSubresourceLayer dstLayer={.aspect=RHITextureAspectFlagBits::Color}, RHIOffset2D dstOffset={}, RHIExtent2D dstExtent={})
 
bool Align (uint32_t alignment)
 
void End (RHIDeviceFence *completionFence=nullptr)
 
void WaitIdle ()
 

Public Attributes

ImmediateContext ctx
 
RHIDeviceScopedHandle< RHIBufferstaging
 
charbegin
 
charptr
 
charend
 

Detailed Description

Single persistent staging buffer + immediate context for quick, batchable uploads.

Constructor & Destructor Documentation

◆ ImmediateUpload()

Foundation::RenderCore::ImmediateUpload::ImmediateUpload ( RHIDevice device,
size_t  capacity 
)
inline

Member Function Documentation

◆ Align()

bool Foundation::RenderCore::ImmediateUpload::Align ( uint32_t  alignment)

◆ Begin()

void Foundation::RenderCore::ImmediateUpload::Begin ( )

Resets the upload context for a new series of uploads. This MUST be called before any Upload calls.

◆ End()

void Foundation::RenderCore::ImmediateUpload::End ( RHIDeviceFence completionFence = nullptr)

Finalizes the upload context, submitting the copy commands.

Parameters
completionFenceOptional fence to signal upon completion.

◆ Upload() [1/2]

char * Foundation::RenderCore::ImmediateUpload::Upload ( RHIBuffer dst,
size_t  dataSize,
size_t  dstOffset 
)

Uploads data to dst buffer with a staging copy.

Returns
nullptr when upload fails (out of staging memory). At which point, a flush with End() -> WaitIdle() -> Begin() is required. A mapped, writable pointer to the staging memory where the buffer data is expected to be written otherwise.

◆ Upload() [2/2]

char * Foundation::RenderCore::ImmediateUpload::Upload ( RHITexture dst,
size_t  dataSize,
RHITextureSubresourceLayer  dstLayer = {.aspect = RHITextureAspectFlagBits::Color},
RHIOffset2D  dstOffset = {},
RHIExtent2D  dstExtent = {} 
)

Uploads data to dst texture with a staging copy.

Returns
nullptr when upload fails (out of staging memory). At which point, a flush with End() -> WaitIdle() -> Begin() is required. A mapped, writable pointer to the staging memory where the texture data is expected to be written otherwise.

◆ WaitIdle()

void Foundation::RenderCore::ImmediateUpload::WaitIdle ( )

Member Data Documentation

◆ begin

char* Foundation::RenderCore::ImmediateUpload::begin

◆ ctx

ImmediateContext Foundation::RenderCore::ImmediateUpload::ctx

◆ end

char * Foundation::RenderCore::ImmediateUpload::end

◆ ptr

char * Foundation::RenderCore::ImmediateUpload::ptr

◆ staging

RHIDeviceScopedHandle<RHIBuffer> Foundation::RenderCore::ImmediateUpload::staging

The documentation for this struct was generated from the following files: