Foundation
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
Foundation::RHI::VulkanBuffer Class Reference

#include <Resource.hpp>

Inheritance diagram for Foundation::RHI::VulkanBuffer:
Foundation::RHI::RHIBuffer Foundation::RHI::RHIObject

Public Member Functions

 VulkanBuffer (VulkanDevice const &device, RHIBufferDesc const &desc)
 
 VulkanBuffer (VulkanDevice const &device, RHIBufferDesc const &desc, vk::raii::Buffer &&buffer, bool shared=true)
 
 ~VulkanBuffer () override
 
autoGetVkBuffer ()
 
voidMap () override
 Maps the entire buffer to the host memory. Alignment is implementation-defined. Implementations MUST guarantee consecutive calls to Map() return the same pointer, therefore it's not possible to map the same resource multiple times. For caching behaviours, RHIBufferDesc.
 
void Flush (size_t offset, size_t size) override
 Flushes the mapped region to the device. Depending on the implementation, this may be a no-op.

 
void Unmap () override
 Releases or unmaps a previously mapped resource. Implementations MUST guarantee that Unmap() is called at destruction time if the resource is still mapped.

 
RHIBufferScopedHandle< RHIBufferCreateAliasedBuffer (RHIBufferDesc const &desc, size_t offset) override
 
RHIBufferGetAliasedBuffer (Handle handle) const override
 
void DestroyAliasedBuffer (Handle handle) override
 
void DebugSetObjectName (const char *name) override
 
- Public Member Functions inherited from Foundation::RHI::RHIBuffer
 RHIBuffer (RHIDevice const &device, RHIBufferDesc const &desc)
 
template<typename T >
Span< TMapSpan (size_t count=kFullSize)
 Creates a span that maps a contiguous region of the buffer to the host memory. Behaviour of the memory access is defined by the resource itself. e.g. RO/RW. It is undefined behaviour to access the memory without regard to the resource's host access type. For detailed mapping behaviour, Map
 
- Public Member Functions inherited from Foundation::RHI::RHIObject
 RHIObject ()=default
 
 RHIObject (RHIObject const &)=delete
 
RHIObjectoperator= (const RHIObject &)=delete
 
 RHIObject (RHIObject &&)=delete
 
RHIObjectoperator= (RHIObject &&)=delete
 
virtual ~RHIObject ()=default
 

Public Attributes

const bool mShared { false }
 
- Public Attributes inherited from Foundation::RHI::RHIBuffer
const RHIBufferDesc mDesc
 

Protected Attributes

VulkanDevice constmDevice
 
VmaAllocation mAllocation { nullptr }
 
voidmMapped { nullptr }
 
vk::raii::Buffer mBuffer { nullptr }
 
RHIObjectPool< VulkanBuffermAliases
 
- Protected Attributes inherited from Foundation::RHI::RHIBuffer
const RHIDevicemDevice
 

Constructor & Destructor Documentation

◆ VulkanBuffer() [1/2]

VulkanBuffer::VulkanBuffer ( VulkanDevice const device,
RHIBufferDesc const desc 
)

◆ VulkanBuffer() [2/2]

VulkanBuffer::VulkanBuffer ( VulkanDevice const device,
RHIBufferDesc const desc,
vk::raii::Buffer &&  buffer,
bool  shared = true 
)

◆ ~VulkanBuffer()

VulkanBuffer::~VulkanBuffer ( )
override

Member Function Documentation

◆ CreateAliasedBuffer()

RHIBufferScopedHandle< RHIBuffer > VulkanBuffer::CreateAliasedBuffer ( RHIBufferDesc const desc,
size_t  offset 
)
overridevirtual

◆ DebugSetObjectName()

void VulkanBuffer::DebugSetObjectName ( const char name)
overridevirtual

◆ DestroyAliasedBuffer()

void VulkanBuffer::DestroyAliasedBuffer ( Handle  handle)
overridevirtual

◆ Flush()

void VulkanBuffer::Flush ( size_t  offset,
size_t  size 
)
overridevirtual

Flushes the mapped region to the device. Depending on the implementation, this may be a no-op.

Implements Foundation::RHI::RHIBuffer.

◆ GetAliasedBuffer()

RHIBuffer * VulkanBuffer::GetAliasedBuffer ( Handle  handle) const
overridevirtual

◆ GetVkBuffer()

auto & Foundation::RHI::VulkanBuffer::GetVkBuffer ( )
inline

◆ Map()

void * VulkanBuffer::Map ( )
overridevirtual

Maps the entire buffer to the host memory. Alignment is implementation-defined. Implementations MUST guarantee consecutive calls to Map() return the same pointer, therefore it's not possible to map the same resource multiple times. For caching behaviours, RHIBufferDesc.

Implements Foundation::RHI::RHIBuffer.

◆ Unmap()

void VulkanBuffer::Unmap ( )
overridevirtual

Releases or unmaps a previously mapped resource. Implementations MUST guarantee that Unmap() is called at destruction time if the resource is still mapped.

Implements Foundation::RHI::RHIBuffer.

Member Data Documentation

◆ mAliases

RHIObjectPool<VulkanBuffer> Foundation::RHI::VulkanBuffer::mAliases
protected

◆ mAllocation

VmaAllocation Foundation::RHI::VulkanBuffer::mAllocation { nullptr }
protected

◆ mBuffer

vk::raii::Buffer Foundation::RHI::VulkanBuffer::mBuffer { nullptr }
protected

◆ mDevice

VulkanDevice const& Foundation::RHI::VulkanBuffer::mDevice
protected

◆ mMapped

void* Foundation::RHI::VulkanBuffer::mMapped { nullptr }
protected

◆ mShared

const bool Foundation::RHI::VulkanBuffer::mShared { false }

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