Function getElementSize


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

uint32_t getElementSize() const


Get the size of each element in this buffer.

For a typed buffer, this will be the size of the format. For a structured buffer, this will be the same value as getStructSize(). For a raw buffer, this will be the number of bytes.


Lines 332-338 in Source/Falcor/Core/API/Buffer.cpp. Line 213 in Source/Falcor/Core/API/Buffer.h.

uint32_t Buffer::getElementSize() const
    if (mStructSize != 0) return mStructSize;
    if (mFormat == ResourceFormat::Unknown) return 1;
    throw std::exception("Buffer::getElementSize() - inferring element size from resourec format is unimplemented");

Add Discussion as Guest

Log in