|
Cogs.Core
|
Buffer resource. More...
#include <Buffer.h>
Public Member Functions | |
| BufferResource () | |
| Construct an empty buffer resource. | |
| void | set (size_t offset, size_t size, const uint8_t *data) |
| void | invalidate (size_t offset, size_t size) |
| Invalidates buffer contents, signaling data should be updated/transfered to GPU. | |
| size_t | size () const |
| Size of the buffer in bytes. | |
| bool | empty () const |
| If the buffer is empty. Note that an empty buffer may still have reserved storage. | |
| void | resize (size_t size) |
| Resize the buffer to accomodate the given number of bytes. | |
| 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. | |
| const void * | data () const |
| Get a pointer to the buffer data. | |
| void * | map (uint32_t flags) |
| Map the buffer data backing storage, returning a writable pointer. | |
| void | unmap () |
| Unmap the buffer, signaling writes to mapped buffer memory are done. | |
| void | clear () |
| Clear the buffer contents. Note that the buffer may retain reserved storage after clearing. | |
| void | setBindFlags (uint16_t flags) |
| Set the bind flags for the buffer determining how the buffer data may be uploaded to GPU. | |
| uint16_t | getBufferFlags () const |
| Get the buffer flags. | |
| uint16_t | getBindFlags () const |
| Get the bind flags. | |
| bool | isVertexBuffer () const |
| Gets if the buffer data is usable as a vertex data. | |
| bool | isIndexBuffer () const |
| Gets if the buffer data is usable as index buffer data. | |
Public Member Functions inherited from Cogs::Core::ResourceBase | |
| ResourceBase ()=default | |
| Constructs a new resource base. | |
| ResourceBase (const ResourceBase &other)=delete | |
| Disable trivial copies of resources. | |
| ResourceBase & | operator= (const ResourceBase &other)=delete |
| Disable copy-assignment of resources. | |
| ResourceBase (ResourceBase &&other) | |
| Move constructs a resource base from other. | |
| ResourceBase & | operator= (ResourceBase &&other) |
| Move assign the resource from the given ResourceBase other. | |
| ~ResourceBase () | |
| Destructs the resource. | |
| void | setInitialized () |
| void | setChanged () |
| bool | hasChanged () const |
| void | setLoading () |
| void | setLoaded () |
| void | setFailedLoad () |
| void | setActive () |
| void | setResident () |
| void | setProxy () |
| void | setKeepStorage () |
| bool | isInitialized () const |
| bool | isLoaded () const |
| bool | isActive () const |
| bool | isResident () const |
| bool | isDependency () const |
| bool | isDeleted () const |
| bool | isOrphaned () const |
| bool | isProxy () const |
| bool | hasFailedLoad () const |
| bool | hasFailedActivation () const |
| bool | keepStorage () const |
| void | setType (ResourceTypes type) |
| Set the type enumeration of the resource. | |
| ResourceTypes | getType () const |
| Gets the type enumeration of the resource. | |
| void | setId (ResourceId resourceId) |
| Set the resource id of the resource. | |
| ResourceId | getId () const |
| Get the resource id of this instance. | |
| void | setFlag (ResourceFlags flags) |
| Set the given resource flag. | |
| void | setFlags (ResourceFlags flags) |
| void | unsetFlag (ResourceFlags flag) |
| Unset the given flag. | |
| bool | isSet (ResourceFlags flag) const |
| Check if the given flag is currently set. | |
| ResourceFlags | getFlags () const |
| Get the current flags of the resource. | |
| void | attachResource (RenderResource *attachment) |
| Attach the given GPU resource to the resource. | |
| bool | hasAttachedResource () const |
| Check if the resource has an attachment. | |
| RenderResource * | getAttachedResource () const |
| Get the attached resource. | |
| void | setOwner (IResourceManager *owner) |
| Sets the owner of this resource instance. | |
| IResourceManager * | getOwner () const |
| void | setName (const StringView &name) |
| Set the user friendly name of the resource. | |
| StringView | getName () const |
| Get the name of the resource. | |
| void | setSource (const StringView &source) |
| StringView | getSource () const |
| void | increment () |
| Increments the reference count of the resource. | |
| void | decrement () |
| Decrement the reference count of the resource. | |
| uint32_t | referenceCount () const |
| Get the current reference count. | |
| void | incrementGeneration () |
| Increment the generation count. | |
| uint32_t | getGeneration () const |
| Get the generation count. | |
| void | setSlot (uint32_t slot) |
| Sets the slot at which the resource is internally tracked. | |
| uint32_t | getSlot () const |
| Gets the slot where the resource is tracked internally. | |
Additional Inherited Members | |
Static Public Attributes inherited from Cogs::Core::ResourceBase | |
| static const uint32_t | NoAttachment = 0xFFFFFFFF |
| Constant used to signal no attachment. | |
Buffer resource.
Provides storage for untyped data, transferable to GPU/renderer.
|
inline |
|
inline |
Clear the buffer contents. Note that the buffer may retain reserved storage after clearing.
Definition at line 86 of file Buffer.h.
References Cogs::setChanged().
|
inline |
Get a pointer to the buffer data.
Definition at line 74 of file Buffer.h.
Referenced by Cogs::Core::BufferView< T >::data(), and set().
|
inline |
|
inline |
If the buffer is empty. Note that an empty buffer may still have reserved storage.
Definition at line 65 of file Buffer.h.
Referenced by Cogs::Core::BufferView< T >::empty().
|
inline |
|
inline |
| void Cogs::Core::BufferResource::invalidate | ( | size_t | offset, |
| size_t | size | ||
| ) |
Invalidates buffer contents, signaling data should be updated/transfered to GPU.
Definition at line 12 of file Buffer.cpp.
References Cogs::setChanged().
Referenced by set().
|
inline |
|
inline |
| void * Cogs::Core::BufferResource::map | ( | uint32_t | flags | ) |
Map the buffer data backing storage, returning a writable pointer.
Definition at line 35 of file Buffer.cpp.
References Cogs::Core::BufferFlags::Mapped.
Referenced by Cogs::Core::BufferView< T >::map().
| void Cogs::Core::BufferResource::reset | ( | size_t | size, |
| Memory::Allocator * | allocator | ||
| ) |
Reset the buffer, resizing to size bytes using the given allocator.
Definition at line 26 of file Buffer.cpp.
References Cogs::Core::BufferFlags::Mapped.
| void Cogs::Core::BufferResource::resize | ( | size_t | size | ) |
Resize the buffer to accomodate the given number of bytes.
Definition at line 17 of file Buffer.cpp.
References Cogs::Core::BufferFlags::Mapped.
Referenced by Cogs::Core::Mesh::mapStream(), and Cogs::Core::BufferView< T >::resize().
| void Cogs::Core::BufferResource::set | ( | size_t | offset, |
| size_t | size, | ||
| const uint8_t * | data | ||
| ) |
Set the buffer contents to the given data at the given offset. Buffer must be resized to accomodate data before use.
Definition at line 3 of file Buffer.cpp.
References data(), invalidate(), and size().
|
inline |
Set the bind flags for the buffer determining how the buffer data may be uploaded to GPU.
Definition at line 89 of file Buffer.h.
References Cogs::setChanged().
Referenced by Cogs::Core::Mesh::getStream().
|
inline |
Size of the buffer in bytes.
Definition at line 62 of file Buffer.h.
Referenced by set(), and Cogs::Core::BufferView< T >::size().
| void Cogs::Core::BufferResource::unmap | ( | ) |
Unmap the buffer, signaling writes to mapped buffer memory are done.
Definition at line 44 of file Buffer.cpp.
References Cogs::Core::BufferFlags::Mapped.
Referenced by Cogs::Core::BufferView< T >::unmap().