Buffer
The Buffer class represents a GPU buffer resource that can be used for a wide range of data storage and access patterns. It supports creation with various flags that define its usage, such as read/write access, dynamic allocation, sharing, mapping, uniform or storage usage, vertex or index roles, and more. The class provides methods to create, clear, and query the buffer state, including platform type, format, size, and associated flags. The Buffer class is a versatile and foundational component for managing memory on the GPU.
#include <platform/TellusimBuffer.h>
Constructors
Buffer()
Methods
Buffer platform.
Platform getPlatform() const
const char *getPlatformName() const
Buffer device index.
uint32_t getIndex() const
Clear buffer.
void clear()
Check buffer.
bool isCreated() const
Buffer name.
void setName(const char *name)
String getName() const
Create buffer.
bool create(Flags flags, size_t size, Format format = FormatUnknown)
bool isMapped() const
Buffer flags.
Flags getFlags() const
bool hasFlag(Flags flags) const
bool hasFlags(Flags flags) const
String getFlagsName() const
Buffer format.
Format getFormat() const
const char *getFormatName() const
uint32_t getComponents() const
uint32_t getPixelSize() const
Buffer size.
size_t getSize()
Sparse buffer page size.
size_t getPageSize()
Buffer description.
String getDescription() const
Enums
Flags
Buffer flags.
Name | Value | Description |
---|---|---|
FlagNone | 0 | |
FlagRead | (1 << 0) | Read buffer. |
FlagWrite | (1 << 1) | Write buffer. |
FlagSource | (1 << 2) | Source buffer. |
FlagSparse | (1 << 3) | Sparse buffer. |
FlagShared | (1 << 4) | Shared buffer. |
FlagMapped | (1 << 5) | Mapped buffer. |
FlagExtern | (1 << 6) | Extern buffer. |
FlagInterop | (1 << 7) | Interop buffer. |
FlagDynamic | (1 << 8) | Dynamic buffer. |
FlagUniform | (1 << 9) | Uniform buffer. |
FlagStorage | (1 << 10) | Storage buffer. |
FlagAddress | (1 << 11) | Address buffer. |
FlagTracing | (1 << 12) | Tracing buffer. |
FlagScratch | (1 << 13) | Scratch buffer. |
FlagBinding | (1 << 14) | Binding buffer. |
FlagIndirect | (1 << 15) | Indirect buffer. |
FlagConditional | (1 << 16) | Conditional buffer. |
FlagVertex | (1 << 17) | Vertex buffer. |
FlagIndex | (1 << 18) | Index buffer. |
FlagTexel | (1 << 19) | Texel buffer. |
FlagAccel | (1 << 20) | Accel buffer. |
DefaultFlags | FlagNone | |
NumFlags | 21 |