| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Vulkan.Core10.Memory
Synopsis
- allocateMemory :: forall a io. (Extendss MemoryAllocateInfo a, PokeChain a, MonadIO io) => Device -> MemoryAllocateInfo a -> ("allocator" ::: Maybe AllocationCallbacks) -> io DeviceMemory
- withMemory :: forall a io r. (Extendss MemoryAllocateInfo a, PokeChain a, MonadIO io) => Device -> MemoryAllocateInfo a -> Maybe AllocationCallbacks -> (io DeviceMemory -> (DeviceMemory -> io ()) -> r) -> r
- freeMemory :: forall io. MonadIO io => Device -> DeviceMemory -> ("allocator" ::: Maybe AllocationCallbacks) -> io ()
- mapMemory :: forall io. MonadIO io => Device -> DeviceMemory -> ("offset" ::: DeviceSize) -> DeviceSize -> MemoryMapFlags -> io ("data" ::: Ptr ())
- withMappedMemory :: forall io r. MonadIO io => Device -> DeviceMemory -> DeviceSize -> DeviceSize -> MemoryMapFlags -> (io (Ptr ()) -> (Ptr () -> io ()) -> r) -> r
- unmapMemory :: forall io. MonadIO io => Device -> DeviceMemory -> io ()
- flushMappedMemoryRanges :: forall io. MonadIO io => Device -> ("memoryRanges" ::: Vector MappedMemoryRange) -> io ()
- invalidateMappedMemoryRanges :: forall io. MonadIO io => Device -> ("memoryRanges" ::: Vector MappedMemoryRange) -> io ()
- getDeviceMemoryCommitment :: forall io. MonadIO io => Device -> DeviceMemory -> io ("committedMemoryInBytes" ::: DeviceSize)
- data MemoryAllocateInfo (es :: [Type]) = MemoryAllocateInfo {
- next :: Chain es
- allocationSize :: DeviceSize
- memoryTypeIndex :: Word32
- data MappedMemoryRange = MappedMemoryRange {
- memory :: DeviceMemory
- offset :: DeviceSize
- size :: DeviceSize
- newtype MemoryMapFlags = MemoryMapFlags Flags
Documentation
Arguments
| :: forall a io. (Extendss MemoryAllocateInfo a, PokeChain a, MonadIO io) | |
| => Device |
|
| -> MemoryAllocateInfo a |
|
| -> ("allocator" ::: Maybe AllocationCallbacks) |
|
| -> io DeviceMemory |
vkAllocateMemory - Allocate device memory
Description
Allocations returned by allocateMemory are guaranteed to meet any
alignment requirement of the implementation. For example, if an
implementation requires 128 byte alignment for images and 64 byte
alignment for buffers, the device memory returned through this mechanism
would be 128-byte aligned. This ensures that applications can
correctly suballocate objects of different types (with potentially
different alignment requirements) in the same memory object.
When memory is allocated, its contents are undefined with the following constraint:
- The contents of unprotected memory must not be a function of the contents of data protected memory objects, even if those memory objects were previously freed.
Note
The contents of memory allocated by one application should not be a function of data from protected memory objects of another application, even if those memory objects were previously freed.
The maximum number of valid memory allocations that can exist
simultaneously within a Device may be
restricted by implementation- or platform-dependent limits. The
maxMemoryAllocationCount
feature describes the number of allocations that can exist
simultaneously before encountering these internal limits.
Note
For historical reasons, if maxMemoryAllocationCount is exceeded, some
implementations may return
ERROR_TOO_MANY_OBJECTS. Exceeding this
limit will result in undefined behavior, and an application should not
rely on the use of the returned error code in order to identify when the
limit is reached.
Note
Many protected memory implementations involve complex hardware and
system software support, and often have additional and much lower limits
on the number of simultaneous protected memory allocations (from memory
types with the
MEMORY_PROPERTY_PROTECTED_BIT
property) than for non-protected memory allocations. These limits can be
system-wide, and depend on a variety of factors outside of the Vulkan
implementation, so they cannot be queried in Vulkan. Applications
should use as few allocations as possible from such memory types by
suballocating aggressively, and be prepared for allocation failure even
when there is apparently plenty of capacity remaining in the memory
heap. As a guideline, the Vulkan conformance test suite requires that at
least 80 minimum-size allocations can exist concurrently when no other
uses of protected memory are active in the system.
Some platforms may have a limit on the maximum size of a single
allocation. For example, certain systems may fail to create
allocations with a size greater than or equal to 4GB. Such a limit is
implementation-dependent, and if such a failure occurs then the error
ERROR_OUT_OF_DEVICE_MEMORY must be
returned. This limit is advertised in
PhysicalDeviceMaintenance3Properties::maxMemoryAllocationSize.
The cumulative memory size allocated to a heap can be limited by the
size of the specified heap. In such cases, allocated memory is tracked
on a per-device and per-heap basis. Some platforms allow overallocation
into other heaps. The overallocation behavior can be specified through
the VK_AMD_memory_overallocation_behavior extension.
If the
PhysicalDevicePageableDeviceLocalMemoryFeaturesEXT::pageableDeviceLocalMemory
feature is enabled, memory allocations made from a heap that includes
MEMORY_HEAP_DEVICE_LOCAL_BIT in
MemoryHeap::flags may be
transparently moved to host-local memory allowing multiple applications
to share device-local memory. If there is no space left in device-local
memory when this new allocation is made, other allocations may be
moved out transparently to make room. The operating system will
determine which allocations to move to device-local memory or host-local
memory based on platform-specific criteria. To help the operating system
make good choices, the application should set the appropriate memory
priority with
MemoryPriorityAllocateInfoEXT
and adjust it as necessary with
setDeviceMemoryPriorityEXT.
Higher priority allocations will moved to device-local memory first.
Memory allocations made on heaps without the
MEMORY_HEAP_DEVICE_LOCAL_BIT
property will not be transparently promoted to device-local memory by
the operating system.
Valid Usage
-
pAllocateInfo->allocationSizemust be less than or equal toPhysicalDeviceMemoryProperties::memoryHeaps[memindex].sizewherememindex=PhysicalDeviceMemoryProperties::memoryTypes[pAllocateInfo->memoryTypeIndex].heapIndexas returned bygetPhysicalDeviceMemoryPropertiesfor thePhysicalDevicethatdevicewas created from
-
pAllocateInfo->memoryTypeIndexmust be less thanPhysicalDeviceMemoryProperties::memoryTypeCountas returned bygetPhysicalDeviceMemoryPropertiesfor thePhysicalDevicethatdevicewas created from - If the
deviceCoherentMemory
feature is not enabled,
pAllocateInfo->memoryTypeIndexmust not identify a memory type supportingMEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD - There must
be less than
PhysicalDeviceLimits::maxMemoryAllocationCountdevice memory allocations currently allocated on the device
Valid Usage (Implicit)
-
devicemust be a validDevicehandle
-
pAllocateInfomust be a valid pointer to a validMemoryAllocateInfostructure - If
pAllocatoris notNULL,pAllocatormust be a valid pointer to a validAllocationCallbacksstructure -
pMemorymust be a valid pointer to aDeviceMemoryhandle
Return Codes
See Also
VK_VERSION_1_0,
AllocationCallbacks,
Device, DeviceMemory,
MemoryAllocateInfo
withMemory :: forall a io r. (Extendss MemoryAllocateInfo a, PokeChain a, MonadIO io) => Device -> MemoryAllocateInfo a -> Maybe AllocationCallbacks -> (io DeviceMemory -> (DeviceMemory -> io ()) -> r) -> r Source #
A convenience wrapper to make a compatible pair of calls to
allocateMemory and freeMemory
To ensure that freeMemory is always called: pass
bracket (or the allocate function from your
favourite resource management library) as the last argument.
To just extract the pair pass (,) as the last argument.
Arguments
| :: forall io. MonadIO io | |
| => Device |
|
| -> DeviceMemory |
|
| -> ("allocator" ::: Maybe AllocationCallbacks) |
|
| -> io () |
vkFreeMemory - Free device memory
Description
Before freeing a memory object, an application must ensure the memory object is no longer in use by the device — for example by command buffers in the pending state. Memory can be freed whilst still bound to resources, but those resources must not be used afterwards. Freeing a memory object releases the reference it held, if any, to its payload. If there are still any bound images or buffers, the memory object’s payload may not be immediately released by the implementation, but must be released by the time all bound images and buffers have been destroyed. Once all references to a payload are released, it is returned to the heap from which it was allocated.
How memory objects are bound to Images and Buffers is described in detail in the Resource Memory Association section.
If a memory object is mapped at the time it is freed, it is implicitly unmapped.
Note
As described below, host writes are not implicitly flushed when the memory object is unmapped, but the implementation must guarantee that writes that have not been flushed do not affect any other memory.
Valid Usage
Valid Usage (Implicit)
-
devicemust be a validDevicehandle
- If
memoryis notNULL_HANDLE,memorymust be a validDeviceMemoryhandle - If
pAllocatoris notNULL,pAllocatormust be a valid pointer to a validAllocationCallbacksstructure - If
memoryis a valid handle, it must have been created, allocated, or retrieved fromdevice
Host Synchronization
- Host access to
memorymust be externally synchronized
See Also
Arguments
| :: forall io. MonadIO io | |
| => Device |
|
| -> DeviceMemory |
|
| -> ("offset" ::: DeviceSize) |
|
| -> DeviceSize |
|
| -> MemoryMapFlags |
|
| -> io ("data" ::: Ptr ()) |
vkMapMemory - Map a memory object into application address space
Description
After a successful call to mapMemory the memory object memory is
considered to be currently host mapped.
Note
It is an application error to call mapMemory on a memory object that
is already host mapped.
Note
mapMemory will fail if the implementation is unable to allocate an
appropriately sized contiguous virtual address range, e.g. due to
virtual address space fragmentation or platform limits. In such cases,
mapMemory must return
ERROR_MEMORY_MAP_FAILED. The application
can improve the likelihood of success by reducing the size of the
mapped range and/or removing unneeded mappings using unmapMemory.
mapMemory does not check whether the device memory is currently in use
before returning the host-accessible pointer. The application must
guarantee that any previously submitted command that writes to this
range has completed before the host reads from or writes to that range,
and that any previously submitted command that reads from that range has
completed before the host writes to that region (see
here
for details on fulfilling such a guarantee). If the device memory was
allocated without the
MEMORY_PROPERTY_HOST_COHERENT_BIT
set, these guarantees must be made for an extended range: the
application must round down the start of the range to the nearest
multiple of
PhysicalDeviceLimits::nonCoherentAtomSize,
and round the end of the range up to the nearest multiple of
PhysicalDeviceLimits::nonCoherentAtomSize.
While a range of device memory is host mapped, the application is responsible for synchronizing both device and host access to that memory range.
Note
It is important for the application developer to become meticulously familiar with all of the mechanisms described in the chapter on Synchronization and Cache Control as they are crucial to maintaining memory access ordering.
Valid Usage
-
offsetmust be less than the size ofmemory - If
sizeis not equal toWHOLE_SIZE,sizemust be greater than0 - If
sizeis not equal toWHOLE_SIZE,sizemust be less than or equal to the size of thememoryminusoffset -
memorymust have been created with a memory type that reportsMEMORY_PROPERTY_HOST_VISIBLE_BIT -
memorymust not have been allocated with multiple instances
Valid Usage (Implicit)
-
devicemust be a validDevicehandle
-
memorymust be a validDeviceMemoryhandle -
flagsmust be0 -
ppDatamust be a valid pointer to a pointer value -
memorymust have been created, allocated, or retrieved fromdevice
Host Synchronization
- Host access to
memorymust be externally synchronized
Return Codes
See Also
VK_VERSION_1_0,
Device, DeviceMemory,
DeviceSize,
MemoryMapFlags
withMappedMemory :: forall io r. MonadIO io => Device -> DeviceMemory -> DeviceSize -> DeviceSize -> MemoryMapFlags -> (io (Ptr ()) -> (Ptr () -> io ()) -> r) -> r Source #
A convenience wrapper to make a compatible pair of calls to mapMemory
and unmapMemory
To ensure that unmapMemory is always called: pass
bracket (or the allocate function from your
favourite resource management library) as the last argument.
To just extract the pair pass (,) as the last argument.
Arguments
| :: forall io. MonadIO io | |
| => Device |
|
| -> DeviceMemory |
|
| -> io () |
vkUnmapMemory - Unmap a previously mapped memory object
Valid Usage
Valid Usage (Implicit)
-
devicemust be a validDevicehandle
-
memorymust be a validDeviceMemoryhandle -
memorymust have been created, allocated, or retrieved fromdevice
Host Synchronization
- Host access to
memorymust be externally synchronized
See Also
flushMappedMemoryRanges Source #
Arguments
| :: forall io. MonadIO io | |
| => Device |
|
| -> ("memoryRanges" ::: Vector MappedMemoryRange) |
|
| -> io () |
vkFlushMappedMemoryRanges - Flush mapped memory ranges
Description
flushMappedMemoryRanges guarantees that host writes to the memory
ranges described by pMemoryRanges are made available to the host
memory domain, such that they can be made available to the device
memory domain via
memory domain operations
using the ACCESS_HOST_WRITE_BIT
access type.
Within each range described by pMemoryRanges, each set of
nonCoherentAtomSize bytes in that range is flushed if any byte in that
set has been written by the host since it was first host mapped, or the
last time it was flushed. If pMemoryRanges includes sets of
nonCoherentAtomSize bytes where no bytes have been written by the
host, those bytes must not be flushed.
Unmapping non-coherent memory does not implicitly flush the host mapped memory, and host writes that have not been flushed may not ever be visible to the device. However, implementations must ensure that writes that have not been flushed do not become visible to any other memory.
Note
The above guarantee avoids a potential memory corruption in scenarios where host writes to a mapped memory object have not been flushed before the memory is unmapped (or freed), and the virtual address range is subsequently reused for a different mapping (or memory allocation).
Return Codes
See Also
invalidateMappedMemoryRanges Source #
Arguments
| :: forall io. MonadIO io | |
| => Device |
|
| -> ("memoryRanges" ::: Vector MappedMemoryRange) |
|
| -> io () |
vkInvalidateMappedMemoryRanges - Invalidate ranges of mapped memory objects
Description
invalidateMappedMemoryRanges guarantees that device writes to the
memory ranges described by pMemoryRanges, which have been made
available to the host memory domain using the
ACCESS_HOST_WRITE_BIT and
ACCESS_HOST_READ_BIT
access types,
are made visible to the host. If a range of non-coherent memory is
written by the host and then invalidated without first being flushed,
its contents are undefined.
Within each range described by pMemoryRanges, each set of
nonCoherentAtomSize bytes in that range is invalidated if any byte in
that set has been written by the device since it was first host mapped,
or the last time it was invalidated.
Note
Mapping non-coherent memory does not implicitly invalidate that memory.
Return Codes
See Also
getDeviceMemoryCommitment Source #
Arguments
| :: forall io. MonadIO io | |
| => Device |
|
| -> DeviceMemory |
|
| -> io ("committedMemoryInBytes" ::: DeviceSize) |
vkGetDeviceMemoryCommitment - Query the current commitment for a VkDeviceMemory
Description
The implementation may update the commitment at any time, and the value returned by this query may be out of date.
The implementation guarantees to allocate any committed memory from the
heapIndex indicated by the memory type that the memory object was
created with.
Valid Usage (Implicit)
See Also
data MemoryAllocateInfo (es :: [Type]) Source #
VkMemoryAllocateInfo - Structure containing parameters of a memory allocation
Description
The internal data of an allocated device memory object must include a
reference to implementation-specific resources, referred to as the
memory object’s payload. Applications can also import and export
that internal data to and from device memory objects to share data
between Vulkan instances and other compatible APIs. A
MemoryAllocateInfo structure defines a memory import operation if its
pNext chain includes one of the following structures:
ImportMemoryWin32HandleInfoKHRwith a non-zerohandleTypevalueImportMemoryFdInfoKHRwith a non-zerohandleTypevalueImportMemoryHostPointerInfoEXTwith a non-zerohandleTypevalueImportAndroidHardwareBufferInfoANDROIDwith a non-NULLbuffervalueImportMemoryZirconHandleInfoFUCHSIAwith a non-zerohandleTypevalueImportMemoryBufferCollectionFUCHSIA
If the parameters define an import operation and the external handle
type is
EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT,
EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT,
or
EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT,
allocationSize is ignored. The implementation must query the size of
these allocations from the OS.
Whether device memory objects constructed via a memory import operation hold a reference to their payload depends on the properties of the handle type used to perform the import, as defined below for each valid handle type. Importing memory must not modify the content of the memory. Implementations must ensure that importing memory does not enable the importing Vulkan instance to access any memory or resources in other Vulkan instances other than that corresponding to the memory object imported. Implementations must also ensure accessing imported memory which has not been initialized does not allow the importing Vulkan instance to obtain data from the exporting Vulkan instance or vice-versa.
Note
How exported and imported memory is isolated is left to the implementation, but applications should be aware that such isolation may prevent implementations from placing multiple exportable memory objects in the same physical or virtual page. Hence, applications should avoid creating many small external memory objects whenever possible.
Importing memory must not increase overall heap usage within a system. However, it must affect the following per-process values:
PhysicalDeviceMaintenance3Properties::maxMemoryAllocationCountPhysicalDeviceMemoryBudgetPropertiesEXT::heapUsage
When performing a memory import operation, it is the responsibility of
the application to ensure the external handles and their associated
payloads meet all valid usage requirements. However, implementations
must perform sufficient validation of external handles and payloads to
ensure that the operation results in a valid memory object which will
not cause program termination, device loss, queue stalls, or corruption
of other resources when used as allowed according to its allocation
parameters. If the external handle provided does not meet these
requirements, the implementation must fail the memory import operation
with the error code
ERROR_INVALID_EXTERNAL_HANDLE.
Valid Usage
- The parameters must not define more than one import operation
- If the parameters define an
import operation from an
BufferCollectionFUCHSIA, andMemoryDedicatedAllocateInfo::bufferis present and non-NULL,ImportMemoryBufferCollectionFUCHSIA::collectionandImportMemoryBufferCollectionFUCHSIA::indexmust matchBufferCollectionBufferCreateInfoFUCHSIA::collectionandBufferCollectionBufferCreateInfoFUCHSIA::index, respectively, of theBufferCollectionBufferCreateInfoFUCHSIAstructure used to create theMemoryDedicatedAllocateInfo::buffer - If the parameters define an
import operation from an
BufferCollectionFUCHSIA, andMemoryDedicatedAllocateInfo::imageis present and non-NULL,ImportMemoryBufferCollectionFUCHSIA::collectionandImportMemoryBufferCollectionFUCHSIA::indexmust matchBufferCollectionImageCreateInfoFUCHSIA::collectionandBufferCollectionImageCreateInfoFUCHSIA::index, respectively, of theBufferCollectionImageCreateInfoFUCHSIAstructure used to create theMemoryDedicatedAllocateInfo::image - If the parameters
define an import operation from an
BufferCollectionFUCHSIA,allocationSizemust matchMemoryRequirements::sizevalue retrieved bygetImageMemoryRequirementsorgetBufferMemoryRequirementsfor image-based or buffer-based collections respectively - If the parameters define an
import operation from an
BufferCollectionFUCHSIA, thepNextchain must include aMemoryDedicatedAllocateInfostructure with either itsimageorbufferfield set to a value other thanNULL_HANDLE. - If the parameters define an
import operation from an
BufferCollectionFUCHSIAandMemoryDedicatedAllocateInfo::imageis notNULL_HANDLE, theimagemust be created with aBufferCollectionImageCreateInfoFUCHSIAstructure chained to itsImageCreateInfo::pNextpointer - If the parameters define an
import operation from an
BufferCollectionFUCHSIAandMemoryDedicatedAllocateInfo::bufferis notNULL_HANDLE, thebuffermust be created with aBufferCollectionBufferCreateInfoFUCHSIAstructure chained to itsBufferCreateInfo::pNextpointer - If the parameters
define an import operation from an
BufferCollectionFUCHSIA,memoryTypeIndexmust be fromBufferCollectionPropertiesFUCHSIAas retrieved bygetBufferCollectionPropertiesFUCHSIA. - If the
pNextchain includes aExportMemoryAllocateInfostructure, and any of the handle types specified inExportMemoryAllocateInfo::handleTypesrequire a dedicated allocation, as reported bygetPhysicalDeviceImageFormatProperties2inExternalImageFormatProperties::externalMemoryProperties.externalMemoryFeaturesorExternalBufferProperties::externalMemoryProperties.externalMemoryFeatures, thepNextchain must include aMemoryDedicatedAllocateInfoorDedicatedAllocationMemoryAllocateInfoNVstructure with either itsimageorbuffermember set to a value other thanNULL_HANDLE - If the
pNextchain includes aExportMemoryAllocateInfostructure, it must not include aExportMemoryAllocateInfoNVorExportMemoryWin32HandleInfoNVstructure - If the
pNextchain includes aImportMemoryWin32HandleInfoKHRstructure, it must not include aImportMemoryWin32HandleInfoNVstructure - If the parameters
define an import operation, the external handle specified was
created by the Vulkan API, and the external handle type is
EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT, then the values ofallocationSizeandmemoryTypeIndexmust match those specified when the payload being imported was created - If the parameters define an
import operation and the external handle specified was created by
the Vulkan API, the device mask specified by
MemoryAllocateFlagsInfomust match the mask specified when the payload being imported was allocated - If the parameters define an
import operation and the external handle specified was created by
the Vulkan API, the list of physical devices that comprise the
logical device passed to
allocateMemorymust match the list of physical devices that comprise the logical device on which the payload was originally allocated - If the parameters
define an import operation and the external handle is an NT handle
or a global share handle created outside of the Vulkan API, the
value of
memoryTypeIndexmust be one of those returned bygetMemoryWin32HandlePropertiesKHR - If the parameters
define an import operation, the external handle was created by the
Vulkan API, and the external handle type is
EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BITorEXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT, then the values ofallocationSizeandmemoryTypeIndexmust match those specified when the payload being imported was created - If the parameters
define an import operation and the external handle type is
EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT,allocationSizemust match the size specified when creating the Direct3D 12 heap from which the payload was extracted - If the parameters
define an import operation and the external handle is a POSIX file
descriptor created outside of the Vulkan API, the value of
memoryTypeIndexmust be one of those returned bygetMemoryFdPropertiesKHR - If the protected
memory feature is not enabled, the
MemoryAllocateInfo::memoryTypeIndexmust not indicate a memory type that reportsMEMORY_PROPERTY_PROTECTED_BIT - If the parameters
define an import operation and the external handle is a host
pointer, the value of
memoryTypeIndexmust be one of those returned bygetMemoryHostPointerPropertiesEXT - If the parameters
define an import operation and the external handle is a host
pointer,
allocationSizemust be an integer multiple ofPhysicalDeviceExternalMemoryHostPropertiesEXT::minImportedHostPointerAlignment - If the parameters define an
import operation and the external handle is a host pointer, the
pNextchain must not include aDedicatedAllocationMemoryAllocateInfoNVstructure with either itsimageorbufferfield set to a value other thanNULL_HANDLE - If the parameters define an
import operation and the external handle is a host pointer, the
pNextchain must not include aMemoryDedicatedAllocateInfostructure with either itsimageorbufferfield set to a value other thanNULL_HANDLE - If the parameters
define an import operation and the external handle type is
EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID,allocationSizemust be the size returned bygetAndroidHardwareBufferPropertiesANDROIDfor the Android hardware buffer - If the parameters define an
import operation and the external handle type is
EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID, and thepNextchain does not include aMemoryDedicatedAllocateInfostructure orMemoryDedicatedAllocateInfo::imageisNULL_HANDLE, the Android hardware buffer must have aAHardwareBuffer_Desc::formatofAHARDWAREBUFFER_FORMAT_BLOBand aAHardwareBuffer_Desc::usagethat includesAHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER - If the parameters
define an import operation and the external handle type is
EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID,memoryTypeIndexmust be one of those returned bygetAndroidHardwareBufferPropertiesANDROIDfor the Android hardware buffer - If the parameters do not
define an import operation, and the
pNextchain includes aExportMemoryAllocateInfostructure withEXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROIDincluded in itshandleTypesmember, and thepNextchain includes aMemoryDedicatedAllocateInfostructure withimagenot equal toNULL_HANDLE, thenallocationSizemust be0, otherwiseallocationSizemust be greater than0 - If the parameters define an
import operation, the external handle is an Android hardware buffer,
and the
pNextchain includes aMemoryDedicatedAllocateInfowithimagethat is notNULL_HANDLE, the Android hardware buffer’sAHardwareBuffer::usagemust include at least one ofAHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER,AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGEorAHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER - If the parameters define an
import operation, the external handle is an Android hardware buffer,
and the
pNextchain includes aMemoryDedicatedAllocateInfowithimagethat is notNULL_HANDLE, the format ofimagemust beFORMAT_UNDEFINEDor the format returned bygetAndroidHardwareBufferPropertiesANDROIDinAndroidHardwareBufferFormatPropertiesANDROID::formatfor the Android hardware buffer - If the parameters define an
import operation, the external handle is an Android hardware buffer,
and the
pNextchain includes aMemoryDedicatedAllocateInfostructure withimagethat is notNULL_HANDLE, the width, height, and array layer dimensions ofimageand the Android hardware buffer’sAHardwareBuffer_Descmust be identical - If the parameters define an
import operation, the external handle is an Android hardware buffer,
and the
pNextchain includes aMemoryDedicatedAllocateInfostructure withimagethat is notNULL_HANDLE, and the Android hardware buffer’sAHardwareBuffer::usageincludesAHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE, theimagemust have a complete mipmap chain - If the parameters define an
import operation, the external handle is an Android hardware buffer,
and the
pNextchain includes aMemoryDedicatedAllocateInfostructure withimagethat is notNULL_HANDLE, and the Android hardware buffer’sAHardwareBuffer::usagedoes not includeAHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE, theimagemust have exactly one mipmap level - If the parameters define an
import operation, the external handle is an Android hardware buffer,
and the
pNextchain includes aMemoryDedicatedAllocateInfostructure withimagethat is notNULL_HANDLE, each bit set in the usage ofimagemust be listed in AHardwareBuffer Usage Equivalence, and if there is a correspondingAHARDWAREBUFFER_USAGEbit listed that bit must be included in the Android hardware buffer’sAHardwareBuffer_Desc::usage - If
MemoryOpaqueCaptureAddressAllocateInfo::opaqueCaptureAddressis not zero,MemoryAllocateFlagsInfo::flagsmust includeMEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT - If
MemoryAllocateFlagsInfo::flagsincludesMEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, the bufferDeviceAddressCaptureReplay feature must be enabled - If
MemoryAllocateFlagsInfo::flagsincludesMEMORY_ALLOCATE_DEVICE_ADDRESS_BIT, the bufferDeviceAddress feature must be enabled - If the
pNextchain includes aImportMemoryHostPointerInfoEXTstructure,MemoryOpaqueCaptureAddressAllocateInfo::opaqueCaptureAddressmust be zero - If the
parameters define an import operation,
MemoryOpaqueCaptureAddressAllocateInfo::opaqueCaptureAddressmust be zero - If the parameters define an
import operation and the external handle type is
EXTERNAL_MEMORY_HANDLE_TYPE_ZIRCON_VMO_BIT_FUCHSIA, the value ofmemoryTypeIndexmust be an index identifying a memory type from thememoryTypeBitsfield of theMemoryZirconHandlePropertiesFUCHSIAstructure populated by a call togetMemoryZirconHandlePropertiesFUCHSIA - If the parameters
define an import operation and the external handle type is
EXTERNAL_MEMORY_HANDLE_TYPE_ZIRCON_VMO_BIT_FUCHSIA, the value ofallocationSizemust be greater than0and must be less than or equal to the size of the VMO as determined byzx_vmo_get_size(handle) wherehandleis the VMO handle to the imported external memory
Valid Usage (Implicit)
-
sTypemust beSTRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
- Each
pNextmember of any structure (including this one) in thepNextchain must be eitherNULLor a pointer to a valid instance ofDedicatedAllocationMemoryAllocateInfoNV,ExportMemoryAllocateInfo,ExportMemoryAllocateInfoNV,ExportMemoryWin32HandleInfoKHR,ExportMemoryWin32HandleInfoNV,ImportAndroidHardwareBufferInfoANDROID,ImportMemoryBufferCollectionFUCHSIA,ImportMemoryFdInfoKHR,ImportMemoryHostPointerInfoEXT,ImportMemoryWin32HandleInfoKHR,ImportMemoryWin32HandleInfoNV,ImportMemoryZirconHandleInfoFUCHSIA,MemoryAllocateFlagsInfo,MemoryDedicatedAllocateInfo,MemoryOpaqueCaptureAddressAllocateInfo, orMemoryPriorityAllocateInfoEXT - The
sTypevalue of each struct in thepNextchain must be unique
See Also
Constructors
| MemoryAllocateInfo | |
Fields
| |
Instances
data MappedMemoryRange Source #
VkMappedMemoryRange - Structure specifying a mapped memory range
Valid Usage
- If
sizeis not equal toWHOLE_SIZE,offsetandsizemust specify a range contained within the currently mapped range ofmemory - If
sizeis equal toWHOLE_SIZE,offsetmust be within the currently mapped range ofmemory -
offsetmust be a multiple ofPhysicalDeviceLimits::nonCoherentAtomSize - If
sizeis equal toWHOLE_SIZE, the end of the current mapping ofmemorymust either be a multiple ofPhysicalDeviceLimits::nonCoherentAtomSizebytes from the beginning of the memory object, or be equal to the end of the memory object - If
sizeis not equal toWHOLE_SIZE,sizemust either be a multiple ofPhysicalDeviceLimits::nonCoherentAtomSize, oroffsetplussizemust equal the size ofmemory
Valid Usage (Implicit)
-
sTypemust beSTRUCTURE_TYPE_MAPPED_MEMORY_RANGE
-
pNextmust beNULL -
memorymust be a validDeviceMemoryhandle
See Also
VK_VERSION_1_0,
DeviceMemory,
DeviceSize,
StructureType,
flushMappedMemoryRanges, invalidateMappedMemoryRanges
Constructors
| MappedMemoryRange | |
Fields
| |
Instances
newtype MemoryMapFlags Source #
VkMemoryMapFlags - Reserved for future use
Description
MemoryMapFlags is a bitmask type for setting a mask, but is currently
reserved for future use.
See Also
Constructors
| MemoryMapFlags Flags |