Structure

MTLSize

The dimensions of an object.

Declaration

typedef struct {
    ...
} MTLSize;

Overview

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.

Topics

Creating Sizes

MTLSizeMake

Creates a size for an object using the specified dimensions.

Getting and Setting Dimensions

width

The number of elements in the x dimension.

height

The number of elements in the y dimension.

depth

The number of elements in the z dimension.

See Also

Object Sizing and Positioning

MTLOrigin

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

MTLRegion

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

MTLCoordinate2D

A coordinate in the viewport.

MTLCoordinate2DMake

Returns a new 2D point with the specified coordinates.