Function updateBuffer

Synopsis

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

void updateBuffer(const Buffer *pBuffer, const void *pData, size_t offset=0, size_t numBytes=0)

Description

Update a buffer

Source

Lines 163-181 in Source/Falcor/Core/API/CopyContext.cpp. Line 122 in Source/Falcor/Core/API/CopyContext.h.

void CopyContext::updateBuffer(const Buffer* pBuffer, const void* pData, size_t offset, size_t numBytes)
{
    if (numBytes == 0)
    {
        numBytes = pBuffer->getSize() - offset;
    }
    if (pBuffer->adjustSizeOffsetParams(numBytes, offset) == false)
    {
        logWarning("CopyContext::updateBuffer() - size and offset are invalid. Nothing to update.");
        return;
    }
    mCommandsPending = true;
    // Allocate a buffer on the upload heap
    Buffer::SharedPtr pUploadBuffer = Buffer::create(numBytes, Buffer::BindFlags::None, Buffer::CpuAccess::Write, pData);
    copyBufferRegion(pBuffer, offset, pUploadBuffer.get(), 0, numBytes);
}





Add Discussion as Guest

Log in to DocsForge