• Home
  • Raw
  • Download

Lines Matching full:memory

10 //! Device memory allocation and memory pools.
12 //! By default, memory allocation is automatically handled by the vulkano library when you create
14 //! memory allocation strategy.
16 //! # Memory types and heaps
18 //! A physical device is composed of one or more **memory heaps**. A memory heap is a pool of
19 //! memory that can be allocated.
22 //! // Enumerating memory heaps.
29 //! However you can't allocate directly from a memory heap. A memory heap is shared amongst one or
30 //! multiple **memory types**, which you can allocate memory from. Each memory type has different
33 //! A memory type may or may not be visible to the host. In other words, it may or may not be
34 //! directly writable by the CPU. A memory type may or may not be device-local. A device-local
35 //! memory type has a much quicker access time from the GPU than a non-device-local type. Note
36 //! that non-device-local memory types are still accessible by the device, they are just slower.
39 //! // Enumerating memory types.
42 //! println!("Memory type belongs to heap #{:?}", ty.heap_index);
47 //! Memory types are order from "best" to "worse". In other words, the implementation prefers that
48 //! you use the memory types that are earlier in the list. This means that selecting a memory type
53 //! In practice, desktop machines usually have two memory heaps: one that represents the RAM of
57 //! Mobile machines usually have a single memory heap that is "equally local" to both the CPU and
60 //! # Allocating memory and memory pools
62 //! Allocating memory can be done by calling `DeviceMemory::allocate()`.
67 //! use vulkano::memory::{DeviceMemory, MemoryAllocateInfo};
70 //! // Taking the first memory type for the sake of this example.
73 //! let memory = DeviceMemory::allocate(
80 //! ).expect("Failed to allocate memory");
82 //! // The memory is automatically freed when `memory` is destroyed.
85 //! However allocating and freeing memory is very slow (up to several hundred milliseconds
86 //! sometimes). Instead you are strongly encouraged to use a memory pool. A memory pool is not
89 //! A memory pool is any object that implements the `MemoryPool` trait. You can implement that
91 //! get memory from that pool. By default if you don't specify any pool when creating a buffer or
117 /// Properties of the memory in a physical device.
121 /// The available memory types.
124 /// The available memory heaps.
150 /// A memory type in a physical device.
154 /// The properties of this memory type.
157 /// The index of the memory heap that this memory type corresponds to.
164 /// Properties of a memory type.
167 /// The memory is located on the device, and is allocated from a heap that also has the
170 /// For some devices, particularly integrated GPUs, the device shares memory with the host and
171 /// all memory may be device-local, so the distinction is moot. However, if the device has
172 /// non-device-local memory, it is usually faster for the device to access device-local memory.
173 /// Therefore, device-local memory is preferred for data that will only be accessed by
176 /// If the device and host do not share memory, data transfer between host and device may
178 /// they do not have to cross this barrier: device-local memory is fast for the device to
179 /// access, but slower to access by the host. However, there are devices that share memory with
180 /// the host, yet have distinct device-local and non-device local memory types. In that case,
183 /// For data transfer between host and device, it is most efficient if the memory is located
185 /// available, device-local memory is preferred for host-to-device data transfer, while
186 /// non-device-local memory is preferred for device-to-host data transfer. This is because data
190 /// Devices may have memory types that are neither `DEVICE_LOCAL` nor [`HOST_VISIBLE`]. This
191 /// is regular host memory that is made available to the device exclusively. Although it will be
192 /// slower to access from the device than `DEVICE_LOCAL` memory, it can be faster than
193 /// [`HOST_VISIBLE`] memory. It can be used as overflow space if the device is out of memory.
199 /// The memory can be mapped into the memory space of the host and accessed as regular RAM.
201 /// Memory of this type is required to transfer data between the host and the device. If
202 /// the memory is going to be accessed by the device more than a few times, it is recommended
203 /// to copy the data to non-`HOST_VISIBLE` memory first if it is available.
205 /// `HOST_VISIBLE` memory is always at least either [`HOST_COHERENT`] or [`HOST_CACHED`],
212 /// Host access to the memory does not require calling [`invalidate_range`] to make device
219 /// The memory is cached by the host.
221 /// `HOST_CACHED` memory is fast for reads and random access from the host, so it is preferred
222 /// for device-to-host data transfer. Memory that is [`HOST_VISIBLE`] but not `HOST_CACHED` is
229 /// Allocations made from the memory are lazy.
231 /// This means that no actual allocation is performed. Instead memory is automatically
233 /// [`DeviceMemory::commitment`] to query how much memory is currently committed to an
236 /// Memory of this type can only be used on images created with a certain flag, and is never
242 /// The memory can only be accessed by the device, and allows protected queue access.
244 /// Memory of this type is never [`HOST_VISIBLE`], [`HOST_COHERENT`] or [`HOST_CACHED`].
253 /// Device accesses to the memory are automatically made available and visible to other device
256 /// Memory of this type is slower to access by the device, so it is best avoided for general
262 /// The memory is not cached on the device.
264 /// `DEVICE_UNCACHED` memory is always also [`DEVICE_COHERENT`].
271 /// Other devices can access the memory via remote direct memory access (RDMA).
277 /// A memory heap in a physical device.
291 /// Attributes of a memory heap.
294 /// The heap corresponds to device-local memory.
305 /// Represents requirements expressed by the Vulkan implementation when it comes to binding memory
309 /// Memory layout required for the resource.
312 /// Indicates which memory types can be used. Each bit that is set to 1 means that the memory
317 /// a whole block of memory dedicated to this resource alone).
324 /// a whole block of memory dedicated to this resource alone).
331 /// Indicates a specific resource to allocate memory for.
362 /// The properties for exporting or importing external memory, when a buffer or image is created
367 /// Whether a dedicated memory allocation is required for the queried external handle type.
370 /// Whether memory can be exported to an external source with the queried
374 /// Whether memory can be imported from an external source with the queried
420 /// The bind operations to perform for images with an opaque memory layout.
428 /// The bind operations to perform for images with a known memory layout.
464 /// The offset in bytes from the start of the buffer's memory, where memory is to be (un)bound.
469 /// The size in bytes of the memory to be (un)bound.
474 /// If `Some`, specifies the memory and an offset into that memory that is to be bound.
475 /// The provided memory must match the buffer's memory requirements.
477 /// If `None`, specifies that existing memory at the specified location is to be unbound.
480 pub memory: Option<(Arc<DeviceMemory>, DeviceSize)>, field
483 /// Parameters for a single sparse bind operation on parts of an image with an opaque memory layout.
489 /// The offset in bytes from the start of the image's memory, where memory is to be (un)bound.
494 /// The size in bytes of the memory to be (un)bound.
499 /// If `Some`, specifies the memory and an offset into that memory that is to be bound.
500 /// The provided memory must match the image's memory requirements.
502 /// If `None`, specifies that existing memory at the specified location is to be unbound.
505 pub memory: Option<(Arc<DeviceMemory>, DeviceSize)>, field
514 /// Parameters for a single sparse bind operation on parts of an image with a known memory layout.
521 /// The aspects of the image where memory is to be (un)bound.
526 /// The mip level of the image where memory is to be (un)bound.
531 /// The array layer of the image where memory is to be (un)bound.
537 /// where memory is to be (un)bound.
547 /// memory is to be (un)bound.
557 /// If `Some`, specifies the memory and an offset into that memory that is to be bound.
558 /// The provided memory must match the image's memory requirements.
560 /// If `None`, specifies that existing memory at the specified location is to be unbound.
563 pub memory: Option<(Arc<DeviceMemory>, DeviceSize)>, field
571 /// Performs bounds-checking of a Vulkan memory range. Analog of `std::slice::range`.