A sparse texture's memory is mapped a 64 KiB tile at a time; for blocks of 16 bytes a tile is 64x64 of them. Where the
device has sparse residency of 2D images and reads what isn't bound as zeros, texture.c gives such a texture's image
memory only for its mapped tiles. An ASTC 4x4 one held as BC7 (astc_textures, above) takes part: BC7's sparse block is
256x256 texels, 64x64 blocks of 16 bytes too, so each mapped tile is one block of the image, decoded and encoded on its own as
a texture's changed runs are. A tile of several of the device's blocks binds them in stacks where they divide its
blocks of GOBs (resident_stacks): an 8x8 tile is 2x2 BC7 blocks, two stacks of two, each stack bound where memory
maps any of its bytes. A footprint whose tile is no whole number of the device's blocks (5x4, 6x6 and 8x5 among them:
256 texels are no whole number of their blocks) isn't bound a tile at a time, and the log line saying so names the
format and the device's block in the layout's terms; tex_bind binds the device's blocks under the memory the game
maps instead, so it too takes memory only around its mapped tiles. Where the device makes no sparse image of the
format, or the image is under 4 MiB, the texture is made whole, and the log says so.
A game maps one tile of its memory at many tiles of a sparse texture, and the blocks of those tiles show the same
texels. Where the device binds memory to more than one place of an image (sparseResidencyAliased), such blocks
share one allocation. texture.c gives each block a key: a hash of which guest memory lies under it and where in the
block each run of that memory lies, with the block's level. memory.c binds the blocks of one key to the same memory
(vk_image_resident for a texture bound a tile at a time, vk_image_sparse_bind for the others). A block that joins
the memory of its key has that memory's texels and is not loaded. A block whose key changed is bound again. What is
loaded into one block of a key is in all of them, which is right because they show the same bytes. A block at a
level's edge and a mip tail share nothing. vk_sparse_share=0 gives each block its own memory.
Made from docs/layers/gpu/astc.md at 69237645142c. GPL-3.0-or-later.