Sparse resources have several features that must be enabled explicitly at
resource creation time.
The features are enabled by including bits in the flags parameter of
VkImageCreateInfo or VkBufferCreateInfo.
Each feature also has one or more corresponding feature enables specified in
VkPhysicalDeviceFeatures.
Sparse binding is the base feature, and provides the following capabilities:
VK_IMAGE_CREATE_SPARSE_BINDING_BIT and
VK_BUFFER_CREATE_SPARSE_BINDING_BIT bits.
VK_IMAGE_CREATE_SPARSE_BINDING_BIT
(but not VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) supports all
formats that non-sparse usage supports, and supports both
VK_IMAGE_TILING_OPTIMAL and VK_IMAGE_TILING_LINEAR tiling.
Sparse Residency builds on (and requires) the sparseBinding
feature.
It includes the following capabilities:
VkPhysicalDeviceSparseProperties::residencyNonResidentStrict.
If this property is present, accesses to unbound regions of the
resource are well defined and behave as if the data bound is populated
with all zeros; writes are discarded.
When this property is absent, accesses are considered safe, but reads
will return undefined values.
VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT and
VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT bits.
is advertised on a finer grain via the following features:
sparseResidencyBuffer:
Support for creating VkBuffer objects with the
VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT.
sparseResidencyImage2D:
Support for creating 2D single-sampled VkImage objects with
VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT.
sparseResidencyImage3D:
Support for creating 3D VkImage objects with
VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT.
sparseResidency2Samples:
Support for creating 2D VkImage objects with 2 samples and
VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT.
sparseResidency4Samples:
Support for creating 2D VkImage objects with 4 samples and
VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT.
sparseResidency8Samples:
Support for creating 2D VkImage objects with 8 samples and
VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT.
sparseResidency16Samples:
Support for creating 2D VkImage objects with 16 samples and
VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT.
Implementations supporting sparseResidencyImage2D are only required
to support sparse 2D, single-sampled images.
Support is not required for sparse 3D and MSAA images and is enabled via
sparseResidencyImage3D, sparseResidency2Samples,
sparseResidency4Samples, sparseResidency8Samples, and
sparseResidency16Samples.
VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT
supports all non-compressed color formats with power-of-two element
size that non-sparse usage supports.
Additional formats may also be supported and can be queried via
vkGetPhysicalDeviceSparseImageFormatProperties.
VK_IMAGE_TILING_LINEAR tiling is not supported.
Sparse aliasing provides the following capability that can be enabled per resource:
Allows physical memory ranges to be shared between multiple locations in the same sparse resource or between multiple sparse resources, with each binding of a memory location observing a consistent interpretation of the memory contents.
See Sparse Memory Aliasing for more information.