Skip to content

LiteFX::Rendering::IGraphicsFactory::tryCreateBuffer

Tries to create a buffer of type type.

Synopsis

Declared in <litefx/rendering_api.hpp>

[[dllimport, dllexport]] bool tryCreateBuffer(
    SharedPtr<IBuffer>& buffer,
    BufferType type,
    ResourceHeap heap,
    size_t elementSize,
    UInt32 elements = 1,
    ResourceUsage usage = ResourceUsage::Default,
    AllocationBehavior allocationBehavior = AllocationBehavior::Default) const;

Return Value

true, if the buffer was created successfully and false otherwise.

Parameters

NameDescription
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
typeThe type of the buffer.
heapThe heap to allocate the buffer on.
elementSizeThe size of an element in the buffer (in bytes).
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.