optimizeContents(forCPUAccess:slice:level:)
Encodes a command that modifies the contents of a texture to improve the performance of CPU accesses to its contents in a specific region.
Declaration
func optimizeContents(forCPUAccess texture: any MTLTexture, slice: Int, level: Int)Parameters
- texture:
A Mtltexture the command optimizes for CPU access.
- slice:
A slice within
texture. - level:
A mipmap level within
texture.
Discussion
Optimizing a texture for CPU access may affect the performance of GPU accesses, however, the data the GPU retrieves from the texture remains consistent.
You typically use this command for:
Textures the CPU accesses for an extended period of time.
Textures with a storageMode property that’s MTLStorageMode.shared or MTLStorageMode.managed.