By default sparse resources have the same aliasing rules as non-sparse resources. See Memory Aliasing for more information.
VkDevice
objects that have the
sparseResidencyAliased feature
enabled are able to use the VK_BUFFER_CREATE_SPARSE_ALIASED_BIT
and
VK_IMAGE_CREATE_SPARSE_ALIASED_BIT
flags for resource creation.
These flags allow resources to access physical memory bound into multiple
locations within one or more sparse resources in a data consistent
fashion.
This means that reading physical memory from multiple aliased locations will
return the same value.
Care must be taken when performing a write operation to aliased physical memory. Memory dependencies must be used to separate writes to one alias from reads or writes to another alias. Writes to aliased memory that are not properly guarded against accesses to different aliases will have undefined results for all accesses to the aliased memory.
Applications that wish to make use of data consistent sparse memory aliasing must abide by the following guidelines:
VK_BUFFER_CREATE_SPARSE_ALIASED_BIT
/
VK_IMAGE_CREATE_SPARSE_ALIASED_BIT
flag.
All resources that access aliased physical memory must interpret the memory in the same way. This implies the following:
Failure to follow any of the above guidelines will require the application to abide by the normal, non-sparse resource aliasing rules. In this case memory cannot be accessed in a data consistent fashion.
![]() | Note |
---|---|
Enabling sparse resource memory aliasing can be a way to lower physical memory use, but it may reduce performance on some implementations. An application developer can test on their target HW and balance the memory / performance trade-offs measured. |