The dimensions of an object.


struct MTLSize


Metal has many object types that represent arrays of discrete elements. For example, a texture has an array of pixel elements, and a thread grid has an array of computational threads. Use MTLSize instances to measure the extents of these objects or extents of regions within these objects.

Conceptually, when using a MTLSize instance to measure an object, treat the object as a 3D array of elements, even if it has fewer dimensions. Set the length of any unused dimensions to 1. For example, a 5x5 2D texture is a 5x5x1 texture in 3D.


Creating Sizes


Initializes a box size.

init(width: Int, height: Int, depth: Int)

Initializes a size for an object with the specified dimensions.

func MTLSizeMake(Int, Int, Int) -> MTLSize

Creates a size for an object using the specified dimensions.

Getting and Setting Dimensions

var width: Int

The number of elements in the x dimension.

var height: Int

The number of elements in the y dimension.

var depth: Int

The number of elements in the z dimension.

See Also

Object Sizing and Positioning

struct MTLOrigin

The coordinates for the front upper-left corner of a region.

struct MTLRegion

The bounds for a subset of an object's elements.

typealias MTLCoordinate2D

A coordinate in the viewport.

func MTLCoordinate2DMake(Float, Float) -> MTLCoordinate2D

Returns a new 2D point with the specified coordinates.