Vulkan-Docs/doc/specs/vulkan/man/VkSubresourceLayout.txt

104 lines
3.9 KiB
Plaintext

// Copyright (c) 2014-2016 Khronos Group. This work is licensed under a
// Creative Commons Attribution 4.0 International License; see
// http://creativecommons.org/licenses/by/4.0/
VkSubresourceLayout(3)
======================
Name
----
VkSubresourceLayout - Structure specifying subresource layout
C Specification
---------------
// refBegin VkSubresourceLayout - Structure specifying subresource layout
Information about the layout of the image subresource is returned in a
sname:VkSubresourceLayout structure:
include::../api/structs/VkSubresourceLayout.txt[]
Members
-------
* pname:offset is the byte offset from the start of the image where the
image subresource begins.
* pname:size is the size in bytes of the image subresource. pname:size
includes any extra memory that is required based on pname:rowPitch.
* pname:rowPitch describes the number of bytes between each row of texels
in an image.
* pname:arrayPitch describes the number of bytes between each array layer
of an image.
* pname:depthPitch describes the number of bytes between each slice of 3D
image.
Description
-----------
For images created with linear tiling, pname:rowPitch, pname:arrayPitch and
pname:depthPitch describe the layout of the image subresource in linear
memory. For uncompressed formats, pname:rowPitch is the number of bytes
between texels with the same x coordinate in adjacent rows (y coordinates
differ by one). pname: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). pname: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:
[source,c]
---------------------------------------------------
// (x,y,z,layer) are in texel coordinates
address(x,y,z,layer) = layer*arrayPitch + z*depthPitch + y*rowPitch + x*texelSize + offset
---------------------------------------------------
For compressed formats, the pname:rowPitch is the number of bytes between
compressed texel blocks in adjacent rows. pname:arrayPitch is the number of
bytes between compressed texel blocks in adjacent array layers.
pname:depthPitch is the number of bytes between compressed texel blocks in
adjacent slices of a 3D image.
[source,c]
---------------------------------------------------
// (x,y,z,layer) are in compressed texel block coordinates
address(x,y,z,layer) = layer*arrayPitch + z*depthPitch + y*rowPitch + x*compressedTexelBlockByteSize + offset;
---------------------------------------------------
pname:arrayPitch is undefined for images that were not created as arrays.
pname:depthPitch is defined only for 3D images.
For color formats, the pname:aspectMask member of sname:VkImageSubresource
must: be ename:VK_IMAGE_ASPECT_COLOR_BIT. For depth/stencil formats,
pname:aspectMask must: be either ename:VK_IMAGE_ASPECT_DEPTH_BIT or
ename:VK_IMAGE_ASPECT_STENCIL_BIT. On implementations that store depth and
stencil aspects separately, querying each of these image subresource layouts
will return a different pname:offset and pname:size representing the region
of memory used for that aspect. On implementations that store depth and
stencil aspects interleaved, the same pname:offset and pname:size are
returned and represent the interleaved memory allocation.
include::../validity/structs/VkSubresourceLayout.txt[]
See Also
--------
basetype:VkDeviceSize, flink:vkGetImageSubresourceLayout
Document Notes
--------------
For more information, see the Vulkan Specification at URL
https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#VkSubresourceLayout
This page is extracted from the Vulkan Specification.
Fixes and changes should be made to the Specification,not directly.
include::footer.txt[]