Instance Method

optimizeContentsForGPUAccess:slice:level:

Encodes a command to optimize part of a texture for better performance when the GPU accesses it.

Required.

Declaration

- (void)optimizeContentsForGPUAccess:(id<MTLTexture>)texture slice:(NSUInteger)slice level:(NSUInteger)level;

Parameters

texture

The texture to optimize.

slice

The slice within the texture to optimize.

level

A mipmap level of the texture.

Discussion

You can access shared and managed textures from both the CPU and the GPU. If you will access a texture from the GPU for an extended period of time, call this method to optimize access to the texture from the GPU.

When this command is executed, the Metal device can make changes to the resource to improve performance on the GPU, so long as those changes do not result in a loss of data. The CPU can still read data stored in this texture, and will get the same results, but possibly at a performance penalty.

See Also

Optimizing Texture Access Performance

- optimizeContentsForGPUAccess:

Encodes a command to optimize a texture for better performance when the GPU accesses it.

Required.

- optimizeContentsForCPUAccess:

Encodes a command to optimize a texture for better performance when the CPU accesses it.

Required.

- optimizeContentsForCPUAccess:slice:level:

Encodes a command to optimize part of a texture for better performance when the CPU accesses it.

Required.