Cogs.Core
Public Member Functions | Public Attributes | Private Attributes | List of all members
Cogs::BuffersGLES30 Struct Reference
Inheritance diagram for Cogs::BuffersGLES30:
Cogs::BuffersCommon Cogs::IBuffers

Public Member Functions

void initialize (CapabilitiesGLES30 *capabilities, ContextGLES30 *context, EffectsGLES30 *effects)
 
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 vertexFormatHandle) override
 
void releaseVertexBuffer (VertexBufferHandle vertexBufferHandle) override
 Release the vertex buffer with the given handle.
 
IndexBufferHandle loadIndexBuffer (const void *indexData, 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) override
 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.
 
VertexArrayObjectHandle loadVertexArrayObject (const EffectHandle effectHandle, const VertexBufferHandle *vertexBufferHandles, const size_t count, const VertexFormat *const *vertexFormats=nullptr, const uint32_t *strides=nullptr, const uint32_t *offsets=nullptr, const IndexBufferHandle indexBufferHandle=IndexBufferHandle::NoHandle, uint32_t stride=4) override
 
void releaseVertexArrayObject (VertexArrayObjectHandle vertexArrayObjectHandle)
 
BufferHandle loadBuffer (const void *data, const size_t size, Usage::EUsage usage, uint32_t accessMode, uint32_t bindFlags, uint32_t stride=0) override
 Loads a new buffer using the given data to populate the buffer.
 
void releaseBuffer (BufferHandle bufferHandle)
 Releases the buffer with the given bufferHandle.
 
void releaseResources ()
 Releases all allocated buffer resources.
 
void * getNativeHandle (BufferHandle bufferHandle) override
 Get the device-specific handle (D3D buffer pointer, OpenGL buffer ID etc) associated with the given buffer handle.
 
virtual void retrieveSubBuffer (void *data, BufferHandle source, const size_t offset, const size_t size) override
 Retrieves the contents of a buffer.
 
- Public Member Functions inherited from Cogs::BuffersCommon
virtual VertexFormatHandle createVertexFormat (const VertexElement *elements, size_t count) override
 
virtual const VertexFormatgetVertexFormat (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 VertexFormatgetVertexFormat (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

size_t bufferMemoryConsumption = 0
 
ResourceMap< BufferHandle, BufferGLES30buffers
 
ResourceMap< InputLayoutHandle, InputLayoutGLES30inputLayouts
 
ResourceMap< VertexArrayObjectHandle, VertexArrayObjectGLES30vertexArrayObjects
 

Private Attributes

ContextGLES30context = nullptr
 
CapabilitiesGLES30capabilities = nullptr
 
EffectsGLES30effects = nullptr
 

Detailed Description

Definition at line 13 of file BuffersGLES30.h.

Member Function Documentation

◆ getNativeHandle()

void * Cogs::BuffersGLES30::getNativeHandle ( BufferHandle  bufferHandle)
inlineoverridevirtual

Get the device-specific handle (D3D buffer pointer, OpenGL buffer ID etc) associated with the given buffer handle.

Parameters
bufferHandleValid handle to a previously created buffer object.
Returns
Native handle

Implements Cogs::IBuffers.

Definition at line 44 of file BuffersGLES30.h.

◆ initialize()

void Cogs::BuffersGLES30::initialize ( CapabilitiesGLES30 capabilities,
ContextGLES30 context,
EffectsGLES30 effects 
)
inline

Definition at line 19 of file BuffersGLES30.h.

◆ loadBuffer()

Cogs::BufferHandle Cogs::BuffersGLES30::loadBuffer ( const void *  data,
const size_t  size,
Usage::EUsage  usage,
uint32_t  accessMode,
uint32_t  bindFlags,
uint32_t  stride = 0 
)
overridevirtual

Loads a new buffer using the given data to populate the buffer.

Parameters
dataPointer to data used to populate the buffer. Must be at least size number of bytes.
sizeSize of the buffer to create in bytes.
usageUsage flags for the buffer. Specifies how the buffer is intended to be used.
accessModeAccess mode flags for the buffer. Specifies how the buffer can be accessed at a later time.
bindFlagsBinding flags specifying how the buffer can be bound to the pipeline at a later state.
Returns
Handle to a new buffer, InvalidHandle if no buffer could be created with the given parameters.
See also
Usage, AccessMode, BindFlags

Implements Cogs::IBuffers.

Definition at line 129 of file BuffersGLES30.cpp.

References Cogs::BufferGLES30::bufferId, Cogs::BindFlags::ConstantBuffer, Cogs::Usage::Default, Cogs::Usage::Dynamic, Cogs::BindFlags::IndexBuffer, Cogs::BufferGLES30::indexType, Cogs::Handle_t< BufferTag >::InvalidHandle, Cogs::BufferGLES30::isIndexBuffer, Cogs::BufferGLES30::isMapped, Cogs::BufferGLES30::keepMapBacking, Cogs::BindFlags::RawBuffer, Cogs::BindFlags::ShaderResource, Cogs::BufferGLES30::size, Cogs::Usage::Staging, Cogs::Usage::Static, Cogs::BindFlags::StreamOutBuffer, Cogs::BindFlags::StructuredBuffer, Cogs::BindFlags::StructuredBufferWithCounter, Cogs::BufferGLES30::target, Cogs::BindFlags::VertexBuffer, Cogs::BufferGLES30::vertexFormat, and Cogs::BufferGLES30::writeBackMap.

◆ loadIndexBuffer()

Cogs::IndexBufferHandle Cogs::BuffersGLES30::loadIndexBuffer ( const void *  indexData,
const size_t  count,
const size_t  indexSize 
)
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.

Parameters
indexDataPointer to index data in memory, or nullptr to initialize an empty index buffer.
countNumber of indexes given.
indexSizeSize of an index in bytes.
Returns
Handle to the loaded index buffer, InvalidHandle if the operation failed.

Implements Cogs::IBuffers.

Definition at line 91 of file BuffersGLES30.cpp.

References Cogs::Usage::Default, Cogs::BindFlags::IndexBuffer, and Cogs::AccessMode::Write.

◆ loadInputLayout()

Cogs::InputLayoutHandle Cogs::BuffersGLES30::loadInputLayout ( const VertexFormatHandle vertexFormats,
const size_t  count,
EffectHandle  effectHandle 
)
overridevirtual

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.

Parameters
vertexFormatsPointer to an array of pointers to vertex formats. One for each vertex buffer that in sum describes total vertex data.
countNumber of vertex formats given.
effectHandleHandle 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.
Returns
Handle to a new input layout object, InvalidHandle if no valid input layout could be created.

Implements Cogs::IBuffers.

Definition at line 104 of file BuffersGLES30.cpp.

References Cogs::Handle_t< InputLayoutTag >::InvalidHandle.

◆ loadVertexArrayObject()

Cogs::VertexArrayObjectHandle Cogs::BuffersGLES30::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 = 4 
)
overridevirtual

◆ loadVertexBuffer() [1/2]

Cogs::VertexBufferHandle Cogs::BuffersGLES30::loadVertexBuffer ( const void *  vertexData,
const size_t  count,
const VertexFormat vertexFormat 
)
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.

Parameters
vertexDataPointer to vertex data in memory, or nullptr to initialize an empty vertex buffer.
countNumber of vertexes in the vertex data.
vertexFormatFormat of the vertexes in the given memory buffer.
Returns
Handle to the loaded vertex buffer, InvalidHandle if the operation failed.

Implements Cogs::IBuffers.

Definition at line 62 of file BuffersGLES30.cpp.

References Cogs::Usage::Default, Cogs::VertexFormat::elements, Cogs::AccessMode::None, and Cogs::BindFlags::VertexBuffer.

◆ loadVertexBuffer() [2/2]

Cogs::VertexBufferHandle Cogs::BuffersGLES30::loadVertexBuffer ( const void *  vertexData,
const size_t  count,
VertexFormatHandle  vertexFormatHandle 
)
overridevirtual

Implements Cogs::IBuffers.

Definition at line 81 of file BuffersGLES30.cpp.

◆ releaseBuffer()

void Cogs::BuffersGLES30::releaseBuffer ( BufferHandle  bufferHandle)
virtual

Releases the buffer with the given bufferHandle.

Parameters
bufferHandleValid handle to a previously created buffer.

Implements Cogs::IBuffers.

Definition at line 237 of file BuffersGLES30.cpp.

References Cogs::BufferGLES30::bufferId, and Cogs::BufferGLES30::size.

◆ releaseIndexBuffer()

void Cogs::BuffersGLES30::releaseIndexBuffer ( IndexBufferHandle  indexBufferHandle)
virtual

Releases the index buffer with the given handle.

Parameters
indexBufferHandleValid handle to a previously created index buffer.

Implements Cogs::IBuffers.

Definition at line 99 of file BuffersGLES30.cpp.

◆ releaseInputLayout()

void Cogs::BuffersGLES30::releaseInputLayout ( InputLayoutHandle  inputLayoutHandle)
virtual

Releases the input layout with the given inputLayoutHandle.

Parameters
inputLayoutHandleValid handle to a previously created index buffer.

Implements Cogs::IBuffers.

Definition at line 124 of file BuffersGLES30.cpp.

◆ releaseResources()

void Cogs::BuffersGLES30::releaseResources ( )
virtual

Releases all allocated buffer resources.

Implements Cogs::IBuffers.

Definition at line 255 of file BuffersGLES30.cpp.

◆ releaseVertexArrayObject()

void Cogs::BuffersGLES30::releaseVertexArrayObject ( VertexArrayObjectHandle  )
virtual

Logs an unsupported error, override to provide support.

Reimplemented from Cogs::BuffersCommon.

Definition at line 431 of file BuffersGLES30.cpp.

◆ releaseVertexBuffer()

void Cogs::BuffersGLES30::releaseVertexBuffer ( VertexBufferHandle  vertexBufferHandle)
overridevirtual

Release the vertex buffer with the given handle.

The data is removed from GPU memory.

Parameters
vertexBufferHandleValid handle to a previously created vertex buffer.

Implements Cogs::IBuffers.

Definition at line 86 of file BuffersGLES30.cpp.

◆ retrieveSubBuffer()

void Cogs::BuffersGLES30::retrieveSubBuffer ( void *  data,
BufferHandle  source,
const size_t  offset,
const size_t  size 
)
overridevirtual

Retrieves the contents of a buffer.

Parameters
dataPointer to where the data should be stored.
offsetThe offset in bytes inside the buffer from where to retrieve data.
sizeThe number of bytes to retrieve from the buffer.

Implements Cogs::IBuffers.

Definition at line 286 of file BuffersGLES30.cpp.

Member Data Documentation

◆ bufferMemoryConsumption

size_t Cogs::BuffersGLES30::bufferMemoryConsumption = 0

Definition at line 48 of file BuffersGLES30.h.

◆ buffers

ResourceMap<BufferHandle, BufferGLES30> Cogs::BuffersGLES30::buffers

Definition at line 49 of file BuffersGLES30.h.

◆ capabilities

CapabilitiesGLES30* Cogs::BuffersGLES30::capabilities = nullptr
private

Definition at line 55 of file BuffersGLES30.h.

◆ context

ContextGLES30* Cogs::BuffersGLES30::context = nullptr
private

Definition at line 54 of file BuffersGLES30.h.

◆ effects

EffectsGLES30* Cogs::BuffersGLES30::effects = nullptr
private

Definition at line 56 of file BuffersGLES30.h.

◆ inputLayouts

ResourceMap<InputLayoutHandle, InputLayoutGLES30> Cogs::BuffersGLES30::inputLayouts

Definition at line 50 of file BuffersGLES30.h.

◆ vertexArrayObjects

ResourceMap<VertexArrayObjectHandle, VertexArrayObjectGLES30> Cogs::BuffersGLES30::vertexArrayObjects

Definition at line 51 of file BuffersGLES30.h.


The documentation for this struct was generated from the following files: