MemoryUsage

Describes the usage of a memory allocation

Values

ValueMeaning
unknown

No intended usage. The type of memory will not be influenced by the usage.

gpuOnly

Memory will be used on device only (MemProps.deviceLocal) and having it mappable on host is not requested (although it is possible on some devices). Usage:

  • Resources written and read by device, e.g. images used as attachments.
  • Resources transferred from host once or infrequently and read by device multiple times, e.g. textures, vertex bufers, uniforms etc.
cpuOnly

Memory will be mappable on host. It usually means CPU (system) memory. Resources created for this usage may still be accessible to the device, but access to them can be slower. Guarantees to be MemProps.hostVisible and MemProps.hostCoherent. Usage:

  • Staging copy of resources used as transfer source.
cpuToGpu

Memory that is both mappable on host (guarantees to be MemProps.hostVisible) and preferably fast to access by GPU. CPU reads may be uncached and very slow. Usage:

  • Resources written frequently by host (dynamic), read by device. E.g. textures, vertex buffers, uniform buffers updated every frame or every draw call.
gpuToCpu

Memory mappable on host (guarantees to be MemProps.hostVisible) and cached. Usage:

  • Resources written by device, read by host - results of some computations, e.g. screen capture, average scene luminance for HDR tone mapping.
  • Any resources read or accessed randomly on host, e.g. CPU-side copy of vertex buffer used as source of transfer, but also used for collision detection.

Meta