Tiled Resource

struct TileMapping

Describes a mapping between a tile in a texture and a memory area in a heap.

Public Members

size_t texX

The tile coordinates in tiles, not pixels!

size_t texY

The tile coordinates in tiles, not pixels!

size_t texZ

The tile coordinates in tiles, not pixels!

size_t texSubresource

The index of the subresource.

size_t heapTileIndex

The index of the tile in the heap. Not bytes, but tile index!

size_t heapTileSpan

The number of tiles to map. Zero is invalid, and if it is not one, an array of tiles will be mapped, to the specified location. Example usage for this is packed mip tails.

struct TextureTilingInfo

Structure representing the properties of a tiled resource.

NOTE: even if numPackedMips is zero, numTilesNeededForPackedMips may be greater than zero, which is a special case, and numTilesNeededForPackedMips tiles still need to be assigned at numUnpackedMips.

Public Members

size_t totalNumberOfTiles

Total number of tiles in the resource.

size_t numUnpackedMips

Number of unpacked mips in the resource.

size_t numPackedMips

Number of packed mips in the resource.

size_t numTilesNeededForPackedMips

Number of tiles needed to store the packed mips.

size_t firstPackedTileIndex

Index of the first tile storing packed mips.

size_t tileWidthInPixels

Width of each tile in pixels.

size_t tileHeightInPixels

Height of each tile in pixels.

size_t tileDepthInPixels

Depth of each tile in pixels.

size_t tileMemorySize

Size of each tile in bytes.

size_t subresourceWidthInTiles

Width of the subresource in tiles.

size_t subresourceHeightInTiles

Height of the subresource in tiles.

size_t subresourceDepthInTiles

Depth of the subresource in tiles.

size_t subresourceStartTileIndex

Index of the first tile of the subresource.

namespace d3d

Functions

void map_tile_to_resource(BaseTexture *tex, ResourceHeap *heap, const TileMapping *mapping, size_t mapping_count)

Maps a memory area of the heap to the specified xyz location of the texture.

Use heap == nullptr to remove the link between a tile and the mapped heap portion.

Parameters:
  • tex – The texture to map.

  • heap – The heap to map.

  • mapping – The mapping to apply.

  • mapping_count – The number of mappings in the mapping array.

TextureTilingInfo get_texture_tiling_info(BaseTexture *tex, size_t subresource)

Retrieves the tiling information of a texture.

Parameters:
  • tex – The texture to query.

  • subresource – The index of the subresource.

Returns:

The tiling information of the texture.