CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::GPUBuffer Class Referenceabstract

#include <CeresEngine/RenderAPI/GPUBuffer.hpp>

Inheritance diagram for CeresEngine::GPUBuffer:
CeresEngine::TDeviceObject< GPUBufferDescriptor, GPUResource > CeresEngine::GPUResource CeresEngine::GPUDeviceObject CeresEngine::GPUObject CeresEngine::GLBuffer CeresEngine::MKBuffer CeresEngine::MTBuffer CeresEngine::NLBuffer CeresEngine::VKBuffer CeresEngine::WGBuffer CeresEngine::GLIndexBuffer CeresEngine::GLStorageBuffer CeresEngine::GLUniformBuffer CeresEngine::GLVertexBuffer

Public Member Functions

 GPUBuffer (const GPUBuffer &)=delete
 Deleted copy constructor.
 
GPUBufferoperator= (const GPUBuffer &)=delete
 
 GPUBuffer (GPUBuffer &&)=delete
 Deleted move constructor.
 
GPUBufferoperator= (GPUBuffer &&)=delete
 
Async< ByteBufferread (GPUBufferSize offset=0, GPUBufferSize size=whole)
 Performs an asynchronous read operation on the buffer.
 
Async< ByteBufferread (GPUCommandBuffer &commandBuffer, GPUBufferSize offset=0, GPUBufferSize size=whole)
 Performs an asynchronous read operation on the buffer in an specific command buffer.
 
Async write (ByteBuffer &&rawData, GPUBufferSize offset=0, GPUBufferSize size=whole)
 Performs an asynchronous write operation on the buffer.
 
Async write (GPUCommandBuffer &commandBuffer, ByteBuffer &&rawData, GPUBufferSize offset=0, GPUBufferSize size=whole)
 Performs an asynchronous write operation on the buffer in an specific command buffer.
 
virtual GPUBufferData map ()=0
 Maps the buffer into the computers memory.
 
virtual void unmap ()=0
 Unmaps the previously mapped GPU memory buffer.
 
virtual GPUBufferSize getSize () const =0
 
virtual void flush (GPUBufferSize offset=0, GPUBufferSize size=whole)=0
 Flushes the cached memory data starting at offset with size bytes.
 
virtual void invalidate (GPUBufferSize offset=0, GPUBufferSize size=whole)=0
 Invalidates the cached memory data starting at offset with size bytes.
 
template<typename Block >
void data (Block &&block)
 Executes block with a pointer that gives direct access to the buffer data.
 
 TDeviceObject (GPUDevice &device, const Descriptor &descriptor)
 Inherited constructors.
 
 TDeviceObject (const TDeviceObject &)=delete
 Inherited constructors.
 
 TDeviceObject (TDeviceObject &&)=delete
 Inherited constructors.
 
- Public Member Functions inherited from CeresEngine::TDeviceObject< GPUBufferDescriptor, GPUResource >
 TDeviceObject (GPUDevice &device, const Descriptor &descriptor)
 Initializes a new RenderAPI device object instance.
 
 TDeviceObject (const TDeviceObject &)=delete
 
 TDeviceObject (TDeviceObject &&)=delete
 
 ~TDeviceObject () override=default
 
TDeviceObjectoperator= (const TDeviceObject &)=delete
 
TDeviceObjectoperator= (TDeviceObject &&)=delete
 
- Public Member Functions inherited from CeresEngine::GPUResource
 GPUDeviceObject (GPUDevice &device)
 
- Public Member Functions inherited from CeresEngine::GPUDeviceObject
 GPUDeviceObject (GPUDevice &device)
 
 ~GPUDeviceObject () override
 
- Public Member Functions inherited from CeresEngine::GPUObject
 GPUObject ()=default
 
virtual ~GPUObject ()=default
 
 GPUObject (const GPUObject &)=delete
 
GPUObjectoperator= (const GPUObject &)=delete
 
 GPUObject (GPUObject &&)=delete
 
GPUObjectoperator= (GPUObject &&)=delete
 
void retain () noexcept
 Retains the object by increment it's reference count by one.
 
bool release () noexcept
 Releases the object by decrementing it's reference count by one.
 

Static Public Attributes

static const constexpr GPUBufferSize whole = ~0UL
 A constant the represents the whole buffer length.
 

Additional Inherited Members

- Public Types inherited from CeresEngine::TDeviceObject< GPUBufferDescriptor, GPUResource >
using Descriptor = GPUBufferDescriptor
 An type-alias to the descriptor struct type.
 
- Public Attributes inherited from CeresEngine::TDeviceObject< GPUBufferDescriptor, GPUResource >
const Descriptordescriptor
 A structure that describes the object and it's properties.
 
- Public Attributes inherited from CeresEngine::GPUDeviceObject
GPUDevicedevice
 The owning device this object was created from.
 
- Protected Member Functions inherited from CeresEngine::GPUObject
virtual void destroy () noexcept
 A internal method called by the system when the object reference count reaches zero.
 

Constructor & Destructor Documentation

◆ GPUBuffer() [1/2]

CeresEngine::GPUBuffer::GPUBuffer ( const GPUBuffer )
delete

Deleted copy constructor.

◆ GPUBuffer() [2/2]

CeresEngine::GPUBuffer::GPUBuffer ( GPUBuffer &&  )
delete

Deleted move constructor.

Member Function Documentation

◆ data()

template<typename Block >
void CeresEngine::GPUBuffer::data ( Block &&  block)
inline

Executes block with a pointer that gives direct access to the buffer data.

Parameters
blockThe block to be executed with a pointer to the GPU buffer.

◆ flush()

virtual void CeresEngine::GPUBuffer::flush ( GPUBufferSize  offset = 0,
GPUBufferSize  size = whole 
)
pure virtual

Flushes the cached memory data starting at offset with size bytes.

Parameters
offsetThe starting offset to be flushed
sizeThe amount of bytes to be flushed

Implemented in CeresEngine::MTBuffer, CeresEngine::MKBuffer, CeresEngine::NLBuffer, CeresEngine::GLBuffer, CeresEngine::VKBuffer, and CeresEngine::WGBuffer.

◆ getSize()

virtual GPUBufferSize CeresEngine::GPUBuffer::getSize ( ) const
pure virtual

◆ invalidate()

virtual void CeresEngine::GPUBuffer::invalidate ( GPUBufferSize  offset = 0,
GPUBufferSize  size = whole 
)
pure virtual

Invalidates the cached memory data starting at offset with size bytes.

Parameters
offsetThe starting offset to be flushed
sizeThe amount of bytes to be flushed

Implemented in CeresEngine::MTBuffer, CeresEngine::MKBuffer, CeresEngine::NLBuffer, CeresEngine::GLBuffer, CeresEngine::VKBuffer, and CeresEngine::WGBuffer.

◆ map()

virtual GPUBufferData CeresEngine::GPUBuffer::map ( )
pure virtual

Maps the buffer into the computers memory.

Returns
A pointer to the GPU memory block

Implemented in CeresEngine::MTBuffer, CeresEngine::MKBuffer, CeresEngine::NLBuffer, CeresEngine::GLBuffer, CeresEngine::VKBuffer, and CeresEngine::WGBuffer.

◆ operator=() [1/2]

GPUBuffer & CeresEngine::GPUBuffer::operator= ( const GPUBuffer )
delete

◆ operator=() [2/2]

GPUBuffer & CeresEngine::GPUBuffer::operator= ( GPUBuffer &&  )
delete

◆ read() [1/2]

Async< ByteBuffer > CeresEngine::GPUBuffer::read ( GPUBufferSize  offset = 0,
GPUBufferSize  size = whole 
)

Performs an asynchronous read operation on the buffer.

Parameters
offsetThe offset into the buffer to start reading the contents at.
sizeThe amount of bytes to be read from the buffer.
Returns
A continuable that is marked as complete once the device has finished copying the buffer data into a host buffer.

◆ read() [2/2]

Async< ByteBuffer > CeresEngine::GPUBuffer::read ( GPUCommandBuffer commandBuffer,
GPUBufferSize  offset = 0,
GPUBufferSize  size = whole 
)

Performs an asynchronous read operation on the buffer in an specific command buffer.

Parameters
commandBufferThe command buffer to execute the copy commands on.
offsetThe offset into the buffer to start reading the contents at.
sizeThe amount of bytes to be read from the buffer.
Returns
A continuable that is marked as complete once the device has finished copying the buffer data into a host buffer.

◆ TDeviceObject() [1/3]

Inherited constructors.

◆ TDeviceObject() [2/3]

CeresEngine::TDeviceObject< TDescriptor, TParent >::TDeviceObject ( GPUDevice device,
const Descriptor descriptor 
)
inlineexplicit

Inherited constructors.

◆ TDeviceObject() [3/3]

CeresEngine::TDeviceObject< TDescriptor, TParent >::TDeviceObject ( TDeviceObject &&  )
delete

Inherited constructors.

◆ unmap()

virtual void CeresEngine::GPUBuffer::unmap ( )
pure virtual

◆ write() [1/2]

Async CeresEngine::GPUBuffer::write ( ByteBuffer &&  rawData,
GPUBufferSize  offset = 0,
GPUBufferSize  size = whole 
)

Performs an asynchronous write operation on the buffer.

Parameters
rawDataA raw byte buffer to be copied into the device buffer.
offsetThe offset into the buffer to start writing the contents at.
sizeThe amount of bytes to be written to the buffer.
Returns
A continuable that is marked as complete once the device has finished copying host buffer into the device buffer.

◆ write() [2/2]

Async CeresEngine::GPUBuffer::write ( GPUCommandBuffer commandBuffer,
ByteBuffer &&  rawData,
GPUBufferSize  offset = 0,
GPUBufferSize  size = whole 
)

Performs an asynchronous write operation on the buffer in an specific command buffer.

Parameters
commandBufferThe command buffer to execute the copy commands on.
rawDataA raw byte buffer to be copied into the device buffer.
offsetThe offset into the buffer to start writing the contents at.
sizeThe amount of bytes to be written to the buffer.
Returns
A continuable that is marked as complete once the device has finished copying host buffer into the device buffer.

Member Data Documentation

◆ whole

const constexpr GPUBufferSize CeresEngine::GPUBuffer::whole = ~0UL
inlinestaticconstexpr

A constant the represents the whole buffer length.


The documentation for this class was generated from the following file: