ID3D11DeviceContext2::CopyTiles method (d3d11_2.h)

Copies tiles from buffer to tiled resource or vice versa.

Syntax

void CopyTiles(
  [in] ID3D11Resource                        *pTiledResource,
  [in] const D3D11_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate,
  [in] const D3D11_TILE_REGION_SIZE          *pTileRegionSize,
  [in] ID3D11Buffer                          *pBuffer,
  [in] UINT64                                BufferStartOffsetInBytes,
  [in] UINT                                  Flags
);

Parameters

[in] pTiledResource

Type: ID3D11Resource*

A pointer to a tiled resource.

[in] pTileRegionStartCoordinate

Type: const D3D11_TILED_RESOURCE_COORDINATE*

A pointer to a D3D11_TILED_RESOURCE_COORDINATE structure that describes the starting coordinates of the tiled resource.

[in] pTileRegionSize

Type: const D3D11_TILE_REGION_SIZE*

A pointer to a D3D11_TILE_REGION_SIZE structure that describes the size of the tiled region.

[in] pBuffer

Type: ID3D11Buffer*

A pointer to an ID3D11Buffer that represents a default, dynamic, or staging buffer.

[in] BufferStartOffsetInBytes

Type: UINT64

The offset in bytes into the buffer at pBuffer to start the operation.

[in] Flags

Type: UINT

A combination of D3D11_TILE_COPY_FLAG-typed values that are combined by using a bitwise OR operation and that identifies how to copy tiles.

Return value

None

Remarks

CopyTiles drops write operations to unmapped areas and handles read operations from unmapped areas (except on Tier_1 tiled resources, where reading and writing unmapped areas is invalid).

If a copy operation involves writing to the same memory location multiple times because multiple locations in the destination resource are mapped to the same tile memory, the resulting write operations to multi-mapped tiles are non-deterministic and non-repeatable; that is, accesses to the tile memory happen in whatever order the hardware happens to execute the copy operation.

The tiles involved in the copy operation can't include tiles that contain packed mipmaps or results of the copy operation are undefined. To transfer data to and from mipmaps that the hardware packs into the one-or-more tiles that constitute the packed mips, you must use the standard (that is, non-tile specific) copy and update APIs (like ID3D11DeviceContext1::CopySubresourceRegion1 and ID3D11DeviceContext1::UpdateSubresource1) or ID3D11DeviceContext::GenerateMips for the whole mipmap chain.

The memory layout of the tiles in the non-tiled buffer resource side of the copy operation is linear in memory within 64 KB tiles, which the hardware and driver swizzle and deswizzle per tile as appropriate when they transfer to and from a tiled resource. For multisample antialiasing (MSAA) surfaces, the hardware and driver traverse each pixel's samples in sample-index order before they move to the next pixel. For tiles that are partially filled on the right side (for a surface that has a width not a multiple of tile width in pixels), the pitch and stride to move down a row is the full size in bytes of the number pixels that would fit across the tile if the tile was full. So, there can be a gap between each row of pixels in memory. Mipmaps that are smaller than a tile are not packed together in the linear layout, which might seem to be a waste of memory space, but as mentioned you can't use CopyTiles or ID3D11DeviceContext2::UpdateTiles to copy to mipmaps that the hardware packs together. You can just use generic copy and update APIs (like ID3D11DeviceContext1::CopySubresourceRegion1 and ID3D11DeviceContext1::UpdateSubresource1) to copy small mipmaps individually. Although in the case of a generic copy API (like ID3D11DeviceContext1::CopySubresourceRegion1), the linear memory must be the same dimension as the tiled resource; ID3D11DeviceContext1::CopySubresourceRegion1 can't copy from a buffer resource to a Texture2D for instance.

For more info about tiled resources, see Tiled resources.

Requirements

Requirement Value
Minimum supported client Windows 8.1 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 R2 [desktop apps | UWP apps]
Target Platform Windows
Header d3d11_2.h
Library D3D11.lib

See also

ID3D11DeviceContext2