Instance Method

newTextureViewWithPixelFormat:textureType:levels:slices:swizzle:

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

Required.

Declaration

- (id<MTLTexture>)newTextureViewWithPixelFormat:(MTLPixelFormat)pixelFormat textureType:(MTLTextureType)textureType levels:(NSRange)levelRange slices:(NSRange)sliceRange swizzle:(MTLTextureSwizzleChannels)swizzle;

Parameters

pixelFormat

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

textureType

A new texture type.

levelRange

A new base level range that restricts which mipmap levels are visible in the new texture.

sliceRange

A new base slice range that restricts which array slices are visible in the new texture.

swizzle

The swizzle pattern the GPU uses to reorder the data when sampling or reading the texture.

Return Value

A new texture view.

Discussion

For more information on texture views, see newTextureViewWithPixelFormat:textureType:levels:slices:.

The swizzle pattern of the view is combined with that of the parent texture to generate the final swizzle pattern. For example: An [R,G,A,B] swizzle of a texture with a [R,1,1,G] swizzle pattern is [R,1,G,1].

See Also

Creating Textures by Reusing Image Data

- newTextureViewWithPixelFormat:

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

Required.

- newTextureViewWithPixelFormat:textureType:levels:slices:

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

Required.

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