VV::V3::Memory class

General memory structures and functionality for device memory.

This object represents a device created object on the host. As such ownership is tied to this host object. Due to this design, the object has no copy-construction allowed. Instead, default move constructor and assignment has been defined.

Base classes

struct VV::V2::Memory
General memory structures and functionality for device memory.

Public types

using Parent = V2::Memory

Constructors, destructors, conversion operators

Memory()
Default constructor.
Memory(const LogicalDevice& _device)
Constructor with logical device specified.
Memory(const LogicalDevice& _device, const Memory::AllocationCallbacks& _allocator)
Constructor with logical device and allocator specified.
Memory(Memory&& _other) noexcept
Performs a move operation to transfer ownership of the device object to this host object.
~Memory()
Destructor will destroy the device object if handle is not null.
operator Handle&()
Implicit conversion to give a reference to its handle.
operator const Handle&() const
Implicit conversion to give a readonly reference to its handle.
operator const Handle*() const
Implicit conversion to give a pointer to its handle.

Public functions

auto Allocate(const AllocateInfo& _info) -> EResult
Allocate memory objects.
auto Allocate(const LogicalDevice& _device, const AllocateInfo& _allocateInfo) -> EResult
Allocate memory objects. (Device specified)
auto Allocate(const LogicalDevice& _device, const AllocateInfo& _allocateInfo, const Memory::AllocationCallbacks& _allocator) -> EResult
Allocate memory objects. (Device and allocator specified)
void Free()
Free a memory object.
auto Map(DeviceSize _offset, DeviceSize _size, MapFlags _flags, VoidPtr& _data) const -> EResult
Retrieve a host virtual address pointer to a region of a mappable memory object.
void Unmap() const
Unmap a memory object once host access to it is no longer needed by the application.
void WriteToGPU(DeviceSize _offset, DeviceSize _size, MapFlags _flags, RoVoidPtr& _data) const
Writes to GPU memory by mapping to device memory specified by a handle and then using memcpy to copy data specified in _data.
auto operator==(const Memory& _other) const -> bool
Checks to see if its the same object by checking to see if its the same handle.
auto operator=(Memory&& _other) -> Memory& noexcept
Performs a move assignment operation to transfer ownership of the device object to this host object.

Protected variables

Handle handle
const AllocationCallbacks* allocator
const LogicalDevice* device