|
Cogs.Core
|
Public Types | |
| enum struct | BufferType { Vertex , Index , Constant , Unclassified , Count } |
Public Member Functions | |
| virtual VertexFormatHandle | createVertexFormat (const VertexElement *elements, size_t count) override |
| virtual const VertexFormat * | getVertexFormat (VertexFormatHandle handle) override |
| virtual VertexArrayObjectHandle | loadVertexArrayObject (const EffectHandle effectHandle, const VertexBufferHandle *vertexBufferHandles, const size_t vertexBufferCount, const VertexFormat *const *vertexFormats=nullptr, const uint32_t *vertexBufferStrides=nullptr, const uint32_t *vertexBufferOffsets=nullptr, const IndexBufferHandle indexBufferHandle=IndexBufferHandle::NoHandle, uint32_t indexBufferStride=0) override |
| virtual void | releaseVertexArrayObject (VertexArrayObjectHandle) override |
| void | recordBufferCreate (BufferHandle handle, BindFlags::EBindFlags bindFlags, size_t bytes) |
| void | recordBufferRelease (BufferHandle handle, BindFlags::EBindFlags bindFlags, size_t bytes) |
| void | updateResourceStatistics (ResourceStatistics &stats) const |
Public Member Functions inherited from Cogs::IBuffers | |
| virtual void | annotate (BufferHandle handle, const StringView &name) |
| Associate a name with an object for use in graphics debugging. | |
| virtual void | annotate (VertexBufferHandle handle, const StringView &name) |
| Associate a name with an object for use in graphics debugging. | |
| virtual VertexBufferHandle | loadVertexBuffer (const void *vertexData, const size_t count, const VertexFormat &vertexFormat)=0 |
| Loads a new vertex buffer and populates it with the given data. | |
| virtual VertexBufferHandle | loadVertexBuffer (const void *vertexData, const size_t count, VertexFormatHandle vertexFormatHandle)=0 |
| virtual void | releaseVertexBuffer (VertexBufferHandle vertexBufferHandle)=0 |
| Release the vertex buffer with the given handle. | |
| virtual IndexBufferHandle | loadIndexBuffer (const void *indexData, const size_t count, const size_t indexSize)=0 |
| Loads a new index buffer and populates it with the given indexData. | |
| virtual void | releaseIndexBuffer (IndexBufferHandle indexBufferHandle)=0 |
| Releases the index buffer with the given handle. | |
| virtual VertexArrayObjectHandle | loadVertexArrayObject (const EffectHandle effectHandle, const VertexBufferHandle *vertexBufferHandles, const size_t vertexBufferCount, const VertexFormat *const *vertexFormats=nullptr, const uint32_t *vertexBufferStrides=nullptr, const uint32_t *vertexBufferOffsets=nullptr, const IndexBufferHandle indexBufferHandle=IndexBufferHandle::NoHandle, uint32_t indexBufferStride=0)=0 |
| Create a vertex array object that encapsulates binding of a set of vertex buffers and an optional index buffer. | |
| virtual void | releaseVertexArrayObject (VertexArrayObjectHandle vertexArrayObjectHandle)=0 |
| Releases the vertex array object with the given handle. | |
| virtual InputLayoutHandle | loadInputLayout (const VertexFormatHandle *vertexFormats, const size_t count, EffectHandle effectHandle)=0 |
| Loads a new input layout to map vertex flow between vertex buffers with the given vertexFormats to effects using the vertex layout of the given effectHandle. | |
| virtual void | releaseInputLayout (InputLayoutHandle inputLayoutHandle)=0 |
| Releases the input layout with the given inputLayoutHandle. | |
| virtual BufferHandle | loadBuffer (const void *data, const size_t size, Usage::EUsage usage, uint32_t accessMode, uint32_t bindFlags, uint32_t stride=0)=0 |
| Loads a new buffer using the given data to populate the buffer. | |
| virtual VertexFormatHandle | createVertexFormat (const VertexElement *elements, size_t count)=0 |
| virtual const VertexFormat * | getVertexFormat (VertexFormatHandle handle)=0 |
| virtual void | retrieveSubBuffer (void *data, BufferHandle source, const size_t offset, const size_t size)=0 |
| Retrieves the contents of a buffer. | |
| virtual void | releaseBuffer (BufferHandle bufferHandle)=0 |
| Releases the buffer with the given bufferHandle. | |
| virtual void * | getNativeHandle (BufferHandle bufferHandle)=0 |
| Get the device-specific handle (D3D buffer pointer, OpenGL buffer ID etc) associated with the given buffer handle. | |
| virtual void | releaseResources ()=0 |
| Releases all allocated buffer resources. | |
Public Attributes | |
| struct { | |
| std::atomic< size_t > bytes = 0 | |
| std::atomic< uint32_t > count = 0 | |
| } | bufferStats [size_t(BufferType::Count)] |
Definition at line 11 of file BuffersCommon.h.
|
strong |
Definition at line 44 of file BuffersCommon.h.
|
overridevirtual |
Implements Cogs::IBuffers.
Definition at line 28 of file BuffersCommon.cpp.
|
overridevirtual |
Implements Cogs::IBuffers.
Definition at line 33 of file BuffersCommon.cpp.
|
overridevirtual |
Logs an unsupported error, override to provide support.
Implements Cogs::IBuffers.
Reimplemented in Cogs::BuffersGLES30.
Definition at line 38 of file BuffersCommon.cpp.
References Cogs::Handle_t< VertexArrayObjectTag >::InvalidHandle.
| void Cogs::BuffersCommon::recordBufferCreate | ( | BufferHandle | handle, |
| BindFlags::EBindFlags | bindFlags, | ||
| size_t | bytes | ||
| ) |
Records a new buffer created
| handle | A valid handle to the created buffer. |
| bindFlags | The bindflags of the buffer. |
| bytes | The size of the buffer. |
Definition at line 52 of file BuffersCommon.cpp.
Referenced by Cogs::BuffersWebGPU::loadBuffer().
| void Cogs::BuffersCommon::recordBufferRelease | ( | BufferHandle | handle, |
| BindFlags::EBindFlags | bindFlags, | ||
| size_t | bytes | ||
| ) |
Records an existing buffer is released.
| handle | A valid handle to the buffer that is released. |
| bindFlags | The bindflags of the buffer, must match the ones passed to recordBufferCreate. |
| bytes | The size of the buffer, must match the size passed to recordBufferCreate. |
Definition at line 60 of file BuffersCommon.cpp.
Referenced by Cogs::BuffersWebGPU::releaseBuffer().
|
overridevirtual |
Logs an unsupported error, override to provide support.
Implements Cogs::IBuffers.
Reimplemented in Cogs::BuffersGLES30.
Definition at line 47 of file BuffersCommon.cpp.
| void Cogs::BuffersCommon::updateResourceStatistics | ( | ResourceStatistics & | stats | ) | const |
Populates the buffer-related fields of stats with the currently tracked per-type buffer counts and byte sizes.
Definition at line 68 of file BuffersCommon.cpp.
| std::atomic<size_t> Cogs::BuffersCommon::bytes = 0 |
Definition at line 52 of file BuffersCommon.h.
| std::atomic<uint32_t> Cogs::BuffersCommon::count = 0 |
Definition at line 53 of file BuffersCommon.h.