Updates mappings of tile locations in reserved resources to memory locations in a resource heap.
void UpdateTileMappings( ID3D12Resource *pResource, UINT NumResourceRegions, const D3D12_TILED_RESOURCE_COORDINATE *pResourceRegionStartCoordinates, const D3D12_TILE_REGION_SIZE *pResourceRegionSizes, ID3D12Heap *pHeap, UINT NumRanges, const D3D12_TILE_RANGE_FLAGS *pRangeFlags, const UINT *pHeapRangeStartOffsets, const UINT *pRangeTileCounts, D3D12_TILE_MAPPING_FLAGS Flags );
A pointer to the reserved resource.
The number of reserved resource regions.
An array of D3D12_TILED_RESOURCE_COORDINATE structures that describe the starting coordinates of the reserved resource regions. The NumResourceRegions parameter specifies the number of D3D12_TILED_RESOURCE_COORDINATE structures in the array.
An array of D3D12_TILE_REGION_SIZE structures that describe the sizes of the reserved resource regions. The NumResourceRegions parameter specifies the number of D3D12_TILE_REGION_SIZE structures in the array.
A pointer to the resource heap.
The number of tile ranges.
A pointer to an array of D3D12_TILE_RANGE_FLAGS values that describes each tile range. The NumRanges parameter specifies the number of values in the array.
An array of offsets into the resource heap. These are 0-based tile offsets, counting in tiles (not bytes).
An array of tiles. An array of values that specify the number of tiles in each tile range. The NumRanges parameter specifies the number of values in the array.
A combination of D3D12_TILE_MAPPING_FLAGS values that are combined by using a bitwise OR operation.
This method does not return a value.
Use UpdateTileMappings to map the virtual pages of a reserved resource to the physical pages of a heap. The mapping does not have to be in order. The operation is similar to ID3D11DeviceContext2::UpdateTileMappings with the one key difference that D3D12 allows a reserved resource to have tiles from multiple heaps.
In a single call to UpdateTileMappings, you can map one or more ranges of resource tiles to one or more ranges of heap tiles.
You can organize the parameters of UpdateTileMappings in these ways to perform an update:
- Reserved resource whose mappings are updated. Mappings start off all NULL when a resource is initially created.
- Set of tile regions on the reserved resource whose mappings are updated. You can make one UpdateTileMappings call to update many mappings or multiple calls with a bit more API call overhead as well if that is more convenient.
- NumResourceRegions specifies how many regions there are.
- pResourceRegionStartCoordinates and pResourceRegionSizes are each arrays that identify the start location and extend of each region. If NumResourceRegions is 1, for convenience either or both of the arrays that describe the regions can be NULL. NULL for pResourceRegionStartCoordinates means the start coordinate is all 0s, and NULL for pResourceRegionSizes identifies a default region that is the full set of tiles for the entire reserved resource, including all mipmaps, array slices, or both.
- If pResourceRegionStartCoordinates isn't NULL and pResourceRegionSizes is NULL, the region size defaults to 1 tile for all regions. This makes it easy to define mappings for a set of individual tiles each at disparate locations by providing an array of locations in pResourceRegionStartCoordinates without having to send an array of pResourceRegionSizes all set to 1.
- Heap that provides memory where tile mappings can go. If UpdateTileMappings only defines NULL mappings, you don't need to specify a heap.
- Set of tile ranges where mappings are going. Each given tile range can specify one of a few types of ranges: a range of tiles in a heap (default), a count of tiles in the reserved resource to map to a single tile in a heap (sharing the tile), a count of tile mappings in the reserved resource to skip and leave as they are, or a count of tiles in the heap to map to NULL.NumRanges specifies the number of tile ranges, where the total tiles identified across all ranges must match the total number of tiles in the tile regions from the previously described reserved resource. Mappings are defined by iterating through the tiles in the tile regions in sequential order - x then y then z order for box regions - while walking through the set of tile ranges in sequential order. The breakdown of tile regions doesn't have to line up with the breakdown of tile ranges, but the total number of tiles on both sides must be equal so that each reserved resource tile specified has a mapping specified.
pRangeFlags, pHeapRangeStartOffsets, and pRangeTileCounts are all arrays, of size NumRanges, that describe the tile ranges. If pRangeFlags is NULL, all ranges are sequential tiles in the heap; otherwise, for each range i,pRangeFlags[i] identifies how the mappings in that range of tiles work:
- If pRangeFlags[i] is D3D12_TILE_RANGE_FLAG_NONE, that range defines sequential tiles in the heap, with the number of tiles being pRangeTileCounts[i] and the starting location pHeapRangeStartOffsets[i]. If NumRanges is 1, pRangeTileCounts can be NULL and defaults to the total number of tiles specified by all the tile regions.
- If pRangeFlags[i] is D3D12_TILE_RANGE_FLAG_REUSE_SINGLE_TILE, pHeapRangeStartOffsets[i] identifies the single tile in the heap to map to, and pRangeTileCounts[i] specifies how many tiles from the tile regions to map to that heap location. If NumRanges is 1, pRangeTileCounts can be NULL and defaults to the total number of tiles specified by all the tile regions.
- If pRangeFlags[i] is D3D12_TILE_RANGE_FLAG_NULL, pRangeTileCounts[i] specifies how many tiles from the tile regions to map to NULL. If NumRanges is 1, pRangeTileCounts can be NULL and defaults to the total number of tiles specified by all the tile regions. pHeapRangeStartOffsets[i] is ignored for NULL mappings.
- If pRangeFlags[i] is D3D12_TILE_RANGE_FLAG_SKIP, pRangeTileCounts[i] specifies how many tiles from the tile regions to skip over and leave existing mappings unchanged for. This can be useful if a tile region conveniently bounds an area of tile mappings to update except with some exceptions that need to be left the same as whatever they were mapped to before. pHeapRangeStartOffsets[i] is ignored for SKIP mappings.
Here are some examples of common UpdateTileMappings cases:
The examples reference the following structures and enums:
// - NULL for pResourceRegionStartCoordinates and pResourceRegionSizes defaults to the entire resource // - NULL for pHeapRangeStartOffsets since it isn't needed for mapping tiles to NULL // - NULL for pRangeTileCounts when NumRanges is 1 defaults to the same number of tiles as the resource region (which is // the entire surface in this case) // UINT RangeFlags = D3D12_TILE_RANGE_FLAG_NULL; pCommandQueue->UpdateTileMappings(pResource, 1, NULL, NULL, NULL, 1, &RangeFlags, NULL, NULL, D3D12_TILE_MAPPING_FLAG_NONE);
// - This maps a 2x3 tile region at tile offset (1,1) in a resource to tile  in a heap // D3D12_TILED_RESOURCE_COORDINATE TRC; TRC.X = 1; TRC.Y = 1; TRC.Z = 0; TRC.Subresource = 0;
// - This can also be accomplished in multiple calls. // A single call to define multiple mapping updates can reduce CPU call overhead slightly, // at the cost of having to pass arrays as parameters. // - Passing NULL for pResourceRegionSizes defaults to each region in the resource // being a single tile. So all that is needed are the coordinates of each one. // - Passing NULL for pRangeFlags defaults to no flags (since none are needed in this case) // - Passing NULL for pRangeTileCounts defaults to each range in the heap being size 1. // So all that is needed are the start offsets for each tile in the heap // D3D12_TILED_RESOURCE_COORDINATE TRC; UINT StartOffsets; UINT NumSingleTiles = 3; TRC.X = 1; TRC.Y = 1; TRC.Subresource = 0;
// - This complex example hard codes the parameter arrays, whereas in practice the // application would likely configure the paramaters programatically or in a data driven way. // - Suppose we have 3 regions in a resource to configure mappings for, 2x3 at coordinate (1,1), // 3x3 at coordinate (4,7), and 7x1 at coordinate (20,30) // - The tiles in the regions are walked from first to last, in X then Y then Z order, // while stepping forward through the specified Tile Ranges to determine each mapping. // In this example, 22 tile mappings need to be defined. // - Suppose we want the first 3 tiles to be mapped to a contiguous range in the heap starting at // heap location , the next 8 to be skipped (left unchanged), the next 2 to map to NULL, // the next 5 to share a single tile (heap location ) and the remaining // 4 tiles to each map to to unique heap locations, , ,  and : // D3D12_TILED_RESOURCE_COORDINATE TRC; D3D12_TILE_REGION_SIZE TRS; UINT NumRegions = 3;