Castor3D 0.16.0
Multiplatform 3D engine
Public Member Functions | Friends | List of all members
castor3d::GpuBufferT< AllocatorT > Class Template Reference

A GPU buffer pool, that uses an allocator to allocate sub-buffers. More...

#include <GpuBuffer.hpp>

Inheritance diagram for castor3d::GpuBufferT< AllocatorT >:
Inheritance graph
[legend]
Collaboration diagram for castor3d::GpuBufferT< AllocatorT >:
Collaboration graph
[legend]

Public Member Functions

 GpuBufferT (RenderSystem const &renderSystem, VkBufferUsageFlags usage, VkMemoryPropertyFlags memoryFlags, castor::String const &debugName, ashes::QueueShare sharingMode, AllocatorT allocator)
 Constructor.
 
bool hasAvailable (VkDeviceSize size) const noexcept
 
MemChunk allocate (VkDeviceSize size)
 Allocates a memory chunk for a CPU buffer.
 
void deallocate (MemChunk const &mem) noexcept
 Deallocates memory.
 
size_t getMinAlignment () const noexcept
 
- Public Member Functions inherited from castor3d::GpuBufferBase
C3D_API GpuBufferBase (RenderSystem const &renderSystem, VkBufferUsageFlags usage, VkMemoryPropertyFlags memoryFlags, castor::String const &debugName, ashes::QueueShare sharingMode, VkDeviceSize allocatedSize)
 Constructor.
 
C3D_API void upload (UploadData &uploader)
 Uploads all ready memory ranges to VRAM.
 
C3D_API void upload (UploadData &uploader, VkDeviceSize offset, VkDeviceSize size, VkAccessFlags dstAccessFlags, VkPipelineStageFlags dstPipelineFlags)
 Uploads a memory range.
 
C3D_API void markDirty (VkDeviceSize offset, VkDeviceSize size, VkAccessFlags dstAccessFlags, VkPipelineStageFlags dstPipelineFlags)
 Marks a memory range to be ready for upload.
 
bool hasBuffer () const noexcept
 
ashes::Buffer< uint8_t > const & getBuffer () const noexcept
 
ashes::Buffer< uint8_t > & getBuffer () noexcept
 
template<typename DataT >
DataT const & getData (VkDeviceSize offset) const noexcept
 
template<typename DataT >
DataT & getData (VkDeviceSize offset) noexcept
 
castor::ByteArrayView const & getDatas () const noexcept
 
castor::ByteArrayView & getDatas () noexcept
 

Friends

class GpuBufferPool
 

Detailed Description

template<typename AllocatorT>
class castor3d::GpuBufferT< AllocatorT >

A GPU buffer pool, that uses an allocator to allocate sub-buffers.

Constructor & Destructor Documentation

◆ GpuBufferT()

template<typename AllocatorT >
castor3d::GpuBufferT< AllocatorT >::GpuBufferT ( RenderSystem const & renderSystem,
VkBufferUsageFlags usage,
VkMemoryPropertyFlags memoryFlags,
castor::String const & debugName,
ashes::QueueShare sharingMode,
AllocatorT allocator )

Constructor.

Parameters
[in]renderSystemThe device on which the storage is allocated.
[in]usageThe buffer targets.
[in]memoryFlagsThe buffer memory properties.
[in]debugNameThe debug name.
[in]sharingModeThe sharing mode.
[in]allocatorThe allocator.

Member Function Documentation

◆ allocate()

template<typename AllocatorT >
MemChunk castor3d::GpuBufferT< AllocatorT >::allocate ( VkDeviceSize size)

Allocates a memory chunk for a CPU buffer.

Parameters
[in]sizeThe requested memory size.
Returns
The memory chunk offset.

◆ deallocate()

template<typename AllocatorT >
void castor3d::GpuBufferT< AllocatorT >::deallocate ( MemChunk const & mem)
noexcept

Deallocates memory.

Parameters
[in]memThe memory chunk.

◆ getMinAlignment()

template<typename AllocatorT >
size_t castor3d::GpuBufferT< AllocatorT >::getMinAlignment ( ) const
noexcept
Returns
The element aligned size.

◆ hasAvailable()

template<typename AllocatorT >
bool castor3d::GpuBufferT< AllocatorT >::hasAvailable ( VkDeviceSize size) const
noexcept
Parameters
[in]sizeThe requested memory size.
Returns
true if there is enough remaining memory for given size.

Friends And Related Symbol Documentation

◆ GpuBufferPool

template<typename AllocatorT >
friend class GpuBufferPool
friend

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