VulkanMemory class

Constructors, destructors, conversion operators

VulkanMemory() defaulted
~VulkanMemory()
VulkanMemory(const VulkanMemory&) deleted

Public functions

auto operator=(const VulkanMemory&) -> VulkanMemory& deleted
auto Initialize(const VulkanContext& ctx) -> bool
void Shutdown()
auto AllocateBuffer(VkDeviceSize size, VkBufferUsageFlags usage, GpuMemoryDomain domain, bool requestDeviceAddress = false) -> VulkanBuffer
auto AllocateImage(VkExtent2D extent, VkFormat format, VkImageUsageFlags usage, VkImageAspectFlags aspectMask) -> VulkanImage
auto UploadImage(VulkanImage& image, const void* pixels, VkDeviceSize byteSize, uint32_t width, uint32_t height) -> bool
auto GetAllocator() const -> VmaAllocator
auto HasReBAR() const -> bool
auto SupportsBDA() const -> bool
auto SupportsHostImageCopy() const -> bool

Function documentation

VulkanBuffer VulkanMemory::AllocateBuffer(VkDeviceSize size, VkBufferUsageFlags usage, GpuMemoryDomain domain, bool requestDeviceAddress = false)

Allocate a GPU buffer. Returns a move-only RAII handle. Set requestDeviceAddress=true to populate VulkanBuffer::DeviceAddr (requires BDA support, checked at runtime).

VulkanImage VulkanMemory::AllocateImage(VkExtent2D extent, VkFormat format, VkImageUsageFlags usage, VkImageAspectFlags aspectMask)

Allocate a DEVICE_LOCAL image + view. aspectMask determines the view's subresource (COLOR or DEPTH_BIT).

bool VulkanMemory::UploadImage(VulkanImage& image, const void* pixels, VkDeviceSize byteSize, uint32_t width, uint32_t height)

Directly write pixels into a device-local image — no staging buffer, no command buffer. Requires bSupportsHostImageCopy (Vulkan 1.4 hostImageCopy feature). Image must have been created with VK_IMAGE_USAGE_HOST_TRANSFER_BIT. Falls back gracefully: returns false if host image copy is unavailable.