Class VkSubresourceLayout
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.Struct
-
- org.lwjgl.vulkan.VkSubresourceLayout
-
- All Implemented Interfaces:
java.lang.AutoCloseable,org.lwjgl.system.NativeResource,org.lwjgl.system.Pointer
public class VkSubresourceLayout extends org.lwjgl.system.Struct implements org.lwjgl.system.NativeResourceStructure specifying subresource layout.Description
If the image is linear, then
rowPitch,arrayPitchanddepthPitchdescribe the layout of the image subresource in linear memory. For uncompressed formats,rowPitchis the number of bytes between texels with the same x coordinate in adjacent rows (y coordinates differ by one).arrayPitchis 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).depthPitchis 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 + offsetFor compressed formats, the
rowPitchis the number of bytes between compressed texel blocks in adjacent rows.arrayPitchis the number of bytes between compressed texel blocks in adjacent array layers.depthPitchis 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
arrayPitchis undefined for images that were not created as arrays.depthPitchis defined only for 3D images.If the image has a single-plane color format and its tiling is
IMAGE_TILING_LINEAR, then theaspectMaskmember ofVkImageSubresourcemust beIMAGE_ASPECT_COLOR_BIT.If the image has a depth/stencil format and its tiling is
IMAGE_TILING_LINEAR, thenaspectMaskmust be eitherIMAGE_ASPECT_DEPTH_BITorIMAGE_ASPECT_STENCIL_BIT. On implementations that store depth and stencil aspects separately, querying each of these image subresource layouts will return a differentoffsetandsizerepresenting the region of memory used for that aspect. On implementations that store depth and stencil aspects interleaved, the sameoffsetandsizeare returned and represent the interleaved memory allocation.If the image has a multi-planar format and its tiling is
IMAGE_TILING_LINEAR, then theaspectMaskmember ofVkImageSubresourcemust beIMAGE_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 differentoffsetandsizerepresenting the region of memory used for that plane. If the image is disjoint, then theoffsetis relative to the base address of the plane. If the image is non-disjoint, then theoffsetis relative to the base address of the image.If the image's tiling is
IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT, then theaspectMaskmember ofVkImageSubresourcemust be one ofVK_IMAGE_ASPECT_MEMORY_PLANE_i_BIT_EXT, where the maximum allowed plane indexiis defined by thedrmFormatModifierPlaneCountassociated with the image'sformatand modifier. The memory range used by the subresource is described byoffsetandsize. If the image is disjoint, then theoffsetis relative to the base address of the memory plane. If the image is non-disjoint, then theoffsetis relative to the base address of the image. If the image is non-linear, thenrowPitch,arrayPitch, anddepthPitchhave an implementation-dependent meaning.See Also
VkImageDrmFormatModifierExplicitCreateInfoEXT,GetImageSubresourceLayoutMember documentation
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.sizeincludes any extra memory that is required based onrowPitch.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.
Layout
struct VkSubresourceLayout { VkDeviceSize offset; VkDeviceSize size; VkDeviceSize rowPitch; VkDeviceSize arrayPitch; VkDeviceSize depthPitch; }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVkSubresourceLayout.BufferAn array ofVkSubresourceLayoutstructs.
-
Field Summary
Fields Modifier and Type Field Description static intALIGNOFThe struct alignment in bytes.static intARRAYPITCH
DEPTHPITCH
OFFSET
ROWPITCH
SIZEThe struct member offsets.static intSIZEOFThe struct size in bytes.
-
Constructor Summary
Constructors Constructor Description VkSubresourceLayout(java.nio.ByteBuffer container)Creates aVkSubresourceLayoutinstance at the current position of the specifiedByteBuffercontainer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longarrayPitch()Returns the value of thearrayPitchfield.static VkSubresourceLayoutcalloc()Returns a newVkSubresourceLayoutinstance allocated withmemCalloc.static VkSubresourceLayout.Buffercalloc(int capacity)Returns a newVkSubresourceLayout.Bufferinstance allocated withmemCalloc.static VkSubresourceLayoutcallocStack()Returns a newVkSubresourceLayoutinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.static VkSubresourceLayout.BuffercallocStack(int capacity)Returns a newVkSubresourceLayout.Bufferinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.static VkSubresourceLayout.BuffercallocStack(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newVkSubresourceLayout.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static VkSubresourceLayoutcallocStack(org.lwjgl.system.MemoryStack stack)Returns a newVkSubresourceLayoutinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.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 VkSubresourceLayoutcreateSafe(long address)static VkSubresourceLayout.BuffercreateSafe(long address, int capacity)longdepthPitch()Returns the value of thedepthPitchfield.static VkSubresourceLayoutmalloc()Returns a newVkSubresourceLayoutinstance allocated withmemAlloc.static VkSubresourceLayout.Buffermalloc(int capacity)Returns a newVkSubresourceLayout.Bufferinstance allocated withmemAlloc.static VkSubresourceLayoutmallocStack()Returns a newVkSubresourceLayoutinstance allocated on the thread-localMemoryStack.static VkSubresourceLayout.BuffermallocStack(int capacity)Returns a newVkSubresourceLayout.Bufferinstance allocated on the thread-localMemoryStack.static VkSubresourceLayout.BuffermallocStack(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newVkSubresourceLayout.Bufferinstance allocated on the specifiedMemoryStack.static VkSubresourceLayoutmallocStack(org.lwjgl.system.MemoryStack stack)Returns a newVkSubresourceLayoutinstance allocated on the specifiedMemoryStack.static longnarrayPitch(long struct)Unsafe version ofarrayPitch().static longndepthPitch(long struct)Unsafe version ofdepthPitch().static longnoffset(long struct)Unsafe version ofoffset().static longnrowPitch(long struct)Unsafe version ofrowPitch().static longnsize(long struct)Unsafe version ofsize().longoffset()Returns the value of theoffsetfield.longrowPitch()Returns the value of therowPitchfield.longsize()Returns the value of thesizefield.intsizeof()
-
-
-
Constructor Detail
-
VkSubresourceLayout
public VkSubresourceLayout(java.nio.ByteBuffer container)
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 Detail
-
sizeof
public int sizeof()
- Specified by:
sizeofin classorg.lwjgl.system.Struct
-
offset
public long offset()
Returns the value of theoffsetfield.
-
size
public long size()
Returns the value of thesizefield.
-
rowPitch
public long rowPitch()
Returns the value of therowPitchfield.
-
arrayPitch
public long arrayPitch()
Returns the value of thearrayPitchfield.
-
depthPitch
public long depthPitch()
Returns the value of thedepthPitchfield.
-
malloc
public static VkSubresourceLayout malloc()
Returns a newVkSubresourceLayoutinstance allocated withmemAlloc. The instance must be explicitly freed.
-
calloc
public static VkSubresourceLayout calloc()
Returns a newVkSubresourceLayoutinstance allocated withmemCalloc. The instance must be explicitly freed.
-
create
public static VkSubresourceLayout create()
Returns a newVkSubresourceLayoutinstance allocated withBufferUtils.
-
create
public static VkSubresourceLayout create(long address)
Returns a newVkSubresourceLayoutinstance for the specified memory address.
-
createSafe
@Nullable public static VkSubresourceLayout createSafe(long address)
-
malloc
public static VkSubresourceLayout.Buffer malloc(int capacity)
Returns a newVkSubresourceLayout.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
public static VkSubresourceLayout.Buffer calloc(int capacity)
Returns a newVkSubresourceLayout.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
public static VkSubresourceLayout.Buffer create(int capacity)
Returns a newVkSubresourceLayout.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
public static VkSubresourceLayout.Buffer create(long address, int capacity)
Create aVkSubresourceLayout.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
createSafe
@Nullable public static VkSubresourceLayout.Buffer createSafe(long address, int capacity)
-
mallocStack
public static VkSubresourceLayout mallocStack()
Returns a newVkSubresourceLayoutinstance allocated on the thread-localMemoryStack.
-
callocStack
public static VkSubresourceLayout callocStack()
Returns a newVkSubresourceLayoutinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.
-
mallocStack
public static VkSubresourceLayout mallocStack(org.lwjgl.system.MemoryStack stack)
Returns a newVkSubresourceLayoutinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
callocStack
public static VkSubresourceLayout callocStack(org.lwjgl.system.MemoryStack stack)
Returns a newVkSubresourceLayoutinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
mallocStack
public static VkSubresourceLayout.Buffer mallocStack(int capacity)
Returns a newVkSubresourceLayout.Bufferinstance allocated on the thread-localMemoryStack.- Parameters:
capacity- the buffer capacity
-
callocStack
public static VkSubresourceLayout.Buffer callocStack(int capacity)
Returns a newVkSubresourceLayout.Bufferinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.- Parameters:
capacity- the buffer capacity
-
mallocStack
public static VkSubresourceLayout.Buffer mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newVkSubresourceLayout.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
callocStack
public static VkSubresourceLayout.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newVkSubresourceLayout.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
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().
-
-