---
title: "sparseTileSize(with:pixelFormat:sampleCount:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtldevice/sparsetilesize(with:pixelformat:samplecount:)"
---

# sparseTileSize(with:pixelFormat:sampleCount:)

Returns the dimensions of a sparse tile for a texture.

## Declaration

```swift
func sparseTileSize(with textureType: MTLTextureType, pixelFormat: MTLPixelFormat, sampleCount: Int) -> MTLSize
```

## Parameters

- `textureType`: An doc://com.apple.metal/documentation/Metal/MTLTextureType instance.
- `pixelFormat`: An doc://com.apple.metal/documentation/Metal/MTLPixelFormat instance.
- `sampleCount`: The number of samples for each pixel.

## Mentioned in

Converting between pixel regions and sparse tile regions

## Return Value

Return Value A new MTLSize instance.

## Discussion

Discussion The size of a sparse tile, in bytes, is the same for all sparse textures on a GPU device object. Because the size of pixels may vary, the actual dimensions of a sparse tile vary based on the texture and the pixel format. Use this method to get the dimensions of the tile for a particular format. Use these dimensions when converting regions from pixel-based units to sparse tile units and vice versa.

## See Also

### Working with sparse textures

- [sparseTileSize(textureType:pixelFormat:sampleCount:sparsePageSize:)](metal/mtldevice/sparsetilesize(texturetype:pixelformat:samplecount:sparsepagesize:).md)
- [sparseTileSizeInBytes(sparsePageSize:)](metal/mtldevice/sparsetilesizeinbytes(sparsepagesize:).md)
- [sparseTileSizeInBytes](metal/mtldevice/sparsetilesizeinbytes.md)
- [convertSparsePixelRegions(_:toTileRegions:withTileSize:alignmentMode:numRegions:)](metal/mtldevice/convertsparsepixelregions(_:totileregions:withtilesize:alignmentmode:numregions:).md)
- [convertSparseTileRegions(_:toPixelRegions:withTileSize:numRegions:)](metal/mtldevice/convertsparsetileregions(_:topixelregions:withtilesize:numregions:).md)
- [MTLSparsePageSize](metal/mtlsparsepagesize.md)
- [MTLSparseTextureRegionAlignmentMode](metal/mtlsparsetextureregionalignmentmode.md)
