Vulkan Memory Allocator
Classes | Typedefs | Enumerations | Functions
Layer 1 Choosing Memory Type

Classes

struct  VmaMemoryRequirements
 

Typedefs

typedef enum VmaMemoryUsage VmaMemoryUsage
 
typedef struct VmaMemoryRequirements VmaMemoryRequirements
 

Enumerations

enum  VmaMemoryUsage {
  VMA_MEMORY_USAGE_UNKNOWN = 0, VMA_MEMORY_USAGE_GPU_ONLY = 1, VMA_MEMORY_USAGE_CPU_ONLY = 2, VMA_MEMORY_USAGE_CPU_TO_GPU = 3,
  VMA_MEMORY_USAGE_GPU_TO_CPU = 4, VMA_MEMORY_USAGE_MAX_ENUM = 0x7FFFFFFF
}
 

Functions

VkResult vmaFindMemoryTypeIndex (VmaAllocator allocator, uint32_t memoryTypeBits, const VmaMemoryRequirements *pMemoryRequirements, uint32_t *pMemoryTypeIndex)
 

Detailed Description

Typedef Documentation

◆ VmaMemoryRequirements

◆ VmaMemoryUsage

Enumeration Type Documentation

◆ VmaMemoryUsage

Enumerator
VMA_MEMORY_USAGE_UNKNOWN 

No intended memory usage specified.

VMA_MEMORY_USAGE_GPU_ONLY 

Memory will be used on device only, no need to be mapped on host.

VMA_MEMORY_USAGE_CPU_ONLY 

Memory will be mapped on host. Could be used for transfer to device.

VMA_MEMORY_USAGE_CPU_TO_GPU 

Memory will be used for frequent (dynamic) updates from host and reads on device.

VMA_MEMORY_USAGE_GPU_TO_CPU 

Memory will be used for writing on device and readback on host.

VMA_MEMORY_USAGE_MAX_ENUM 

Function Documentation

◆ vmaFindMemoryTypeIndex()

VkResult vmaFindMemoryTypeIndex ( VmaAllocator  allocator,
uint32_t  memoryTypeBits,
const VmaMemoryRequirements pMemoryRequirements,
uint32_t *  pMemoryTypeIndex 
)

This algorithm tries to find a memory type that:

  • Is allowed by memoryTypeBits.
  • Contains all the flags from pMemoryRequirements->requiredFlags.
  • Matches intended usage.
  • Has as many flags from pMemoryRequirements->preferredFlags as possible.
Returns
Returns VK_ERROR_FEATURE_NOT_PRESENT if not found. Receiving such result from this function or any other allocating function probably means that your device doesn't support any memory type with requested features for the specific type of resource you want to use it for. Please check parameters of your resource, like image layout (OPTIMAL versus LINEAR) or mip level count.