Skip to content

LiteFX::Rendering::ResourceHeap

Defines where a resource (buffer or image) memory is located and from where it can be accessed.

Synopsis

Declared in <litefx/rendering_api.hpp>

enum class ResourceHeap : int;

Description

There are three common memory usage scenarios that are supported by the engine:

  1. Static resources: such as vertex/index/constant buffers, textures or other infrequently updated buffers. In this case, the most efficient approach is to create a buffer using ResourceHeap::Staging and map it from the CPU. Create a second buffer using ResourceHeap::Resource and transfer the staging buffer into it. 2. Dynamic resources: such as deformable meshes or buffers that need to be updated every frame. For such buffers use the ResourceHeap::Dynamic mode to prevent regular transfer overhead. 3. Readbacks: or resources that are written on the GPU and read by the CPU. The usage mode ResourceHeap::Readback is designed to provide the best performance for this special case.

Note that image resources cannot be created on heaps different to ResourceHeap::Resource. For this very reason, the graphics factory does not allow to specify the resource heap when creating images or attachments.

Members

NameDescription
Staging Creates a resource that can be mapped from the CPU in order to be transferred to the GPU later.
Resource Creates a resource that can be read by the GPU.
Dynamic Creates a resource that can be mapped from the CPU and read by the GPU.
Readback Creates a buffer that can be written on the GPU and read by the CPU.
GPUUpload Creates a buffer that is directly allocated in GPU memory, but that can be efficiently written from the CPU.

See Also

IGraphicsFactory

IBuffer