5 assert(bytes.size() >= (offset +
size) &&
"Buffer offset + size out of range.");
7 std::memcpy((
char *)bytes.data() + offset,
data,
size);
30 bytes.reset(size, allocator);
50 invalidate(0, size());
Base allocator implementation.
void setChanged(Cogs::Core::Context *context, Cogs::ComponentModel::Component *component, Reflection::FieldId fieldId)
Must be Called after changing a Component field. Mark field changed. Request engine update.
@ Mapped
Buffer data is mapped by client code.
void unmap()
Unmap the buffer, signaling writes to mapped buffer memory are done.
void invalidate(size_t offset, size_t size)
Invalidates buffer contents, signaling data should be updated/transfered to GPU.
void * map(uint32_t flags)
Map the buffer data backing storage, returning a writable pointer.
void resize(size_t size)
Resize the buffer to accomodate the given number of bytes.
size_t size() const
Size of the buffer in bytes.
void set(size_t offset, size_t size, const uint8_t *data)
void reset(size_t size, Memory::Allocator *allocator)
Reset the buffer, resizing to size bytes using the given allocator.
void * data()
Get a pointer to the buffer data.