Top Description Inners Fields Constructors Methods
org.lwjgl.vulkan

public Class VkMemoryAllocateInfo

extends Struct<VkMemoryAllocateInfo>
implements NativeResource
Class Inheritance
All Implemented Interfaces
org.lwjgl.system.NativeResource, java.lang.AutoCloseable
Imports
javax.annotation.*, java.nio.*, org.lwjgl.*, org.lwjgl.system.*

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 VkMemoryAllocateInfo structure defines a memory import operation if its pNext chain includes one of the following structures:

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:

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. If the parameters define an export operation and the external handle type is EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID, implementations should not strictly follow memoryTypeIndex. Instead, they should modify the allocation internally to use the required memory type for the application’s given usage. This is because for an export operation, there is currently no way for the client to know the memory type index before allocating.

Valid Usage
Valid Usage (Implicit)
See Also

AllocateMemory

Layout


struct VkMemoryAllocateInfo {
    VkStructureType sType;
    void const * pNext;
    VkDeviceSize allocationSize;
    uint32_t memoryTypeIndex;
}

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public static final int
ALIGNOF

The struct alignment in bytes.

public static final int
ALLOCATIONSIZE

The struct member offsets.

public static final int
MEMORYTYPEINDEX

The struct member offsets.

public static final int
PNEXT

The struct member offsets.

public static final int
SIZEOF

The struct size in bytes.

public static final int
STYPE

The struct member offsets.

Inherited from org.lwjgl.system.Struct:
containerDEFAULT_ALIGN_ASDEFAULT_PACK_ALIGNMENT

Constructor Summary

AccessConstructor and Description
protected
VkMemoryAllocateInfo(long address, ByteBuffer container)

public
VkMemoryAllocateInfo(ByteBuffer container)

Creates a VkMemoryAllocateInfo instance at the current position of the specified ByteBuffer container.

Method Summary

Modifier and TypeMethod and Description
public long
allocationSize()

the size of the allocation in bytes.

public VkMemoryAllocateInfo
allocationSize(long value)

Sets the specified value to the allocationSize field.

public static VkMemoryAllocateInfo
calloc()

Returns a new VkMemoryAllocateInfo instance allocated with memCalloc.

public static VkMemoryAllocateInfo.Buffer
calloc(int
the buffer capacity
capacity
)

Returns a new VkMemoryAllocateInfo.Buffer instance allocated with memCalloc.

public static VkMemoryAllocateInfo
calloc(MemoryStack
the stack from which to allocate
stack
)

Returns a new VkMemoryAllocateInfo instance allocated on the specified MemoryStack and initializes all its bits to zero.

public static VkMemoryAllocateInfo.Buffer
calloc(int
the buffer capacity
capacity
,
MemoryStack
the stack from which to allocate
stack
)

Returns a new VkMemoryAllocateInfo.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.

public static VkMemoryAllocateInfo
callocStack()

Deprecated
Deprecated for removal in 3.4.0.
public static VkMemoryAllocateInfo
callocStack(MemoryStack stack)

Deprecated
Deprecated for removal in 3.4.0.
public static VkMemoryAllocateInfo.Buffer
callocStack(int capacity)

Deprecated
Deprecated for removal in 3.4.0.
public static VkMemoryAllocateInfo.Buffer
callocStack(int capacity, MemoryStack stack)

Deprecated
Deprecated for removal in 3.4.0.
protected VkMemoryAllocateInfo
create(long
the struct memory address
address
,
ByteBuffer
an optional container buffer, to be referenced strongly by the struct instance.
container
)

Implements abstract org.lwjgl.system.Struct.create.

Similar to the constructor, but returns the exact type of the Struct subclass.
public static VkMemoryAllocateInfo
create()

Returns a new VkMemoryAllocateInfo instance allocated with BufferUtils.

public static VkMemoryAllocateInfo
create(long address)

Returns a new VkMemoryAllocateInfo instance for the specified memory address.

public static VkMemoryAllocateInfo.Buffer
create(int
the buffer capacity
capacity
)

Returns a new VkMemoryAllocateInfo.Buffer instance allocated with BufferUtils.

public static VkMemoryAllocateInfo.Buffer
create(long
the memory address
address
,
int
the buffer capacity
capacity
)

Create a VkMemoryAllocateInfo.Buffer instance at the specified memory.

public static VkMemoryAllocateInfo
createSafe(long address)

Like create, but returns null if address is NULL.

public static VkMemoryAllocateInfo.Buffer
createSafe(long address, int capacity)

Like create, but returns null if address is NULL.

public static VkMemoryAllocateInfo
malloc()

Returns a new VkMemoryAllocateInfo instance allocated with memAlloc.

public static VkMemoryAllocateInfo.Buffer
malloc(int
the buffer capacity
capacity
)

Returns a new VkMemoryAllocateInfo.Buffer instance allocated with memAlloc.

public static VkMemoryAllocateInfo
malloc(MemoryStack
the stack from which to allocate
stack
)

Returns a new VkMemoryAllocateInfo instance allocated on the specified MemoryStack.

public static VkMemoryAllocateInfo.Buffer
malloc(int
the buffer capacity
capacity
,
MemoryStack
the stack from which to allocate
stack
)

Returns a new VkMemoryAllocateInfo.Buffer instance allocated on the specified MemoryStack.

public static VkMemoryAllocateInfo
mallocStack()

Deprecated
Deprecated for removal in 3.4.0.
public static VkMemoryAllocateInfo
mallocStack(MemoryStack stack)

Deprecated
Deprecated for removal in 3.4.0.
public static VkMemoryAllocateInfo.Buffer
mallocStack(int capacity)

Deprecated
Deprecated for removal in 3.4.0.
public static VkMemoryAllocateInfo.Buffer
mallocStack(int capacity, MemoryStack stack)

Deprecated
Deprecated for removal in 3.4.0.
public int
memoryTypeIndex()

an index identifying a memory type from the memoryTypes array of the VkPhysicalDeviceMemoryProperties structure.

public VkMemoryAllocateInfo
memoryTypeIndex(int value)

Sets the specified value to the memoryTypeIndex field.

public static long
nallocationSize(long struct)

Unsafe version of allocationSize.

public static void
nallocationSize(long struct, long value)

Unsafe version of allocationSize.

public static int
nmemoryTypeIndex(long struct)

Unsafe version of memoryTypeIndex.

public static void
nmemoryTypeIndex(long struct, int value)

Unsafe version of memoryTypeIndex.

public static long
npNext(long struct)

Unsafe version of pNext.

public static void
npNext(long struct, long value)

Unsafe version of pNext.

public static int
nsType(long struct)

Unsafe version of sType.

public static void
nsType(long struct, int value)

Unsafe version of sType.

public long
pNext()

NULL or a pointer to a structure extending this structure.

public VkMemoryAllocateInfo
pNext(long value)

Sets the specified value to the pNext field.

public VkMemoryAllocateInfo
pNext(VkDedicatedAllocationMemoryAllocateInfoNV value)

Prepends the specified VkDedicatedAllocationMemoryAllocateInfoNV value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkExportMemoryAllocateInfo value)

Prepends the specified VkExportMemoryAllocateInfo value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkExportMemoryAllocateInfoKHR value)

Prepends the specified VkExportMemoryAllocateInfoKHR value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkExportMemoryAllocateInfoNV value)

Prepends the specified VkExportMemoryAllocateInfoNV value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkExportMemoryWin32HandleInfoKHR value)

Prepends the specified VkExportMemoryWin32HandleInfoKHR value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkExportMemoryWin32HandleInfoNV value)

Prepends the specified VkExportMemoryWin32HandleInfoNV value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkExportMetalObjectCreateInfoEXT value)

Prepends the specified VkExportMetalObjectCreateInfoEXT value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkImportAndroidHardwareBufferInfoANDROID value)

Prepends the specified VkImportAndroidHardwareBufferInfoANDROID value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkImportMemoryFdInfoKHR value)

Prepends the specified VkImportMemoryFdInfoKHR value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkImportMemoryHostPointerInfoEXT value)

Prepends the specified VkImportMemoryHostPointerInfoEXT value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkImportMemoryWin32HandleInfoKHR value)

Prepends the specified VkImportMemoryWin32HandleInfoKHR value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkImportMemoryWin32HandleInfoNV value)

Prepends the specified VkImportMemoryWin32HandleInfoNV value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkImportMetalBufferInfoEXT value)

Prepends the specified VkImportMetalBufferInfoEXT value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkMemoryAllocateFlagsInfo value)

Prepends the specified VkMemoryAllocateFlagsInfo value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkMemoryAllocateFlagsInfoKHR value)

Prepends the specified VkMemoryAllocateFlagsInfoKHR value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkMemoryDedicatedAllocateInfo value)

Prepends the specified VkMemoryDedicatedAllocateInfo value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkMemoryDedicatedAllocateInfoKHR value)

Prepends the specified VkMemoryDedicatedAllocateInfoKHR value to the pNext chain.

public VkMemoryAllocateInfo
pNext(VkMemoryOpaqueCaptureAddressAllocateInfo value)

Prepends the specified VkMemoryOpaqueCaptureAddressAllocateInfo value to the pNext chain.

public VkMemoryAllocateInfo
public VkMemoryAllocateInfo
pNext(VkMemoryPriorityAllocateInfoEXT value)

Prepends the specified VkMemoryPriorityAllocateInfoEXT value to the pNext chain.

public VkMemoryAllocateInfo
set(int sType, long pNext, long allocationSize, int memoryTypeIndex)

Initializes this struct with the specified values.

public VkMemoryAllocateInfo

Returns:

this struct
set
(VkMemoryAllocateInfo
the source struct
src
)

Copies the specified struct data to this struct.

public int
sizeof()

Implements abstract org.lwjgl.system.Struct.sizeof.

Returns sizeof(struct).
public int
sType()

a VkStructureType value identifying this structure.

public VkMemoryAllocateInfo
sType(int value)

Sets the specified value to the sType field.

public VkMemoryAllocateInfo
Inherited from org.lwjgl.system.Struct:
__array__array__array__checkContainer__checkMalloc__create__getContainer__getContainer__member__member__member__padding__padding__struct__struct__union__unionclearfreeisNullvalidate