copy(sourceTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:destinationTexture:destinationSlice:destinationLevel:destinationOrigin:)
Encodes a command that copies image data from a slice of a texture into a slice of another texture.
Declaration
func copy(sourceTexture: any MTLTexture, sourceSlice: Int, sourceLevel: Int, sourceOrigin: MTLOrigin, sourceSize: MTLSize, destinationTexture: any MTLTexture, destinationSlice: Int, destinationLevel: Int, destinationOrigin: MTLOrigin)Parameters
- sourceTexture:
An 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. - sourceOrigin:
An Mtlorigin instance that represents a location within
sourceTexturethat the command begins copying data from. Assign0to each dimension that’s not relevant tosourceTexture. - sourceSize:
An Mtlsize instance that represents the size of the region, in pixels, that the command copies from
sourceTexture, starting atsourceOrigin. Assign1to each dimension that’s not relevant tosourceTexture. If sourceTexture uses a compressed pixel format, setsourceSizeto a multiple of the pixel format’s block size. If the block extends outside the bounds of the texture, clampsourceSizeto the edge of the texture. - 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. - destinationOrigin:
An Mtlorigin instance that represents a location within
destinationTexturethat the command begins copying data to. Assign0to each dimension that’s not relevant todestinationTexture.