Class VkSubresourceLayout
- All Implemented Interfaces:
AutoCloseable,org.lwjgl.system.NativeResource,org.lwjgl.system.Pointer
Description
If the image is linear, then rowPitch, arrayPitch and depthPitch describe the layout of the image subresource in linear memory. For uncompressed formats, rowPitch is the number of bytes between texels with the same x coordinate in adjacent rows (y coordinates differ by one). arrayPitch is the number of bytes between texels with the same x and y coordinate in adjacent array layers of the image (array layer values differ by one). depthPitch is the number of bytes between texels with the same x and y coordinate in adjacent slices of a 3D image (z coordinates differ by one). Expressed as an addressing formula, the starting byte of a texel in the image subresource has address:
// (x,y,z,layer) are in texel coordinates
address(x,y,z,layer) = layer*arrayPitch + z*depthPitch + y*rowPitch + x*elementSize + offset
For compressed formats, the rowPitch is the number of bytes between compressed texel blocks in adjacent rows. arrayPitch is the number of bytes between compressed texel blocks in adjacent array layers. depthPitch is the number of bytes between compressed texel blocks in adjacent slices of a 3D image.
// (x,y,z,layer) are in compressed texel block coordinates
address(x,y,z,layer) = layer*arrayPitch + z*depthPitch + y*rowPitch + x*compressedTexelBlockByteSize + offset;
The value of arrayPitch is undefined for images that were not created as arrays. depthPitch is defined only for 3D images.
If the image has a single-plane color format and its tiling is IMAGE_TILING_LINEAR , then the aspectMask member of VkImageSubresource must be IMAGE_ASPECT_COLOR_BIT.
If the image has a depth/stencil format and its tiling is IMAGE_TILING_LINEAR , then aspectMask must be either IMAGE_ASPECT_DEPTH_BIT or IMAGE_ASPECT_STENCIL_BIT. On implementations that store depth and stencil aspects separately, querying each of these image subresource layouts will return a different offset and size representing the region of memory used for that aspect. On implementations that store depth and stencil aspects interleaved, the same offset and size are returned and represent the interleaved memory allocation.
If the image has a multi-planar format and its tiling is IMAGE_TILING_LINEAR , then the aspectMask member of VkImageSubresource must be IMAGE_ASPECT_PLANE_0_BIT, IMAGE_ASPECT_PLANE_1_BIT, or (for 3-plane formats only) IMAGE_ASPECT_PLANE_2_BIT. Querying each of these image subresource layouts will return a different offset and size representing the region of memory used for that plane. If the image is disjoint, then the offset is relative to the base address of the plane. If the image is non-disjoint, then the offset is relative to the base address of the image.
If the image’s tiling is IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT, then the aspectMask member of VkImageSubresource must be one of VK_IMAGE_ASPECT_MEMORY_PLANE_i_BIT_EXT, where the maximum allowed plane index i is defined by the VkDrmFormatModifierPropertiesEXT::drmFormatModifierPlaneCount associated with the image’s VkImageCreateInfo::format and modifier. The memory range used by the subresource is described by offset and size. If the image is disjoint, then the offset is relative to the base address of the memory plane. If the image is non-disjoint, then the offset is relative to the base address of the image. If the image is non-linear, then rowPitch, arrayPitch, and depthPitch have an implementation-dependent meaning.
See Also
VkImageDrmFormatModifierExplicitCreateInfoEXT, VkSubresourceLayout2, GetImageSubresourceLayout
Layout
struct VkSubresourceLayout {
VkDeviceSize offset();
VkDeviceSize size();
VkDeviceSize rowPitch();
VkDeviceSize arrayPitch();
VkDeviceSize depthPitch();
}-
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
ConstructorsConstructorDescriptionVkSubresourceLayout(ByteBuffer container) Creates aVkSubresourceLayoutinstance at the current position of the specifiedByteBuffercontainer. -
Method Summary
Modifier and TypeMethodDescriptionlongdescribes the number of bytes between each array layer of an image.arrayPitch(long value) Sets the specified value to thearrayPitch()field.static VkSubresourceLayoutcalloc()Returns a newVkSubresourceLayoutinstance allocated withmemCalloc.static VkSubresourceLayout.Buffercalloc(int capacity) Returns a newVkSubresourceLayout.Bufferinstance allocated withmemCalloc.static VkSubresourceLayout.Buffercalloc(int capacity, org.lwjgl.system.MemoryStack stack) Returns a newVkSubresourceLayout.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static VkSubresourceLayoutcalloc(org.lwjgl.system.MemoryStack stack) Returns a newVkSubresourceLayoutinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static VkSubresourceLayoutDeprecated.static VkSubresourceLayout.BuffercallocStack(int capacity) Deprecated.static VkSubresourceLayout.BuffercallocStack(int capacity, org.lwjgl.system.MemoryStack stack) Deprecated.static VkSubresourceLayoutcallocStack(org.lwjgl.system.MemoryStack stack) Deprecated.static VkSubresourceLayoutcreate()Returns a newVkSubresourceLayoutinstance allocated withBufferUtils.static VkSubresourceLayout.Buffercreate(int capacity) Returns a newVkSubresourceLayout.Bufferinstance allocated withBufferUtils.static VkSubresourceLayoutcreate(long address) Returns a newVkSubresourceLayoutinstance for the specified memory address.static VkSubresourceLayout.Buffercreate(long address, int capacity) Create aVkSubresourceLayout.Bufferinstance at the specified memory.static @Nullable VkSubresourceLayoutcreateSafe(long address) static @Nullable VkSubresourceLayout.BuffercreateSafe(long address, int capacity) longdescribes the number of bytes between each slice of 3D image.depthPitch(long value) Sets the specified value to thedepthPitch()field.static VkSubresourceLayoutmalloc()Returns a newVkSubresourceLayoutinstance allocated withmemAlloc.static VkSubresourceLayout.Buffermalloc(int capacity) Returns a newVkSubresourceLayout.Bufferinstance allocated withmemAlloc.static VkSubresourceLayout.Buffermalloc(int capacity, org.lwjgl.system.MemoryStack stack) Returns a newVkSubresourceLayout.Bufferinstance allocated on the specifiedMemoryStack.static VkSubresourceLayoutmalloc(org.lwjgl.system.MemoryStack stack) Returns a newVkSubresourceLayoutinstance allocated on the specifiedMemoryStack.static VkSubresourceLayoutDeprecated.static VkSubresourceLayout.BuffermallocStack(int capacity) Deprecated.static VkSubresourceLayout.BuffermallocStack(int capacity, org.lwjgl.system.MemoryStack stack) Deprecated.static VkSubresourceLayoutmallocStack(org.lwjgl.system.MemoryStack stack) Deprecated.static longnarrayPitch(long struct) Unsafe version ofarrayPitch().static voidnarrayPitch(long struct, long value) Unsafe version ofarrayPitch.static longndepthPitch(long struct) Unsafe version ofdepthPitch().static voidndepthPitch(long struct, long value) Unsafe version ofdepthPitch.static longnoffset(long struct) Unsafe version ofoffset().static voidnoffset(long struct, long value) Unsafe version ofoffset.static longnrowPitch(long struct) Unsafe version ofrowPitch().static voidnrowPitch(long struct, long value) Unsafe version ofrowPitch.static longnsize(long struct) Unsafe version ofsize().static voidnsize(long struct, long value) Unsafe version ofsize.longoffset()the byte offset from the start of the image or the plane where the image subresource begins.offset(long value) Sets the specified value to theoffset()field.longrowPitch()describes the number of bytes between each row of texels in an image.rowPitch(long value) Sets the specified value to therowPitch()field.set(long offset, long size, long rowPitch, long arrayPitch, long depthPitch) Initializes this struct with the specified values.set(VkSubresourceLayout src) Copies the specified struct data to this struct.longsize()the size in bytes of the image subresource.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. -
OFFSET
public static final int OFFSETThe struct member offsets. -
SIZE
public static final int SIZEThe struct member offsets. -
ROWPITCH
public static final int ROWPITCHThe struct member offsets. -
ARRAYPITCH
public static final int ARRAYPITCHThe struct member offsets. -
DEPTHPITCH
public static final int DEPTHPITCHThe struct member offsets.
-
-
Constructor Details
-
VkSubresourceLayout
Creates aVkSubresourceLayoutinstance 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<VkSubresourceLayout>
-
offset
public long offset()the byte offset from the start of the image or the plane where the image subresource begins. -
size
public long size()the size in bytes of the image subresource.sizeincludes any extra memory that is required based onrowPitch. -
rowPitch
public long rowPitch()describes the number of bytes between each row of texels in an image. -
arrayPitch
public long arrayPitch()describes the number of bytes between each array layer of an image. -
depthPitch
public long depthPitch()describes the number of bytes between each slice of 3D image. -
offset
Sets the specified value to theoffset()field. -
size
Sets the specified value to thesize()field. -
rowPitch
Sets the specified value to therowPitch()field. -
arrayPitch
Sets the specified value to thearrayPitch()field. -
depthPitch
Sets the specified value to thedepthPitch()field. -
set
public VkSubresourceLayout set(long offset, long size, long rowPitch, long arrayPitch, long depthPitch) 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 newVkSubresourceLayoutinstance allocated withmemAlloc. The instance must be explicitly freed. -
calloc
Returns a newVkSubresourceLayoutinstance allocated withmemCalloc. The instance must be explicitly freed. -
create
Returns a newVkSubresourceLayoutinstance allocated withBufferUtils. -
create
Returns a newVkSubresourceLayoutinstance for the specified memory address. -
createSafe
-
malloc
Returns a newVkSubresourceLayout.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
Returns a newVkSubresourceLayout.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
Returns a newVkSubresourceLayout.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
Create aVkSubresourceLayout.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 VkSubresourceLayout.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 VkSubresourceLayout.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack) Deprecated.Deprecated for removal in 3.4.0. Usecalloc(int, MemoryStack)instead. -
malloc
Returns a newVkSubresourceLayoutinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
Returns a newVkSubresourceLayoutinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
malloc
Returns a newVkSubresourceLayout.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
calloc
Returns a newVkSubresourceLayout.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
noffset
public static long noffset(long struct) Unsafe version ofoffset(). -
nsize
public static long nsize(long struct) Unsafe version ofsize(). -
nrowPitch
public static long nrowPitch(long struct) Unsafe version ofrowPitch(). -
narrayPitch
public static long narrayPitch(long struct) Unsafe version ofarrayPitch(). -
ndepthPitch
public static long ndepthPitch(long struct) Unsafe version ofdepthPitch(). -
noffset
public static void noffset(long struct, long value) Unsafe version ofoffset. -
nsize
public static void nsize(long struct, long value) Unsafe version ofsize. -
nrowPitch
public static void nrowPitch(long struct, long value) Unsafe version ofrowPitch. -
narrayPitch
public static void narrayPitch(long struct, long value) Unsafe version ofarrayPitch. -
ndepthPitch
public static void ndepthPitch(long struct, long value) Unsafe version ofdepthPitch.
-