Function setBlob

Synopsis

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

bool setBlob(const void *pData, size_t offset, size_t size)

Description

Update the buffer's data

Parameters:

[ in ] pData - Pointer to the source data.

[ in ] offset - Byte offset into the destination buffer, indicating where to start copy into.

[ in ] size - Number of bytes to copy. If offset and size will cause an out-of-bound access to the buffer, an error will be logged and the update will fail.

Source

Lines 233-251 in Source/Falcor/Core/API/Buffer.cpp. Line 205 in Source/Falcor/Core/API/Buffer.h.

bool Buffer::setBlob(const void* pData, size_t offset, size_t size)
{
    if (offset + size > mSize)
    {
        logError("Error when setting blob to buffer. Blob to large and will result in an overflow. Ignoring call");
        return false;
    }
    if (mCpuAccess == CpuAccess::Write)
    {
        uint8_t* pDst = (uint8_t*)map(MapType::WriteDiscard) + offset;
        std::memcpy(pDst, pData, size);
    }
    else
    {
        gpDevice->getRenderContext()->updateBuffer(this, pData, offset, size);
    }
    return true;
}





Add Discussion as Guest

Log in to DocsForge