Instance Method

copy(from:sourceSlice:sourceLevel:to:destinationSlice:destinationLevel:sliceCount:levelCount:)

Encodes a command to copy a subset of texture data to another texture.

Required.

Declaration

func copy(from sourceTexture: MTLTexture, sourceSlice: Int, sourceLevel: Int, to destinationTexture: MTLTexture, destinationSlice: Int, destinationLevel: Int, sliceCount: Int, levelCount: Int)

Parameters

sourceTexture

The source texture to copy.

sourceSlice

The first slice to copy.

sourceLevel

The source mipmap level to copy.

destinationTexture

The destination texture to modify.

destinationSlice

The first slice to overwrite.

destinationLevel

The destination mipmap level to overwrite.

sliceCount

The number of slices to copy.

levelCount

The number of mipmap levels to copy.

Discussion

The source and destination textures must have the same pixel format and sample count. The mipmaps indexed by sourceLevel and destinationLevel must have the same size.

The number of mipmaps must not extend past the mipmap chain for either the source or destination texture. Similarly, you can't specify a slice count that extends past the end of either texture's array of slices.

See Also

Copying Data Between Textures

func copy(from: MTLTexture, to: MTLTexture)

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

Required.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software