Function createTyped

Summary

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

(1) static SharedPtr createTyped(ResourceFormat format, uint32_t elementCount, Resource::BindFlags bindFlags=Resource::BindFlags::ShaderResource|Resource::BindFlags::UnorderedAccess, CpuAccess cpuAccess=Buffer::CpuAccess::None, const void *pInitData=nullptr)

(2) template <typename T>
    static SharedPtr createTyped(uint32_t elementCount, Resource::BindFlags bindFlags=Resource::BindFlags::ShaderResource|Resource::BindFlags::UnorderedAccess, CpuAccess cpuAccess=Buffer::CpuAccess::None, const T *pInitData=nullptr)

Function overload

Synopsis

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

static SharedPtr createTyped(ResourceFormat format, uint32_t elementCount, Resource::BindFlags bindFlags=Resource::BindFlags::ShaderResource|Resource::BindFlags::UnorderedAccess, CpuAccess cpuAccess=Buffer::CpuAccess::None, const void *pInitData=nullptr)

Description

Create a new typed buffer.

Parameters:

[ in ] format - Typed buffer format.

[ in ] elementCount - Number of elements.

[ in ] bindFlags - Buffer bind flags.

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

[ in ] pInitData - Optional parameter. Initial buffer data. Pointed buffer should hold at least 'elementCount' elements.

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

Source

Lines 73-82 in Source/Falcor/Core/API/Buffer.cpp. Line 87 in Source/Falcor/Core/API/Buffer.h.

Buffer::SharedPtr Buffer::createTyped(ResourceFormat format, uint32_t elementCount, BindFlags bindFlags, CpuAccess cpuAccess, const void* pInitData)
{
    size_t size = elementCount * getFormatBytesPerBlock(format);
    SharedPtr pBuffer = create(size, bindFlags, cpuAccess, pInitData);
    assert(pBuffer);
    pBuffer->mFormat = format;
    pBuffer->mElementCount = elementCount;
    return pBuffer;
}

Synopsis

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

template <typename T>
static SharedPtr createTyped(uint32_t elementCount, Resource::BindFlags bindFlags=Resource::BindFlags::ShaderResource|Resource::BindFlags::UnorderedAccess, CpuAccess cpuAccess=Buffer::CpuAccess::None, const T *pInitData=nullptr)

Description

Create a new typed buffer. The format is deduced from the template parameter.

Parameters:

[ in ] elementCount - Number of elements.

[ in ] bindFlags - Buffer bind flags.

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

[ in ] pInitData - Optional parameter. Initial buffer data. Pointed buffer should hold at least 'elementCount' elements.

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

Source

Lines 101-109 in Source/Falcor/Core/API/Buffer.h.

template<typename T>
static SharedPtr createTyped(
    uint32_t elementCount,
    Resource::BindFlags bindFlags = Resource::BindFlags::ShaderResource | Resource::BindFlags::UnorderedAccess,
    CpuAccess cpuAccess = Buffer::CpuAccess::None,
    const T* pInitData = nullptr)
{
    return createTyped(FormatForElementType<T>::kFormat, elementCount, bindFlags, cpuAccess, pInitData);
}





Add Discussion as Guest

Log in to DocsForge