MTLRegion
The bounds for a subset of an instance’s elements.
Declaration
struct MTLRegionMentioned in
Overview
Metal has many instance 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 MTLRegion instances to describe subsets of these instances.
The origin is the front upper-left corner of the region, and its extents go towards the back lower-right corner. Conceptually, when using an MTLRegion instance to describe a subset of an instance, treat the instance as a 3D array of elements, even if it has fewer dimensions. For a 2D instance, set the z coordinate of the origin to 0 and the depth to 1. For a 1D instance, set the y and z coordinates of the origin to 0 and the height and depth to 1.