Contents

MTLSize

A type that represents one, two, or three dimensions of a type instance, such as an array or texture.

Declaration

struct MTLSize

Mentioned in

Overview

Metal has many types that represent arrays of discrete elements, such as:

  • A texture, which has an array of pixel elements

  • A thread grid, which has an array of computational threads

Types and methods that work with these array-like types frequently have an MTLSize property or parameter that refers to the extents of a specific instance of the type, or a region within the instance.

The following are some examples for setting a size for an instance that has less than three dimentions:

  • For a 2D texture that has a height and width of 5, set a size’s depth property to 1 so that it represents [5, 5, 1].

  • For a 1D array with length 42, set a size’s height, depth properties to 1, so that it represents [42, 1, 1].

Topics

Creating a size instance

Accessing a size’s dimensions

See Also

Indirect compute commands