Function create


#include <Source/Falcor/Core/API/Buffer.h>

static SharedPtr create(size_t size, Resource::BindFlags bindFlags=Resource::BindFlags::ShaderResource|Resource::BindFlags::UnorderedAccess, CpuAccess cpuAccess=Buffer::CpuAccess::None, const void *pInitData=nullptr)


Create a new buffer.


[ in ] size - Size of the buffer in bytes.

[ in ] bindFlags - Buffer bind flags.

[ in ] cpuAccess - Flags indicating how the buffer can be updated.

[ in ] pInitData - Optional parameter. Initial buffer data. Pointed buffer size should be at least 'size' bytes.

A pointer to a new buffer object, or throws an exception if creation failed.


Lines 65-71 in Source/Falcor/Core/API/Buffer.cpp. Line 73 in Source/Falcor/Core/API/Buffer.h.

Buffer::SharedPtr Buffer::create(size_t size, BindFlags bindFlags, CpuAccess cpuAccess, const void* pInitData)
    Buffer::SharedPtr pBuffer = SharedPtr(new Buffer(size, bindFlags, cpuAccess));
    pBuffer->apiInit(pInitData != nullptr);
    if (pInitData) pBuffer->setBlob(pInitData, 0, size);
    return pBuffer;

Add Discussion as Guest

Log in to DocsForge