copy(sourceTexture:sourceSlice:sourceLevel:destinationTexture:destinationSlice:destinationLevel:sliceCount:levelCount:)
Encodes a command that copies slices of a texture to slices of another texture.
Declaration
func copy(sourceTexture: any MTLTexture, sourceSlice: Int, sourceLevel: Int, destinationTexture: any MTLTexture, destinationSlice: Int, destinationLevel: Int, sliceCount: Int, levelCount: Int)Parameters
- sourceTexture:
A Mtltexture texture that the command copies data from. To read the source texture contents, you need to set its Isframebufferonly property to False prior to drawing into it.
- sourceSlice:
A slice within
sourceTexturethe command uses as a starting point to copy data from. Set this to0ifsourceTextureisn’t a texture array or a cube texture. - sourceLevel:
A mipmap level within
sourceTexture. - destinationTexture:
Another Mtltexture the command copies the data to that has the same Pixelformat and Samplecount as
sourceTexture. To write the contents into this texture, you need to set its Isframebufferonly property to False. - destinationSlice:
A slice within
destinationTexturethe command uses as its starting point for copying data to. Set this to0ifdestinationTextureisn’t a texture array or a cube texture. - destinationLevel:
A mipmap level within
destinationTexture. The mipmap level you reference needs to have the same size as thesourceTextureslice’s mipmap atsourceLevel. - sliceCount:
The number of slices the command copies so that it satisfies the conditions that the sum of
sourceSliceandsliceCountdoesn’t exceed the number of slices insourceTextureand the sum ofdestinationSliceandsliceCountdoesn’t exceed the number of slices indestinationTexture. - levelCount:
The number of mipmap levels the command copies so that it satisfies the conditions that the sum of
sourceLevelandlevelCountdoesn’t exceed the number of mipmap levels insourceTextureand the sum ofdestinationLevelandlevelCountdoesn’t exceed the number of mipmap levels indestinationTexture.