Function adjustSizeOffsetParams

Synopsis

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

bool adjustSizeOffsetParams(size_t &size, size_t &offset) const

Description

Get safe offset and size values

Source

Lines 251-265 in Source/Falcor/Core/API/Buffer.h.

bool adjustSizeOffsetParams(size_t& size, size_t& offset) const
{
    if (offset >= mSize)
    {
        logWarning("Buffer::adjustSizeOffsetParams() - offset is larger than the buffer size.");
        return false;
    }
    if (offset + size > mSize)
    {
        logWarning("Buffer::adjustSizeOffsetParams() - offset + size will cause an OOB access. Clamping size");
        size = mSize - offset;
    }
    return true;
}





Add Discussion as Guest

Log in to DocsForge