Class VkMemoryAllocateInfo
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.Struct
-
- org.lwjgl.vulkan.VkMemoryAllocateInfo
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,org.lwjgl.system.NativeResource
,org.lwjgl.system.Pointer
public class VkMemoryAllocateInfo extends org.lwjgl.system.Struct implements org.lwjgl.system.NativeResource
Structure containing parameters of a memory allocation.Description
An instance of the
VkMemoryAllocateInfo
structure defines a memory import operation if thepNext
chain contains an instance of one of the following structures:VkImportMemoryWin32HandleInfoKHR
with non-zerohandleType
valueVkImportMemoryFdInfoKHR
with a non-zerohandleType
valueVkImportMemoryHostPointerInfoEXT
with a non-zerohandleType
value
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.
When performing a memory import operation, it is the responsibility of the application to ensure the external handles meet all valid usage requirements. However, implementations must perform sufficient validation of external handles 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
allocationSize
must be greater than 0- If the
pNext
chain contains an instance ofVkExportMemoryAllocateInfo
, and any of the handle types specified inVkExportMemoryAllocateInfo
::handleTypes
require a dedicated allocation, as reported byGetPhysicalDeviceImageFormatProperties2
inVkExternalImageFormatProperties
::externalMemoryProperties
::externalMemoryFeatures
orVkExternalBufferProperties
::externalMemoryProperties
::externalMemoryFeatures
, thepNext
chain must contain an instance ofVkMemoryDedicatedAllocateInfo
orVkDedicatedAllocationMemoryAllocateInfoNV
with either itsimage
orbuffer
field set to a value other thanNULL_HANDLE
. - If the
pNext
chain contains an instance ofVkExportMemoryAllocateInfo
, it must not contain an instance ofVkExportMemoryAllocateInfoNV
orVkExportMemoryWin32HandleInfoNV
. - If the
pNext
chain contains an instance ofVkImportMemoryWin32HandleInfoKHR
, it must not contain an instance ofVkImportMemoryWin32HandleInfoNV
. - 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_KHR
, then the values ofallocationSize
andmemoryTypeIndex
must match those specified when the memory object 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
VkMemoryAllocateFlagsInfo
must match that specified when the memory object 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
AllocateMemory
must match the list of physical devices that comprise the logical device on which the memory 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
memoryTypeIndex
must 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_BIT_KHR
orEXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR
, then the values ofallocationSize
andmemoryTypeIndex
must match those specified when the memory object being imported was created. - 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
, orEXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT
,allocationSize
must match the size reported in the memory requirements of theimage
orbuffer
member of the instance ofVkDedicatedAllocationMemoryAllocateInfoNV
included in thepNext
chain. - If the parameters define an import operation and the external handle type is
EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT
,allocationSize
must match the size specified when creating the Direct3D 12 heap from which the external handle 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
memoryTypeIndex
must be one of those returned byGetMemoryFdPropertiesKHR
. - If the protected memory feature is not enabled, the
VkMemoryAllocateInfo
::memoryTypeIndex
must 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
memoryTypeIndex
must be one of those returned byGetMemoryHostPointerPropertiesEXT
- If the parameters define an import operation and the external handle is a host pointer,
allocationSize
must be an integer multiple ofVkPhysicalDeviceExternalMemoryHostPropertiesEXT
::minImportedHostPointerAlignment
Valid Usage (Implicit)
sType
must beSTRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
- Each
pNext
member of any structure (including this one) in thepNext
chain must be eitherNULL
or a pointer to a valid instance ofVkDedicatedAllocationMemoryAllocateInfoNV
,VkExportMemoryAllocateInfo
,VkExportMemoryAllocateInfoNV
,VkExportMemoryWin32HandleInfoKHR
,VkExportMemoryWin32HandleInfoNV
,VkImportMemoryFdInfoKHR
,VkImportMemoryHostPointerInfoEXT
,VkImportMemoryWin32HandleInfoKHR
,VkImportMemoryWin32HandleInfoNV
,VkMemoryAllocateFlagsInfo
,VkMemoryDedicatedAllocateInfo
, orVkMemoryPriorityAllocateInfoEXT
- Each
sType
member in thepNext
chain must be unique
See Also
Member documentation
sType
– the type of this structure.pNext
–NULL
or a pointer to an extension-specific structure.allocationSize
– the size of the allocation in bytesmemoryTypeIndex
– an index identifying a memory type from thememoryTypes
array of theVkPhysicalDeviceMemoryProperties
structure
Layout
struct VkMemoryAllocateInfo { VkStructureType sType; void const * pNext; VkDeviceSize allocationSize; uint32_t memoryTypeIndex; }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VkMemoryAllocateInfo.Buffer
An array ofVkMemoryAllocateInfo
structs.
-
Field Summary
Fields Modifier and Type Field Description static int
ALIGNOF
The struct alignment in bytes.static int
ALLOCATIONSIZE
MEMORYTYPEINDEX
PNEXTThe struct member offsets.static int
SIZEOF
The struct size in bytes.static int
STYPE
The struct member offsets.
-
Constructor Summary
Constructors Constructor Description VkMemoryAllocateInfo(java.nio.ByteBuffer container)
Creates aVkMemoryAllocateInfo
instance at the current position of the specifiedByteBuffer
container.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
allocationSize()
Returns the value of theallocationSize
field.VkMemoryAllocateInfo
allocationSize(long value)
Sets the specified value to theallocationSize
field.static VkMemoryAllocateInfo
calloc()
Returns a newVkMemoryAllocateInfo
instance allocated withmemCalloc
.static VkMemoryAllocateInfo.Buffer
calloc(int capacity)
Returns a newVkMemoryAllocateInfo.Buffer
instance allocated withmemCalloc
.static VkMemoryAllocateInfo
callocStack()
Returns a newVkMemoryAllocateInfo
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.static VkMemoryAllocateInfo.Buffer
callocStack(int capacity)
Returns a newVkMemoryAllocateInfo.Buffer
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.static VkMemoryAllocateInfo.Buffer
callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newVkMemoryAllocateInfo.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static VkMemoryAllocateInfo
callocStack(org.lwjgl.system.MemoryStack stack)
Returns a newVkMemoryAllocateInfo
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static VkMemoryAllocateInfo
create()
Returns a newVkMemoryAllocateInfo
instance allocated withBufferUtils
.static VkMemoryAllocateInfo.Buffer
create(int capacity)
Returns a newVkMemoryAllocateInfo.Buffer
instance allocated withBufferUtils
.static VkMemoryAllocateInfo
create(long address)
Returns a newVkMemoryAllocateInfo
instance for the specified memory address.static VkMemoryAllocateInfo.Buffer
create(long address, int capacity)
Create aVkMemoryAllocateInfo.Buffer
instance at the specified memory.static VkMemoryAllocateInfo
createSafe(long address)
static VkMemoryAllocateInfo.Buffer
createSafe(long address, int capacity)
static VkMemoryAllocateInfo
malloc()
Returns a newVkMemoryAllocateInfo
instance allocated withmemAlloc
.static VkMemoryAllocateInfo.Buffer
malloc(int capacity)
Returns a newVkMemoryAllocateInfo.Buffer
instance allocated withmemAlloc
.static VkMemoryAllocateInfo
mallocStack()
Returns a newVkMemoryAllocateInfo
instance allocated on the thread-localMemoryStack
.static VkMemoryAllocateInfo.Buffer
mallocStack(int capacity)
Returns a newVkMemoryAllocateInfo.Buffer
instance allocated on the thread-localMemoryStack
.static VkMemoryAllocateInfo.Buffer
mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newVkMemoryAllocateInfo.Buffer
instance allocated on the specifiedMemoryStack
.static VkMemoryAllocateInfo
mallocStack(org.lwjgl.system.MemoryStack stack)
Returns a newVkMemoryAllocateInfo
instance allocated on the specifiedMemoryStack
.int
memoryTypeIndex()
Returns the value of thememoryTypeIndex
field.VkMemoryAllocateInfo
memoryTypeIndex(int value)
Sets the specified value to thememoryTypeIndex
field.static long
nallocationSize(long struct)
Unsafe version ofallocationSize()
.static void
nallocationSize(long struct, long value)
Unsafe version ofallocationSize
.static int
nmemoryTypeIndex(long struct)
Unsafe version ofmemoryTypeIndex()
.static void
nmemoryTypeIndex(long struct, int value)
Unsafe version ofmemoryTypeIndex
.static long
npNext(long struct)
Unsafe version ofpNext()
.static void
npNext(long struct, long value)
Unsafe version ofpNext
.static int
nsType(long struct)
Unsafe version ofsType()
.static void
nsType(long struct, int value)
Unsafe version ofsType
.long
pNext()
Returns the value of thepNext
field.VkMemoryAllocateInfo
pNext(long value)
Sets the specified value to thepNext
field.VkMemoryAllocateInfo
set(int sType, long pNext, long allocationSize, int memoryTypeIndex)
Initializes this struct with the specified values.VkMemoryAllocateInfo
set(VkMemoryAllocateInfo src)
Copies the specified struct data to this struct.int
sizeof()
int
sType()
Returns the value of thesType
field.VkMemoryAllocateInfo
sType(int value)
Sets the specified value to thesType
field.
-
-
-
Constructor Detail
-
VkMemoryAllocateInfo
public VkMemoryAllocateInfo(java.nio.ByteBuffer container)
Creates aVkMemoryAllocateInfo
instance at the current position of the specifiedByteBuffer
container. Changes to the buffer's content will be visible to the struct instance and vice versa.The created instance holds a strong reference to the container object.
-
-
Method Detail
-
sizeof
public int sizeof()
- Specified by:
sizeof
in classorg.lwjgl.system.Struct
-
sType
public int sType()
Returns the value of thesType
field.
-
pNext
public long pNext()
Returns the value of thepNext
field.
-
allocationSize
public long allocationSize()
Returns the value of theallocationSize
field.
-
memoryTypeIndex
public int memoryTypeIndex()
Returns the value of thememoryTypeIndex
field.
-
sType
public VkMemoryAllocateInfo sType(int value)
Sets the specified value to thesType
field.
-
pNext
public VkMemoryAllocateInfo pNext(long value)
Sets the specified value to thepNext
field.
-
allocationSize
public VkMemoryAllocateInfo allocationSize(long value)
Sets the specified value to theallocationSize
field.
-
memoryTypeIndex
public VkMemoryAllocateInfo memoryTypeIndex(int value)
Sets the specified value to thememoryTypeIndex
field.
-
set
public VkMemoryAllocateInfo set(int sType, long pNext, long allocationSize, int memoryTypeIndex)
Initializes this struct with the specified values.
-
set
public VkMemoryAllocateInfo set(VkMemoryAllocateInfo src)
Copies the specified struct data to this struct.- Parameters:
src
- the source struct- Returns:
- this struct
-
malloc
public static VkMemoryAllocateInfo malloc()
Returns a newVkMemoryAllocateInfo
instance allocated withmemAlloc
. The instance must be explicitly freed.
-
calloc
public static VkMemoryAllocateInfo calloc()
Returns a newVkMemoryAllocateInfo
instance allocated withmemCalloc
. The instance must be explicitly freed.
-
create
public static VkMemoryAllocateInfo create()
Returns a newVkMemoryAllocateInfo
instance allocated withBufferUtils
.
-
create
public static VkMemoryAllocateInfo create(long address)
Returns a newVkMemoryAllocateInfo
instance for the specified memory address.
-
createSafe
@Nullable public static VkMemoryAllocateInfo createSafe(long address)
-
malloc
public static VkMemoryAllocateInfo.Buffer malloc(int capacity)
Returns a newVkMemoryAllocateInfo.Buffer
instance allocated withmemAlloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
calloc
public static VkMemoryAllocateInfo.Buffer calloc(int capacity)
Returns a newVkMemoryAllocateInfo.Buffer
instance allocated withmemCalloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
create
public static VkMemoryAllocateInfo.Buffer create(int capacity)
Returns a newVkMemoryAllocateInfo.Buffer
instance allocated withBufferUtils
.- Parameters:
capacity
- the buffer capacity
-
create
public static VkMemoryAllocateInfo.Buffer create(long address, int capacity)
Create aVkMemoryAllocateInfo.Buffer
instance at the specified memory.- Parameters:
address
- the memory addresscapacity
- the buffer capacity
-
createSafe
@Nullable public static VkMemoryAllocateInfo.Buffer createSafe(long address, int capacity)
-
mallocStack
public static VkMemoryAllocateInfo mallocStack()
Returns a newVkMemoryAllocateInfo
instance allocated on the thread-localMemoryStack
.
-
callocStack
public static VkMemoryAllocateInfo callocStack()
Returns a newVkMemoryAllocateInfo
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.
-
mallocStack
public static VkMemoryAllocateInfo mallocStack(org.lwjgl.system.MemoryStack stack)
Returns a newVkMemoryAllocateInfo
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocate
-
callocStack
public static VkMemoryAllocateInfo callocStack(org.lwjgl.system.MemoryStack stack)
Returns a newVkMemoryAllocateInfo
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
stack
- the stack from which to allocate
-
mallocStack
public static VkMemoryAllocateInfo.Buffer mallocStack(int capacity)
Returns a newVkMemoryAllocateInfo.Buffer
instance allocated on the thread-localMemoryStack
.- Parameters:
capacity
- the buffer capacity
-
callocStack
public static VkMemoryAllocateInfo.Buffer callocStack(int capacity)
Returns a newVkMemoryAllocateInfo.Buffer
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.- Parameters:
capacity
- the buffer capacity
-
mallocStack
public static VkMemoryAllocateInfo.Buffer mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newVkMemoryAllocateInfo.Buffer
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocatecapacity
- the buffer capacity
-
callocStack
public static VkMemoryAllocateInfo.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newVkMemoryAllocateInfo.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
stack
- the stack from which to allocatecapacity
- the buffer capacity
-
nsType
public static int nsType(long struct)
Unsafe version ofsType()
.
-
npNext
public static long npNext(long struct)
Unsafe version ofpNext()
.
-
nallocationSize
public static long nallocationSize(long struct)
Unsafe version ofallocationSize()
.
-
nmemoryTypeIndex
public static int nmemoryTypeIndex(long struct)
Unsafe version ofmemoryTypeIndex()
.
-
nsType
public static void nsType(long struct, int value)
Unsafe version ofsType
.
-
npNext
public static void npNext(long struct, long value)
Unsafe version ofpNext
.
-
nallocationSize
public static void nallocationSize(long struct, long value)
Unsafe version ofallocationSize
.
-
nmemoryTypeIndex
public static void nmemoryTypeIndex(long struct, int value)
Unsafe version ofmemoryTypeIndex
.
-
-