C Specification
To import memory from a host pointer, add a
VkImportMemoryHostPointerInfoEXT structure to the pNext
chain of
the VkMemoryAllocateInfo structure.
The VkImportMemoryHostPointerInfoEXT
structure is defined as:
typedef struct VkImportMemoryHostPointerInfoEXT {
VkStructureType sType;
const void* pNext;
VkExternalMemoryHandleTypeFlagBits handleType;
void* pHostPointer;
} VkImportMemoryHostPointerInfoEXT;
Members
-
sType
is the type of this structure. -
pNext
isNULL
or a pointer to an extension-specific structure. -
handleType
specifies the handle type. -
pHostPointer
is the host pointer to import from.
Description
Importing memory from a host pointer shares ownership of the memory between the host and the Vulkan implementation. The application can continue to access the memory through the host pointer but it is the application’s responsibility to synchronize device and non-device access to the underlying memory as defined in Host Access to Device Memory Objects.
Applications can import the same underlying memory into multiple instances of Vulkan and multiple times into a given Vulkan instance. However, implementations may fail to import the same underlying memory multiple times into a given physical device due to platform constraints.
Importing memory from a particular host pointer may not be possible due to
additional platform-specific restrictions beyond the scope of this
specification in which case the implementation must fail the memory import
operation with the error code VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR
.
The application must ensure that the imported memory range remains valid and accessible for the lifetime of the imported memory object.
Document Notes
For more information, see the Vulkan Specification
This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.
Copyright
Copyright (c) 2014-2019 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.