|
Cogs.Core
|
Public Member Functions | |
| void | initialize (struct GraphicsDeviceD3D12 *graphicsDevice) |
| VertexBufferHandle | loadVertexBuffer (const void *vertexData, const size_t count, const VertexFormat &vertexFormat) override |
| Loads a new vertex buffer and populates it with the given data. | |
| VertexBufferHandle | loadVertexBuffer (const void *vertexData, const size_t count, VertexFormatHandle vertexFormat) override |
| void | releaseVertexBuffer (VertexBufferHandle vertexBufferHandle) |
| Release the vertex buffer with the given handle. | |
| IndexBufferHandle | loadIndexBuffer (const void *vertexData, const size_t count, const size_t indexSize) |
| Loads a new index buffer and populates it with the given indexData. | |
| void | releaseIndexBuffer (IndexBufferHandle indexBufferHandle) |
| Releases the index buffer with the given handle. | |
| InputLayoutHandle | loadInputLayout (const VertexFormatHandle *vertexFormats, const size_t count, EffectHandle effectHandle) |
| 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. | |
| void | releaseInputLayout (InputLayoutHandle vertexFormatHandle) |
| Releases the input layout with the given inputLayoutHandle. | |
| BufferHandle | loadBuffer (const void *data, const size_t size, Usage::EUsage usage, uint32_t accessMode, uint32_t bindFlags, uint32_t stride=0) |
| Loads a new buffer using the given data to populate the buffer. | |
| void | releaseBuffer (BufferHandle bufferHandle) |
| Releases the buffer with the given bufferHandle. | |
| void | retrieveSubBuffer (void *data, BufferHandle source, const size_t offset, const size_t size) |
| Retrieves the contents of a buffer. | |
| void * | getNativeHandle (BufferHandle bufferHandle) override |
| Get the device-specific handle (D3D buffer pointer, OpenGL buffer ID etc) associated with the given buffer handle. | |
| void | releaseResources () |
| Releases all allocated buffer resources. | |
| BufferPool & | getBufferPool (const size_t size, uint32_t bindFlags=0) |
| void | releaseBufferInternal (BufferHandle bufferHandle) |
| void | allocateBuffer (ResourceD3D12 &resource, size_t size, const void *data=nullptr) |
Public Member Functions inherited from Cogs::BuffersCommon | |
| 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 |
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 GraphicsDeviceD3D12 * | graphicsDevice |
| ResourceMap< BufferHandle, BufferD3D12 > | buffers |
| ResourceMap< InputLayoutHandle, InputLayoutD3D12 > | inputLayouts |
| std::unordered_map< size_t, VertexFormat > | vertexFormats |
Private Attributes | |
| BufferPool | bufferPool256 |
| BufferPool | bufferPool1024 |
| ResourcePointer< ID3D12Device > | device |
| struct EffectsD3D12 * | effects |
Definition at line 96 of file BuffersD3D12.h.
| void Cogs::BuffersD3D12::allocateBuffer | ( | ResourceD3D12 & | resource, |
| size_t | size, | ||
| const void * | data = nullptr |
||
| ) |
Definition at line 394 of file BuffersD3D12.cpp.
| Cogs::BufferPool & Cogs::BuffersD3D12::getBufferPool | ( | const size_t | size, |
| uint32_t | bindFlags = 0 |
||
| ) |
Definition at line 368 of file BuffersD3D12.cpp.
|
overridevirtual |
Get the device-specific handle (D3D buffer pointer, OpenGL buffer ID etc) associated with the given buffer handle.
| bufferHandle | Valid handle to a previously created buffer object. |
Implements Cogs::IBuffers.
Definition at line 358 of file BuffersD3D12.cpp.
| void Cogs::BuffersD3D12::initialize | ( | struct GraphicsDeviceD3D12 * | graphicsDevice | ) |
Definition at line 79 of file BuffersD3D12.cpp.
|
virtual |
Loads a new buffer using the given data to populate the buffer.
| data | Pointer to data used to populate the buffer. Must be at least size number of bytes. |
| size | Size of the buffer to create in bytes. |
| usage | Usage flags for the buffer. Specifies how the buffer is intended to be used. |
| accessMode | Access mode flags for the buffer. Specifies how the buffer can be accessed at a later time. |
| bindFlags | Binding flags specifying how the buffer can be bound to the pipeline at a later state. |
Implements Cogs::IBuffers.
Definition at line 222 of file BuffersD3D12.cpp.
References Cogs::BindFlags::ConstantBuffer, Cogs::AccessMode::None, Cogs::BindFlags::None, Cogs::BindFlags::RawBuffer, Cogs::AccessMode::Read, Cogs::BindFlags::StructuredBuffer, Cogs::BindFlags::StructuredBufferWithCounter, and Cogs::AccessMode::Write.
|
virtual |
Loads a new index buffer and populates it with the given indexData.
The size of the buffer (if given) must be at least indexSize * count.
| indexData | Pointer to index data in memory, or nullptr to initialize an empty index buffer. |
| count | Number of indexes given. |
| indexSize | Size of an index in bytes. |
Implements Cogs::IBuffers.
Definition at line 124 of file BuffersD3D12.cpp.
References Cogs::BindFlags::IndexBuffer.
|
virtual |
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.
| vertexFormats | Pointer to an array of pointers to vertex formats. One for each vertex buffer that in sum describes total vertex data. |
| count | Number of vertex formats given. |
| effectHandle | Handle to a valid effect containing a valid vertex shader. The input requirements of the vertex shader is used to specify the flow of vertex data from the vertex buffer(s) specified by vertexFormats into the shader stage. |
Implements Cogs::IBuffers.
Definition at line 146 of file BuffersD3D12.cpp.
References Cogs::VertexFormat::elements, Cogs::VertexElement::format, Cogs::Direct3D12::Formats, Cogs::VertexElement::inputType, Cogs::InstanceMatrix, Cogs::VertexElement::instanceStep, Cogs::Handle_t< InputLayoutTag >::InvalidHandle, Cogs::VertexElement::offset, Cogs::VertexElement::semantic, Cogs::VertexElement::semanticIndex, and Cogs::VertexData.
|
overridevirtual |
Loads a new vertex buffer and populates it with the given data.
The size of the buffer (if given) must be at least the size of a vertex in the given vertexFormat times count.
| vertexData | Pointer to vertex data in memory, or nullptr to initialize an empty vertex buffer. |
| count | Number of vertexes in the vertex data. |
| vertexFormat | Format of the vertexes in the given memory buffer. |
Implements Cogs::IBuffers.
Definition at line 89 of file BuffersD3D12.cpp.
References Cogs::VertexFormat::elements, and Cogs::BindFlags::VertexBuffer.
|
overridevirtual |
Implements Cogs::IBuffers.
Definition at line 114 of file BuffersD3D12.cpp.
|
virtual |
Releases the buffer with the given bufferHandle.
| bufferHandle | Valid handle to a previously created buffer. |
Implements Cogs::IBuffers.
Definition at line 348 of file BuffersD3D12.cpp.
| void Cogs::BuffersD3D12::releaseBufferInternal | ( | BufferHandle | bufferHandle | ) |
Definition at line 381 of file BuffersD3D12.cpp.
|
virtual |
Releases the index buffer with the given handle.
| indexBufferHandle | Valid handle to a previously created index buffer. |
Implements Cogs::IBuffers.
Definition at line 141 of file BuffersD3D12.cpp.
|
virtual |
Releases the input layout with the given inputLayoutHandle.
| inputLayoutHandle | Valid handle to a previously created index buffer. |
Implements Cogs::IBuffers.
Definition at line 217 of file BuffersD3D12.cpp.
|
virtual |
Releases all allocated buffer resources.
Implements Cogs::IBuffers.
Definition at line 363 of file BuffersD3D12.cpp.
|
virtual |
Release the vertex buffer with the given handle.
The data is removed from GPU memory.
| vertexBufferHandle | Valid handle to a previously created vertex buffer. |
Implements Cogs::IBuffers.
Definition at line 119 of file BuffersD3D12.cpp.
|
virtual |
Retrieves the contents of a buffer.
| data | Pointer to where the data should be stored. |
| offset | The offset in bytes inside the buffer from where to retrieve data. |
| size | The number of bytes to retrieve from the buffer. |
Implements Cogs::IBuffers.
Definition at line 353 of file BuffersD3D12.cpp.
|
private |
Definition at line 133 of file BuffersD3D12.h.
|
private |
Definition at line 132 of file BuffersD3D12.h.
| ResourceMap<BufferHandle, BufferD3D12> Cogs::BuffersD3D12::buffers |
Definition at line 124 of file BuffersD3D12.h.
|
private |
Definition at line 135 of file BuffersD3D12.h.
|
private |
Definition at line 137 of file BuffersD3D12.h.
| struct GraphicsDeviceD3D12* Cogs::BuffersD3D12::graphicsDevice |
Definition at line 100 of file BuffersD3D12.h.
| ResourceMap<InputLayoutHandle, InputLayoutD3D12> Cogs::BuffersD3D12::inputLayouts |
Definition at line 125 of file BuffersD3D12.h.
| std::unordered_map<size_t, VertexFormat> Cogs::BuffersD3D12::vertexFormats |
Definition at line 127 of file BuffersD3D12.h.