How a tiled resource's area is tiled
When you create a tiled resource, the dimensions, format element size, and number of mipmaps and/or array slices (if applicable) determine the number of tiles that are required to back the entire surface area. The pixel/byte layout within tiles is determined by the implementation. The number of pixels that fit in a tile, depending on the format element size, is fixed and identical whether you use a standard swizzle or not.
The number of tiles that will be used by a given surface size and format element width is well defined and predictable based on the tables in the following sections. For resources that contain mipmaps or cases where surface dimensions don't fill a tile, some constraints exist and are discussed in Mipmap packing.
Different tiled resources can point to identical memory with different formats as long as applications don't rely on the results of writing to the memory with one format and reading with another. But, in constrained circumstances, applications can rely on the results of writing to the memory with one format and reading with another if the formats are in the same format family (that is, they have the same typeless parent format). For example, DXGI_FORMAT_R8G8B8A8_UNORM and DXGI_FORMAT_R8G8B8A8_UINT are compatible with each other but not with DXGI_FORMAT_R16G16_UNORM. An application must conservatively match all resource properties in order to reinterpret data between two textures since tile patterns are very conservatively undefined. Obviously, though, the format is more lax. The formats need only be compatible as illustrated above. An exception is where bleeding data from one format aliasing to another is well defined: if a tile completely contains 0 for all its bits, that tile can be used with any format that interprets those memory contents as 0 (regardless of memory layout). So, a tile could be cleared to 0x00 with the format DXGI_FORMAT_R8_UNORM and then used with a format like DXGI_FORMAT_R32G32_FLOAT and it would appear the contents are still (0.0f,0.0f).
The layout of data within a tile may be depend on resource properties, the subresource in which it resides, and the tile location within the subresource. The major exceptions are illustrated above: compatible formats with other resource properties being equal and when all texels are the same pattern.
In this section
Topic | Description |
---|---|
Texture2D and Texture2DArray subresource tiling |
These tables show how Texture2D and Texture2DArray subresources are tiled. |
Texture3D subresource tiling |
This table shows how Texture3D subresources are tiled. |
Buffer tiling |
A Buffer resource is divided into 64KB tiles, with some empty space in the last tile if the size is not a multiple of 64KB. |
Mipmap packing |
Depending on the tier of tiled resources support, mipmaps with certain dimensions don't follow the standard tile shapes and are considered to all be packed together with one another in a manner that is opaque to the application. |