Class VkImageSubresourceRange
- All Implemented Interfaces:
AutoCloseable,org.lwjgl.system.NativeResource,org.lwjgl.system.Pointer
Description
The number of mipmap levels and array layers must be a subset of the image subresources in the image. If an application wants to use all mip levels or layers in an image after the baseMipLevel or baseArrayLayer, it can set levelCount and layerCount to the special values REMAINING_MIP_LEVELS and REMAINING_ARRAY_LAYERS without knowing the exact number of mip levels or layers.
For cube and cube array image views, the layers of the image view starting at baseArrayLayer correspond to faces in the order +X, -X, +Y, -Y, +Z, -Z. For cube arrays, each set of six sequential layers is a single cube, so the number of cube maps in a cube map array view is layerCount / 6, and image array layer (baseArrayLayer + i) is face index (i mod 6) of cube i / 6. If the number of layers in the view, whether set explicitly in layerCount or implied by REMAINING_ARRAY_LAYERS, is not a multiple of 6, the last cube map in the array must not be accessed.
aspectMask must be only IMAGE_ASPECT_COLOR_BIT, IMAGE_ASPECT_DEPTH_BIT or IMAGE_ASPECT_STENCIL_BIT if format is a color, depth-only or stencil-only format, respectively, except if format is a multi-planar format. If using a depth/stencil format with both depth and stencil components, aspectMask must include at least one of IMAGE_ASPECT_DEPTH_BIT and IMAGE_ASPECT_STENCIL_BIT, and can include both.
When the VkImageSubresourceRange structure is used to select a subset of the slices of a 3D image’s mip level in order to create a 2D or 2D array image view of a 3D image created with IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT, baseArrayLayer and layerCount specify the first slice index and the number of slices to include in the created image view. Such an image view can be used as a framebuffer attachment that refers only to the specified range of slices of the selected mip level. However, any layout transitions performed on such an attachment view during a render pass instance still apply to the entire subresource referenced which includes all the slices of the selected mip level.
When using an image view of a depth/stencil image to populate a descriptor set (e.g. for sampling in the shader, or for use as an input attachment), the aspectMask must only include one bit, which selects whether the image view is used for depth reads (i.e. using a floating-point sampler or input attachment in the shader) or stencil reads (i.e. using an unsigned integer sampler or input attachment in the shader). When an image view of a depth/stencil image is used as a depth/stencil framebuffer attachment, the aspectMask is ignored and both depth and stencil image subresources are used.
When creating a VkImageView, if sampler Y′CBCR conversion is enabled in the sampler, the aspectMask of a subresourceRange used by the VkImageView must be IMAGE_ASPECT_COLOR_BIT.
When creating a VkImageView, if sampler Y′CBCR conversion is not enabled in the sampler and the image format is multi-planar, the image must have been created with IMAGE_CREATE_MUTABLE_FORMAT_BIT, and the aspectMask of the VkImageView’s subresourceRange must be IMAGE_ASPECT_PLANE_0_BIT, IMAGE_ASPECT_PLANE_1_BIT or IMAGE_ASPECT_PLANE_2_BIT.
Valid Usage
- If
levelCountis notREMAINING_MIP_LEVELS, it must be greater than 0 - If
layerCountis notREMAINING_ARRAY_LAYERS, it must be greater than 0 - If
aspectMaskincludesIMAGE_ASPECT_COLOR_BIT, then it must not include any ofIMAGE_ASPECT_PLANE_0_BIT,IMAGE_ASPECT_PLANE_1_BIT, orIMAGE_ASPECT_PLANE_2_BIT aspectMaskmust not includeVK_IMAGE_ASPECT_MEMORY_PLANE_i_BIT_EXTfor any index i
Valid Usage (Implicit)
aspectMaskmust be a valid combination ofVkImageAspectFlagBitsvaluesaspectMaskmust not be 0
See Also
VkHostImageLayoutTransitionInfo, VkImageMemoryBarrier, VkImageMemoryBarrier2, VkImageViewCreateInfo, CmdClearColorImage, CmdClearDepthStencilImage
Layout
struct VkImageSubresourceRange {
VkImageAspectFlags aspectMask();
uint32_t baseMipLevel();
uint32_t levelCount();
uint32_t baseArrayLayer();
uint32_t layerCount();
}-
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
ConstructorsConstructorDescriptionVkImageSubresourceRange(ByteBuffer container) Creates aVkImageSubresourceRangeinstance at the current position of the specifiedByteBuffercontainer. -
Method Summary
Modifier and TypeMethodDescriptioninta bitmask ofVkImageAspectFlagBitsspecifying which aspect(s) of the image are included in the view.aspectMask(int value) Sets the specified value to theaspectMask()field.intthe first array layer accessible to the view.baseArrayLayer(int value) Sets the specified value to thebaseArrayLayer()field.intthe first mipmap level accessible to the view.baseMipLevel(int value) Sets the specified value to thebaseMipLevel()field.static VkImageSubresourceRangecalloc()Returns a newVkImageSubresourceRangeinstance allocated withmemCalloc.calloc(int capacity) Returns a newVkImageSubresourceRange.Bufferinstance allocated withmemCalloc.calloc(int capacity, org.lwjgl.system.MemoryStack stack) Returns a newVkImageSubresourceRange.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static VkImageSubresourceRangecalloc(org.lwjgl.system.MemoryStack stack) Returns a newVkImageSubresourceRangeinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static VkImageSubresourceRangeDeprecated.callocStack(int capacity) Deprecated.callocStack(int capacity, org.lwjgl.system.MemoryStack stack) Deprecated.static VkImageSubresourceRangecallocStack(org.lwjgl.system.MemoryStack stack) Deprecated.static VkImageSubresourceRangecreate()Returns a newVkImageSubresourceRangeinstance allocated withBufferUtils.create(int capacity) Returns a newVkImageSubresourceRange.Bufferinstance allocated withBufferUtils.static VkImageSubresourceRangecreate(long address) Returns a newVkImageSubresourceRangeinstance for the specified memory address.create(long address, int capacity) Create aVkImageSubresourceRange.Bufferinstance at the specified memory.static @Nullable VkImageSubresourceRangecreateSafe(long address) static @Nullable VkImageSubresourceRange.BuffercreateSafe(long address, int capacity) intthe number of array layers (starting frombaseArrayLayer) accessible to the view.layerCount(int value) Sets the specified value to thelayerCount()field.intthe number of mipmap levels (starting frombaseMipLevel) accessible to the view.levelCount(int value) Sets the specified value to thelevelCount()field.static VkImageSubresourceRangemalloc()Returns a newVkImageSubresourceRangeinstance allocated withmemAlloc.malloc(int capacity) Returns a newVkImageSubresourceRange.Bufferinstance allocated withmemAlloc.malloc(int capacity, org.lwjgl.system.MemoryStack stack) Returns a newVkImageSubresourceRange.Bufferinstance allocated on the specifiedMemoryStack.static VkImageSubresourceRangemalloc(org.lwjgl.system.MemoryStack stack) Returns a newVkImageSubresourceRangeinstance allocated on the specifiedMemoryStack.static VkImageSubresourceRangeDeprecated.mallocStack(int capacity) Deprecated.mallocStack(int capacity, org.lwjgl.system.MemoryStack stack) Deprecated.static VkImageSubresourceRangemallocStack(org.lwjgl.system.MemoryStack stack) Deprecated.static intnaspectMask(long struct) Unsafe version ofaspectMask().static voidnaspectMask(long struct, int value) Unsafe version ofaspectMask.static intnbaseArrayLayer(long struct) Unsafe version ofbaseArrayLayer().static voidnbaseArrayLayer(long struct, int value) Unsafe version ofbaseArrayLayer.static intnbaseMipLevel(long struct) Unsafe version ofbaseMipLevel().static voidnbaseMipLevel(long struct, int value) Unsafe version ofbaseMipLevel.static intnlayerCount(long struct) Unsafe version oflayerCount().static voidnlayerCount(long struct, int value) Unsafe version oflayerCount.static intnlevelCount(long struct) Unsafe version oflevelCount().static voidnlevelCount(long struct, int value) Unsafe version oflevelCount.set(int aspectMask, int baseMipLevel, int levelCount, int baseArrayLayer, int layerCount) Initializes this struct with the specified values.Copies the specified struct data to this struct.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. -
ASPECTMASK
public static final int ASPECTMASKThe struct member offsets. -
BASEMIPLEVEL
public static final int BASEMIPLEVELThe struct member offsets. -
LEVELCOUNT
public static final int LEVELCOUNTThe struct member offsets. -
BASEARRAYLAYER
public static final int BASEARRAYLAYERThe struct member offsets. -
LAYERCOUNT
public static final int LAYERCOUNTThe struct member offsets.
-
-
Constructor Details
-
VkImageSubresourceRange
Creates aVkImageSubresourceRangeinstance 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<VkImageSubresourceRange>
-
aspectMask
public int aspectMask()a bitmask ofVkImageAspectFlagBitsspecifying which aspect(s) of the image are included in the view. -
baseMipLevel
public int baseMipLevel()the first mipmap level accessible to the view. -
levelCount
public int levelCount()the number of mipmap levels (starting frombaseMipLevel) accessible to the view. -
baseArrayLayer
public int baseArrayLayer()the first array layer accessible to the view. -
layerCount
public int layerCount()the number of array layers (starting frombaseArrayLayer) accessible to the view. -
aspectMask
Sets the specified value to theaspectMask()field. -
baseMipLevel
Sets the specified value to thebaseMipLevel()field. -
levelCount
Sets the specified value to thelevelCount()field. -
baseArrayLayer
Sets the specified value to thebaseArrayLayer()field. -
layerCount
Sets the specified value to thelayerCount()field. -
set
public VkImageSubresourceRange set(int aspectMask, int baseMipLevel, int levelCount, int baseArrayLayer, int layerCount) 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 newVkImageSubresourceRangeinstance allocated withmemAlloc. The instance must be explicitly freed. -
calloc
Returns a newVkImageSubresourceRangeinstance allocated withmemCalloc. The instance must be explicitly freed. -
create
Returns a newVkImageSubresourceRangeinstance allocated withBufferUtils. -
create
Returns a newVkImageSubresourceRangeinstance for the specified memory address. -
createSafe
-
malloc
Returns a newVkImageSubresourceRange.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
Returns a newVkImageSubresourceRange.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
Returns a newVkImageSubresourceRange.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
Create aVkImageSubresourceRange.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 VkImageSubresourceRange.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 VkImageSubresourceRange.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack) Deprecated.Deprecated for removal in 3.4.0. Usecalloc(int, MemoryStack)instead. -
malloc
Returns a newVkImageSubresourceRangeinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
Returns a newVkImageSubresourceRangeinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
malloc
public static VkImageSubresourceRange.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack) Returns a newVkImageSubresourceRange.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
calloc
public static VkImageSubresourceRange.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack) Returns a newVkImageSubresourceRange.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
naspectMask
public static int naspectMask(long struct) Unsafe version ofaspectMask(). -
nbaseMipLevel
public static int nbaseMipLevel(long struct) Unsafe version ofbaseMipLevel(). -
nlevelCount
public static int nlevelCount(long struct) Unsafe version oflevelCount(). -
nbaseArrayLayer
public static int nbaseArrayLayer(long struct) Unsafe version ofbaseArrayLayer(). -
nlayerCount
public static int nlayerCount(long struct) Unsafe version oflayerCount(). -
naspectMask
public static void naspectMask(long struct, int value) Unsafe version ofaspectMask. -
nbaseMipLevel
public static void nbaseMipLevel(long struct, int value) Unsafe version ofbaseMipLevel. -
nlevelCount
public static void nlevelCount(long struct, int value) Unsafe version oflevelCount. -
nbaseArrayLayer
public static void nbaseArrayLayer(long struct, int value) Unsafe version ofbaseArrayLayer. -
nlayerCount
public static void nlayerCount(long struct, int value) Unsafe version oflayerCount.
-