copy(from:sourceSlice:sourceLevel:to:destinationSlice:destinationLevel:sliceCount:levelCount:)
Encodes a command that copies slices of a texture to another texture’s slices.
Declaration
func copy(from sourceTexture: any MTLTexture, sourceSlice: Int, sourceLevel: Int, to destinationTexture: any MTLTexture, destinationSlice: Int, destinationLevel: Int, sliceCount: Int, levelCount: Int)Parameters
- sourceTexture:
A texture the command copies data from.
- sourceSlice:
A slice within
sourceTexturethe command uses as a starting point to copy data from.Set this to
0ifsourceTextureisn’t a texture array or a cube texture. - sourceLevel:
A mipmap level within
sourceTexture. - destinationTexture:
Another texture the command copies the data to that has the same pixel format and sample count as
sourceTexture. - destinationSlice:
A slice within
destinationTexturethe command uses as its starting point for coping data.Set this to
0ifdestinationTextureisn’t a texture array or a cube texture. - destinationLevel:
A mipmap level within
destinationTexturethat has the same size as the source texture’ssourceLevelmipmap. - sliceCount:
The number of slices the command copies so that it satisfies these conditions:
The sum of
sourceLevelandsourceSlicedoesn’t exceed the number of slices insourceTexture.The sum of
destinationLevelanddestinationSlicedoesn’t exceed the number of slices indestinationTexture.
- levelCount:
The number of mipmap levels the command copies so that it satisfies these conditions:
The sum of
levelCountandsourceLeveldoesn’t exceed the number of mipmap levels insourceTexture.The sum of
levelCountanddestinationLeveldoesn’t exceed the number of mipmap levels indestinationTexture.