Structure

MTLSize

The dimensions of an object.

Declaration

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

init()

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.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software