Class Buffer#
Defined in File Buffer.h
Inheritance Relationships#
Derived Type#
public TRAP::Graphics::API::VulkanBuffer
(Class VulkanBuffer)
Class Documentation#
-
class Buffer#
Subclassed by TRAP::Graphics::API::VulkanBuffer
Public Functions
-
virtual ~Buffer()#
Destructor.
-
constexpr u64 GetSize() const noexcept#
Retrieve the size of the buffer in bytes.
- Returns:
Size of the buffer in bytes.
-
constexpr RendererAPI::DescriptorType GetDescriptors() const noexcept#
Retrieve the type of descriptor.
- Returns:
Type of descriptor.
-
constexpr RendererAPI::ResourceMemoryUsage GetMemoryUsage() const noexcept#
Retrieve the usage of the buffer memory.
- Returns:
Usage of the buffer memory.
-
template<typename T = u8>
constexpr std::span<T> GetCPUMappedAddress() const noexcept# Retrieve the CPU mapped memory range of the buffer.
Note
MapBuffer must be called before accessing the buffer on the CPU.
- Returns:
CPU mapped memory range of the buffer.
-
virtual bool MapBuffer(const RendererAPI::ReadRange &range = {}) = 0#
Map a region of the buffer to the CPU.
Note
MapBuffer must not be called if memory usage is GPU only.
- Parameters:
range – Optional range of the buffer to map. Default: Whole buffer.
- Returns:
Returns true if the buffer was successfully mapped, false otherwise.
-
virtual void UnMapBuffer() = 0#
Unmap CPU mapped memory region.
Note
UnMapBuffer must not be called if memory usage is GPU only.
Public Static Functions
-
static TRAP::Ref<Buffer> Create(const RendererAPI::BufferDesc &desc)#
Create a new buffer from the given description.
- Parameters:
desc – Buffer description.
- Returns:
Created buffer.
Protected Functions
-
Buffer(u64 size, RendererAPI::DescriptorType descriptorType, RendererAPI::ResourceMemoryUsage memoryUsage)#
Constructor.
Protected Attributes
-
RendererAPI::DescriptorType m_descriptors = RendererAPI::DescriptorType::Undefined#
-
RendererAPI::ResourceMemoryUsage m_memoryUsage = RendererAPI::ResourceMemoryUsage::Unknown#
-
virtual ~Buffer()#