Instance Method


Creates a new view of the texture, reinterpreting its data using a different pixel format.



- (id<MTLTexture>)newTextureViewWithPixelFormat:(MTLPixelFormat)pixelFormat;



A new pixel format, which must be compatible with the original pixel format.

Return Value

A new texture object that shares the same storage allocation of the texture.


When you create a texture normally, Metal allocates memory for the textureʼs pixel data. These storage allocations can be quite large. You can reduce memory use and avoid copying texture data by using a texture view—a texture object that shares another textureʼs storage allocation, reinterpreting the pixel data in some other format.

Not all pixel formats are compatible with one another. Reinterpretation of image data between pixel formats is supported within the following groups:

This method doesn't change the original texture image data in any way, but it may drastically change how the data is interpreted. For example, given a texture with the MTLPixelFormatRG16Uint pixel format that contains image data for Red 0xFFFE and Green 0x0001, this method would reinterpret that data in an MTLPixelFormatR32Uint format as Red 0x0001FFFE.

Some format reinterpretations are supported but may not be useful. For example, this method considers the 32-bit packed color formats MTLPixelFormatBGR10A2Unorm and MTLDataTypeRG11B10Float to be compatible, but it's unlikely that the same data can be interpreted by both formats in a meaningful way.

Some format reinterpretations require you to create the source texture with a special usage flag. Set that flag only when necessary, as it can affect performance. For more details, see MTLTextureUsagePixelFormatView.

See Also

Creating Textures by Reinterpreting Existing Texture Data

- newTextureViewWithPixelFormat:textureType:levels:slices:

Creates a new view of the texture, reinterpreting a subset of its data using a different type and pixel format.


- newTextureViewWithPixelFormat:textureType:levels:slices:swizzle:

Creates a new view of the texture, reinterpreting a subset of its data using a different type, pixel format, and swizzle pattern.