Instance Method

copy(from:to:)

Encodes a command to copy a texture's data to another texture.

Required.

Declaration

func copy(from sourceTexture: MTLTexture, to destinationTexture: MTLTexture)

Parameters

sourceTexture

The source texture to copy.

destinationTexture

The texture whose contents should be replaced.

Discussion

The source and destination textures must have the same pixel format and sample count.

If the source texture is larger than the destination texture, it must have a mipmap level that is the same size as mipmap 0 in the destination texture.

If the destination texture is larger than the source texture, the destination texture must have a mipmap level that is the same size as mipmap level 0 in the source texture.

The command copies all identical mipmap sizes. If the textures are arrays, it copies as many slices as possible.