Skip to content

Resource Management

Toby Chen edited this page May 29, 2019 · 2 revisions

Resource Management

Resources can be divided into two major types: buffer and image. Images are more complicated since the GPU does format magic under the hood, but the memory allocation and update strategies are similar.

Buffer

You must supply RHI with how you are going to use the buffer upon creation. The usage flags consist of two aspects: the pipeline binding points, and the update pattern (or accessibility).

enum class EBufferUsageFlags : uint32_t
{
    // Binding flags
    Index = 1 << 0,
    Vertex = 1 << 1,
    IndirectDraw = 1 << 2,
    Uniform = 1 << 3,
    Storage = 1 << 4, // GPU writable
    UniformTexel = 1 << 5,
    StorageTexel = 1 << 6, // GPU writable

    // Accessibility flags, if unspecified, optimize for GPU read/write and CPU inaccessible
    Dynamic = 1 << 16, // Allows frequent CPU writes
    Upload = 1 << 17, // CPU write optimized, GPU inaccessible except copying
    Readback = 1 << 18  // CPU read optimized, GPU inaccessible except copying
};

Image

Clone this wiki locally