Class VkSparseMemoryBind
- All Implemented Interfaces:
AutoCloseable,org.lwjgl.system.NativeResource,org.lwjgl.system.Pointer
Description
The binding range [resourceOffset, resourceOffset + size) has different constraints based on flags. If flags contains SPARSE_MEMORY_BIND_METADATA_BIT, the binding range must be within the mip tail region of the metadata aspect. This metadata region is defined by:
metadataRegion = [base, base + imageMipTailSize)base = imageMipTailOffset + imageMipTailStride × n
and imageMipTailOffset, imageMipTailSize, and imageMipTailStride values are from the VkSparseImageMemoryRequirements corresponding to the metadata aspect of the image, and n is a valid array layer index for the image,
imageMipTailStride is considered to be zero for aspects where VkSparseImageMemoryRequirements::formatProperties.flags contains SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT.
If flags does not contain SPARSE_MEMORY_BIND_METADATA_BIT, the binding range must be within the range [0,.VkMemoryRequirements::size)
Valid Usage
- If
memoryis notNULL_HANDLE,memoryandmemoryOffsetmust match the memory requirements of the resource, as described in section Resource Memory Association - If the resource being bound is a
VkBuffer,resourceOffset,memoryOffsetandsizemust be an integer multiple of thealignmentof theVkMemoryRequirementsstructure returned from a call toGetBufferMemoryRequirementswith the buffer resource - If the resource being bound is a
VkImage,resourceOffsetandmemoryOffsetmust be an integer multiple of thealignmentof theVkMemoryRequirementsstructure returned from a call toGetImageMemoryRequirementswith the image resource - If
memoryis notNULL_HANDLE,memorymust not have been created with a memory type that reportsMEMORY_PROPERTY_LAZILY_ALLOCATED_BITbit set sizemust be greater than 0resourceOffsetmust be less than the size of the resourcesizemust be less than or equal to the size of the resource minusresourceOffsetmemoryOffsetmust be less than the size ofmemorysizemust be less than or equal to the size ofmemoryminusmemoryOffset- If
memorywas created withVkExportMemoryAllocateInfo::handleTypesnot equal to 0, at least one handle type it contained must also have been set inVkExternalMemoryBufferCreateInfo::handleTypesorVkExternalMemoryImageCreateInfo::handleTypeswhen the resource was created - If
memorywas created by a memory import operation, the external handle type of the imported memory must also have been set inVkExternalMemoryBufferCreateInfo::handleTypesorVkExternalMemoryImageCreateInfo::handleTypeswhen the resource was created
Valid Usage (Implicit)
- If
memoryis notNULL_HANDLE,memorymust be a validVkDeviceMemoryhandle flagsmust be a valid combination ofVkSparseMemoryBindFlagBitsvalues
See Also
VkSparseBufferMemoryBindInfo, VkSparseImageOpaqueMemoryBindInfo
Layout
struct VkSparseMemoryBind {
VkDeviceSize resourceOffset();
VkDeviceSize size();
VkDeviceMemory memory();
VkDeviceSize memoryOffset();
VkSparseMemoryBindFlags flags();
}-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.lwjgl.system.Struct
org.lwjgl.system.Struct.StructValidationNested classes/interfaces inherited from interface org.lwjgl.system.Pointer
org.lwjgl.system.Pointer.Default -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe struct alignment in bytes.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct size in bytes.Fields inherited from interface org.lwjgl.system.Pointer
BITS32, BITS64, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionVkSparseMemoryBind(ByteBuffer container) Creates aVkSparseMemoryBindinstance at the current position of the specifiedByteBuffercontainer. -
Method Summary
Modifier and TypeMethodDescriptionstatic VkSparseMemoryBindcalloc()Returns a newVkSparseMemoryBindinstance allocated withmemCalloc.static VkSparseMemoryBind.Buffercalloc(int capacity) Returns a newVkSparseMemoryBind.Bufferinstance allocated withmemCalloc.static VkSparseMemoryBind.Buffercalloc(int capacity, org.lwjgl.system.MemoryStack stack) Returns a newVkSparseMemoryBind.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static VkSparseMemoryBindcalloc(org.lwjgl.system.MemoryStack stack) Returns a newVkSparseMemoryBindinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static VkSparseMemoryBindDeprecated.static VkSparseMemoryBind.BuffercallocStack(int capacity) Deprecated.static VkSparseMemoryBind.BuffercallocStack(int capacity, org.lwjgl.system.MemoryStack stack) Deprecated.static VkSparseMemoryBindcallocStack(org.lwjgl.system.MemoryStack stack) Deprecated.static VkSparseMemoryBindcreate()Returns a newVkSparseMemoryBindinstance allocated withBufferUtils.static VkSparseMemoryBind.Buffercreate(int capacity) Returns a newVkSparseMemoryBind.Bufferinstance allocated withBufferUtils.static VkSparseMemoryBindcreate(long address) Returns a newVkSparseMemoryBindinstance for the specified memory address.static VkSparseMemoryBind.Buffercreate(long address, int capacity) Create aVkSparseMemoryBind.Bufferinstance at the specified memory.static @Nullable VkSparseMemoryBindcreateSafe(long address) static @Nullable VkSparseMemoryBind.BuffercreateSafe(long address, int capacity) intflags()a bitmask ofVkSparseMemoryBindFlagBitsspecifying usage of the binding operation.flags(int value) Sets the specified value to theflags()field.static VkSparseMemoryBindmalloc()Returns a newVkSparseMemoryBindinstance allocated withmemAlloc.static VkSparseMemoryBind.Buffermalloc(int capacity) Returns a newVkSparseMemoryBind.Bufferinstance allocated withmemAlloc.static VkSparseMemoryBind.Buffermalloc(int capacity, org.lwjgl.system.MemoryStack stack) Returns a newVkSparseMemoryBind.Bufferinstance allocated on the specifiedMemoryStack.static VkSparseMemoryBindmalloc(org.lwjgl.system.MemoryStack stack) Returns a newVkSparseMemoryBindinstance allocated on the specifiedMemoryStack.static VkSparseMemoryBindDeprecated.static VkSparseMemoryBind.BuffermallocStack(int capacity) Deprecated.static VkSparseMemoryBind.BuffermallocStack(int capacity, org.lwjgl.system.MemoryStack stack) Deprecated.static VkSparseMemoryBindmallocStack(org.lwjgl.system.MemoryStack stack) Deprecated.longmemory()theVkDeviceMemoryobject that the range of the resource is bound to.memory(long value) Sets the specified value to thememory()field.longthe offset into theVkDeviceMemoryobject to bind the resource range to.memoryOffset(long value) Sets the specified value to thememoryOffset()field.static intnflags(long struct) Unsafe version offlags().static voidnflags(long struct, int value) Unsafe version offlags.static longnmemory(long struct) Unsafe version ofmemory().static voidnmemory(long struct, long value) Unsafe version ofmemory.static longnmemoryOffset(long struct) Unsafe version ofmemoryOffset().static voidnmemoryOffset(long struct, long value) Unsafe version ofmemoryOffset.static longnresourceOffset(long struct) Unsafe version ofresourceOffset().static voidnresourceOffset(long struct, long value) Unsafe version ofresourceOffset.static longnsize(long struct) Unsafe version ofsize().static voidnsize(long struct, long value) Unsafe version ofsize.longthe offset into the resource.resourceOffset(long value) Sets the specified value to theresourceOffset()field.set(long resourceOffset, long size, long memory, long memoryOffset, int flags) Initializes this struct with the specified values.set(VkSparseMemoryBind src) Copies the specified struct data to this struct.longsize()the size of the memory region to be bound.size(long value) Sets the specified value to thesize()field.intsizeof()Methods inherited from class org.lwjgl.system.Struct
clear, free, isNull, validate, validateMethods inherited from class org.lwjgl.system.Pointer.Default
address, equals, hashCode, toStringMethods inherited from interface org.lwjgl.system.NativeResource
close, free
-
Field Details
-
SIZEOF
public static final int SIZEOFThe struct size in bytes. -
ALIGNOF
public static final int ALIGNOFThe struct alignment in bytes. -
RESOURCEOFFSET
public static final int RESOURCEOFFSETThe struct member offsets. -
SIZE
public static final int SIZEThe struct member offsets. -
MEMORY
public static final int MEMORYThe struct member offsets. -
MEMORYOFFSET
public static final int MEMORYOFFSETThe struct member offsets. -
FLAGS
public static final int FLAGSThe struct member offsets.
-
-
Constructor Details
-
VkSparseMemoryBind
Creates aVkSparseMemoryBindinstance at the current position of the specifiedByteBuffercontainer. 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 Details
-
sizeof
public int sizeof()- Specified by:
sizeofin classorg.lwjgl.system.Struct<VkSparseMemoryBind>
-
resourceOffset
public long resourceOffset()the offset into the resource. -
size
public long size()the size of the memory region to be bound. -
memory
public long memory()theVkDeviceMemoryobject that the range of the resource is bound to. IfmemoryisNULL_HANDLE, the range is unbound. -
memoryOffset
public long memoryOffset()the offset into theVkDeviceMemoryobject to bind the resource range to. IfmemoryisNULL_HANDLE, this value is ignored. -
flags
public int flags()a bitmask ofVkSparseMemoryBindFlagBitsspecifying usage of the binding operation. -
resourceOffset
Sets the specified value to theresourceOffset()field. -
size
Sets the specified value to thesize()field. -
memory
Sets the specified value to thememory()field. -
memoryOffset
Sets the specified value to thememoryOffset()field. -
flags
Sets the specified value to theflags()field. -
set
public VkSparseMemoryBind set(long resourceOffset, long size, long memory, long memoryOffset, int flags) Initializes this struct with the specified values. -
set
Copies the specified struct data to this struct.- Parameters:
src- the source struct- Returns:
- this struct
-
malloc
Returns a newVkSparseMemoryBindinstance allocated withmemAlloc. The instance must be explicitly freed. -
calloc
Returns a newVkSparseMemoryBindinstance allocated withmemCalloc. The instance must be explicitly freed. -
create
Returns a newVkSparseMemoryBindinstance allocated withBufferUtils. -
create
Returns a newVkSparseMemoryBindinstance for the specified memory address. -
createSafe
-
malloc
Returns a newVkSparseMemoryBind.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
Returns a newVkSparseMemoryBind.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
Returns a newVkSparseMemoryBind.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
Create aVkSparseMemoryBind.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
createSafe
-
mallocStack
Deprecated.Deprecated for removal in 3.4.0. Usemalloc(MemoryStack)instead. -
callocStack
Deprecated.Deprecated for removal in 3.4.0. Usecalloc(MemoryStack)instead. -
mallocStack
Deprecated.Deprecated for removal in 3.4.0. Usemalloc(MemoryStack)instead. -
callocStack
Deprecated.Deprecated for removal in 3.4.0. Usecalloc(MemoryStack)instead. -
mallocStack
Deprecated.Deprecated for removal in 3.4.0. Usemalloc(int, MemoryStack)instead. -
callocStack
Deprecated.Deprecated for removal in 3.4.0. Usecalloc(int, MemoryStack)instead. -
mallocStack
@Deprecated public static VkSparseMemoryBind.Buffer mallocStack(int capacity, org.lwjgl.system.MemoryStack stack) Deprecated.Deprecated for removal in 3.4.0. Usemalloc(int, MemoryStack)instead. -
callocStack
@Deprecated public static VkSparseMemoryBind.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack) Deprecated.Deprecated for removal in 3.4.0. Usecalloc(int, MemoryStack)instead. -
malloc
Returns a newVkSparseMemoryBindinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
Returns a newVkSparseMemoryBindinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
malloc
Returns a newVkSparseMemoryBind.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
calloc
Returns a newVkSparseMemoryBind.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
nresourceOffset
public static long nresourceOffset(long struct) Unsafe version ofresourceOffset(). -
nsize
public static long nsize(long struct) Unsafe version ofsize(). -
nmemory
public static long nmemory(long struct) Unsafe version ofmemory(). -
nmemoryOffset
public static long nmemoryOffset(long struct) Unsafe version ofmemoryOffset(). -
nflags
public static int nflags(long struct) Unsafe version offlags(). -
nresourceOffset
public static void nresourceOffset(long struct, long value) Unsafe version ofresourceOffset. -
nsize
public static void nsize(long struct, long value) Unsafe version ofsize. -
nmemory
public static void nmemory(long struct, long value) Unsafe version ofmemory. -
nmemoryOffset
public static void nmemoryOffset(long struct, long value) Unsafe version ofmemoryOffset. -
nflags
public static void nflags(long struct, int value) Unsafe version offlags.
-