Instance Method

synchronizeTexture:slice:level:

Encodes a command to synchronize part of a managed texture from the GPU to the CPU.

Required.

Declaration

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

Parameters

texture

The texture to synchronize. The texture must have a MTLStorageModeManaged storage mode.

slice

A slice of the texture.

level

A mipmap level of the texture.

Discussion

When the GPU modifies a managed texture, Metal guarantees that the changes are visible to future accesses by the GPU. If you try to read the texture on the CPU, the results are undefined. To make the changes visible to the CPU, encode a synchronization command. After the synchronization command completes, the CPU can access the contents of the texture.

This method performs the same synchronization as synchronizeResource:, except that it flushes only the specified subset of a texture.

See Also

Synchronizing Managed Resources to the CPU

- synchronizeResource:

Encodes a command to synchronize the contents of a managed resource from the GPU to the CPU.

Required.