Instance Method


Creates a new texture object that shares the texture's storage allocation, reinterpreting the data using a different pixel format.



func makeTextureView(pixelFormat: MTLPixelFormat) -> MTLTexture?



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.


Not all pixel formats are compatible with one another; for example, you can't use this method between color pixel formats of different sizes. 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 MTLPixelFormat.rg16Uint pixel format that contains image data for Red 0xFFFE and Green 0x0001, this method would reinterpret that data in an MTLPixelFormat.r32Uint 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 MTLPixelFormatA2BGR10Uint and MTLPixelFormatB10GR11Float to be compatible, but it's unlikely that the same data can be interpreted by both formats in a meaningful way.

See Also

Creating Textures by Reusing Image Data

func makeTextureView(pixelFormat: MTLPixelFormat, textureType: MTLTextureType, levels: Range<Int>, slices: Range<Int>) -> MTLTexture?

Creates a new texture object that shares the texture's storage allocation, reinterpreting the texture image data with a different pixel format.

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