public class VkSubresourceLayout
extends org.lwjgl.system.Struct
implements org.lwjgl.system.NativeResource
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 drmFormatModifierPlaneCount associated with the image's 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.
VkImageDrmFormatModifierExplicitCreateInfoEXT, GetImageSubresourceLayout
offset – the byte offset from the start of the image or the plane where the image subresource begins.size – the size in bytes of the image subresource. size includes any extra memory that is required based on rowPitch.rowPitch – describes the number of bytes between each row of texels in an image.arrayPitch – describes the number of bytes between each array layer of an image.depthPitch – describes the number of bytes between each slice of 3D image.
struct VkSubresourceLayout {
VkDeviceSize offset;
VkDeviceSize size;
VkDeviceSize rowPitch;
VkDeviceSize arrayPitch;
VkDeviceSize depthPitch;
}| Modifier and Type | Class and Description |
|---|---|
static class |
VkSubresourceLayout.Buffer
An array of
VkSubresourceLayout structs. |
| Modifier and Type | Field and Description |
|---|---|
static int |
ALIGNOF
The struct alignment in bytes.
|
static int |
ARRAYPITCH
The struct member offsets.
|
static int |
DEPTHPITCH
The struct member offsets.
|
static int |
OFFSET
The struct member offsets.
|
static int |
ROWPITCH
The struct member offsets.
|
static int |
SIZE
The struct member offsets.
|
static int |
SIZEOF
The struct size in bytes.
|
| Constructor and Description |
|---|
VkSubresourceLayout(java.nio.ByteBuffer container)
Creates a
VkSubresourceLayout instance at the current position of the specified ByteBuffer container. |
| Modifier and Type | Method and Description |
|---|---|
long |
arrayPitch()
Returns the value of the
arrayPitch field. |
static VkSubresourceLayout |
calloc()
Returns a new
VkSubresourceLayout instance allocated with memCalloc. |
static VkSubresourceLayout.Buffer |
calloc(int capacity)
Returns a new
VkSubresourceLayout.Buffer instance allocated with memCalloc. |
static VkSubresourceLayout |
callocStack()
Returns a new
VkSubresourceLayout instance allocated on the thread-local MemoryStack and initializes all its bits to zero. |
static VkSubresourceLayout.Buffer |
callocStack(int capacity)
Returns a new
VkSubresourceLayout.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero. |
static VkSubresourceLayout.Buffer |
callocStack(int capacity,
org.lwjgl.system.MemoryStack stack)
Returns a new
VkSubresourceLayout.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero. |
static VkSubresourceLayout |
callocStack(org.lwjgl.system.MemoryStack stack)
Returns a new
VkSubresourceLayout instance allocated on the specified MemoryStack and initializes all its bits to zero. |
static VkSubresourceLayout |
create()
Returns a new
VkSubresourceLayout instance allocated with BufferUtils. |
static VkSubresourceLayout.Buffer |
create(int capacity)
Returns a new
VkSubresourceLayout.Buffer instance allocated with BufferUtils. |
static VkSubresourceLayout |
create(long address)
Returns a new
VkSubresourceLayout instance for the specified memory address. |
static VkSubresourceLayout.Buffer |
create(long address,
int capacity)
Create a
VkSubresourceLayout.Buffer instance at the specified memory. |
static VkSubresourceLayout |
createSafe(long address)
|
static VkSubresourceLayout.Buffer |
createSafe(long address,
int capacity)
|
long |
depthPitch()
Returns the value of the
depthPitch field. |
static VkSubresourceLayout |
malloc()
Returns a new
VkSubresourceLayout instance allocated with memAlloc. |
static VkSubresourceLayout.Buffer |
malloc(int capacity)
Returns a new
VkSubresourceLayout.Buffer instance allocated with memAlloc. |
static VkSubresourceLayout |
mallocStack()
Returns a new
VkSubresourceLayout instance allocated on the thread-local MemoryStack. |
static VkSubresourceLayout.Buffer |
mallocStack(int capacity)
Returns a new
VkSubresourceLayout.Buffer instance allocated on the thread-local MemoryStack. |
static VkSubresourceLayout.Buffer |
mallocStack(int capacity,
org.lwjgl.system.MemoryStack stack)
Returns a new
VkSubresourceLayout.Buffer instance allocated on the specified MemoryStack. |
static VkSubresourceLayout |
mallocStack(org.lwjgl.system.MemoryStack stack)
Returns a new
VkSubresourceLayout instance allocated on the specified MemoryStack. |
static long |
narrayPitch(long struct)
Unsafe version of
arrayPitch(). |
static long |
ndepthPitch(long struct)
Unsafe version of
depthPitch(). |
static long |
noffset(long struct)
Unsafe version of
offset(). |
static long |
nrowPitch(long struct)
Unsafe version of
rowPitch(). |
static long |
nsize(long struct)
Unsafe version of
size(). |
long |
offset()
Returns the value of the
offset field. |
long |
rowPitch()
Returns the value of the
rowPitch field. |
long |
size()
Returns the value of the
size field. |
int |
sizeof() |
public static final int SIZEOF
public static final int ALIGNOF
public static final int OFFSET
public static final int SIZE
public static final int ROWPITCH
public static final int ARRAYPITCH
public static final int DEPTHPITCH
public VkSubresourceLayout(java.nio.ByteBuffer container)
VkSubresourceLayout instance at the current position of the specified ByteBuffer 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.
public int sizeof()
sizeof in class org.lwjgl.system.Structpublic long offset()
offset field.public long size()
size field.public long rowPitch()
rowPitch field.public long arrayPitch()
arrayPitch field.public long depthPitch()
depthPitch field.public static VkSubresourceLayout malloc()
VkSubresourceLayout instance allocated with memAlloc. The instance must be explicitly freed.public static VkSubresourceLayout calloc()
VkSubresourceLayout instance allocated with memCalloc. The instance must be explicitly freed.public static VkSubresourceLayout create()
VkSubresourceLayout instance allocated with BufferUtils.public static VkSubresourceLayout create(long address)
VkSubresourceLayout instance for the specified memory address.@Nullable public static VkSubresourceLayout createSafe(long address)
public static VkSubresourceLayout.Buffer malloc(int capacity)
VkSubresourceLayout.Buffer instance allocated with memAlloc. The instance must be explicitly freed.capacity - the buffer capacitypublic static VkSubresourceLayout.Buffer calloc(int capacity)
VkSubresourceLayout.Buffer instance allocated with memCalloc. The instance must be explicitly freed.capacity - the buffer capacitypublic static VkSubresourceLayout.Buffer create(int capacity)
VkSubresourceLayout.Buffer instance allocated with BufferUtils.capacity - the buffer capacitypublic static VkSubresourceLayout.Buffer create(long address, int capacity)
VkSubresourceLayout.Buffer instance at the specified memory.address - the memory addresscapacity - the buffer capacity@Nullable public static VkSubresourceLayout.Buffer createSafe(long address, int capacity)
public static VkSubresourceLayout mallocStack()
VkSubresourceLayout instance allocated on the thread-local MemoryStack.public static VkSubresourceLayout callocStack()
VkSubresourceLayout instance allocated on the thread-local MemoryStack and initializes all its bits to zero.public static VkSubresourceLayout mallocStack(org.lwjgl.system.MemoryStack stack)
VkSubresourceLayout instance allocated on the specified MemoryStack.stack - the stack from which to allocatepublic static VkSubresourceLayout callocStack(org.lwjgl.system.MemoryStack stack)
VkSubresourceLayout instance allocated on the specified MemoryStack and initializes all its bits to zero.stack - the stack from which to allocatepublic static VkSubresourceLayout.Buffer mallocStack(int capacity)
VkSubresourceLayout.Buffer instance allocated on the thread-local MemoryStack.capacity - the buffer capacitypublic static VkSubresourceLayout.Buffer callocStack(int capacity)
VkSubresourceLayout.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.capacity - the buffer capacitypublic static VkSubresourceLayout.Buffer mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
VkSubresourceLayout.Buffer instance allocated on the specified MemoryStack.stack - the stack from which to allocatecapacity - the buffer capacitypublic static VkSubresourceLayout.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
VkSubresourceLayout.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.stack - the stack from which to allocatecapacity - the buffer capacitypublic static long noffset(long struct)
offset().public static long nsize(long struct)
size().public static long nrowPitch(long struct)
rowPitch().public static long narrayPitch(long struct)
arrayPitch().public static long ndepthPitch(long struct)
depthPitch().Copyright LWJGL. All Rights Reserved. License terms.