Contents

pixelFormatView

An option to create texture views with a different component layout.

Declaration

static var pixelFormatView: MTLTextureUsage { get }

Mentioned in

Discussion

Set this option if you need to call any of these methods of the texture to create a texture view with a different component layout:

For example, if your texture uses the MTLPixelFormat.rgba8Unorm pixel format, you can reinterpret the data as MTLPixelFormat.r32Uint. The pixel layout is considered different if the number of components differs, or if their size or order is different from the components in the original pixel format.

Don’t set this option if your texture view needs to read the component values in a different order. Instead, create a texture view with a swizzle pattern that specifies the new order.

Don’t set this option if your texture view only converts between linear space and sRGB. For example, if your texture uses the MTLPixelFormat.rgba8Unorm pixel format and your texture view uses MTLPixelFormat.bgra8Unorm_srgb.

In iOS devices with GPU family 5 and later, Metal doesn’t apply lossless compression to the given texture if you set this option.

See Also

Specifying texture usage options