Enumeration

MTLTextureUsage

The options that determine how a texture will be used.

Declaration

typedef enum MTLTextureUsage : NSUInteger {
    ...
} MTLTextureUsage;

Overview

You can combine multiple usage options if the texture serves multiple uses during its life cycle. The texture can be used only in the ways specified by its usage options; otherwise, an error occurs. Setting appropriate usage options allows Metal to optimize GPU operations for the texture.

Topics

Specifying Texture Usage Options

MTLTextureUsageUnknown

An option that specifies that the texture usage is unknown.

MTLTextureUsageShaderRead

An option that enables reading or sampling from the texture.

MTLTextureUsageShaderWrite

An option that enables writing to the texture.

MTLTextureUsageRenderTarget

An option that enables using the texture as a color, depth, or stencil render target in a render pass descriptor.

MTLTextureUsagePixelFormatView

An option that enables using the texture to create texture views.

See Also

Querying Texture Attributes

textureType

The dimension and arrangement of the texture image data.

Required.

pixelFormat

The format of pixels in the texture.

Required.

width

The width of the texture image for the base level mipmap, in pixels.

Required.

height

The height of the texture image for the base level mipmap, in pixels.

Required.

depth

The depth of the texture image for the base level mipmap, in pixels.

Required.

mipmapLevelCount

The number of mipmap levels in the texture.

Required.

arrayLength

The number of slices in the texture array.

Required.

sampleCount

The number of samples in each pixel.

Required.

framebufferOnly

A Boolean value that indicates whether the texture can only be used as a render target.

Required.

usage

A description of how the texture can be accessed in shaders.

Required.

allowGPUOptimizedContents

A Boolean value indicating whether the GPU is allowed to adjust the contents of the texture to improve GPU performance.

Required.

shareable

A Boolean indicating whether this texture can be shared with other processes.

Required.

MTLTextureType

The dimension of each image, including whether multiple images are arranged into an array or a cube.