Package apple.metal.protocol
Interface MTLTexture
-
- All Superinterfaces:
MTLResource
public interface MTLTexture extends MTLResource
[@protocol] MTLTexture MTLTexture represents a collection of 1D, 2D, or 3D images. Each image in a texture is a 1D, 2D, 2DMultisample, or 3D image. The texture contains one or more images arranged in a mipmap stack. If there are multiple mipmap stacks, each one is referred to as a slice of the texture. 1D, 2D, 2DMultisample, and 3D textures have a single slice. In 1DArray and 2DArray textures, every slice is an array element. A Cube texture always has 6 slices, one for each face. In a CubeArray texture, each set of six slices is one element in the array. Most APIs that operate on individual images in a texture address those images via a tuple of a Slice, and Mipmap Level within that slice.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanallowGPUOptimizedContents()[@property] allowGPUOptimizedContents Allow GPU-optimization for the contents texture.longarrayLength()[@property] arrayLength The number of array elements in this MTLTexture.MTLBufferbuffer()[@property] buffer The buffer this texture view was created from, or nil if this is not a texture view or it was not created from a buffer.longbufferBytesPerRow()[@property] bufferBytesPerRow The bytesPerRow of the buffer this texture view was created from, or 0 if this is not a texture view.longbufferOffset()[@property] bufferOffset The offset of the buffer this texture view was created from, or 0 if this is not a texture view.longdepth()[@property] depth The depth of this MTLTexture instance in pixels.longfirstMipmapInTail()[@property] firstMipmapInTail For sparse textures this property returns index of first mipmap that is packed in tail.voidgetBytesBytesPerRowBytesPerImageFromRegionMipmapLevelSlice(org.moe.natj.general.ptr.VoidPtr pixelBytes, long bytesPerRow, long bytesPerImage, MTLRegion region, long level, long slice)getBytes:bytesPerRow:bytesPerImage:fromRegion:mipmapLevel:slice: Copies a block of pixels from a texture slice into the application's memory.voidgetBytesBytesPerRowFromRegionMipmapLevel(org.moe.natj.general.ptr.VoidPtr pixelBytes, long bytesPerRow, MTLRegion region, long level)getBytes:bytesPerRow:fromRegion:mipmapLevel: Convenience for getBytes:bytesPerRow:bytesPerImage:fromRegion:mipmapLevel:slice: that doesn't require slice related argumentslongheight()[@property] height The height of the MTLTexture instance in pixels.IOSurfaceRefiosurface()[@property] iosurface If this texture was created from an IOSurface, this returns a reference to that IOSurface. iosurface is nil if this texture was not created from an IOSurface.longiosurfacePlane()[@property] iosurfacePlane If this texture was created from an IOSurface, this returns the plane of the IOSurface from which the texture was created. iosurfacePlane is 0 if this texture was not created from an IOSurface.booleanisFramebufferOnly()[@property] framebufferOnly If YES, this texture can only be used with a MTLAttachmentDescriptor, and cannot be used as a texture argument for MTLRenderCommandEncoder, MTLBlitCommandEncoder, or MTLComputeCommandEncoder.booleanisShareable()[@property] shareable If YES, this texture can be shared with other processes.booleanisSparse()longmipmapLevelCount()[@property] mipmapLevelCount The number of mipmap levels in each slice of this MTLTexture.MTLSharedTextureHandlenewSharedTextureHandle()newSharedTextureHandle Create a new texture handle, that can be shared across process addres space boundaries.MTLTexturenewTextureViewWithPixelFormat(long pixelFormat)newTextureViewWithPixelFormat: Create a new texture which shares the same storage as the source texture, but with a different (but compatible) pixel format.MTLTexturenewTextureViewWithPixelFormatTextureTypeLevelsSlices(long pixelFormat, long textureType, NSRange levelRange, NSRange sliceRange)newTextureViewWithPixelFormat:textureType:levels:slices: Create a new texture which shares the same storage as the source texture, but with a different (but compatible) pixel format, texture type, levels and slices.MTLTexturenewTextureViewWithPixelFormatTextureTypeLevelsSlicesSwizzle(long pixelFormat, long textureType, NSRange levelRange, NSRange sliceRange, MTLTextureSwizzleChannels swizzle)newTextureViewWithPixelFormat:textureType:levels:slices:swizzle: Create a new texture which shares the same storage as the source texture, but with a different (but compatible) pixel format, texture type, levels, slices and swizzle.longparentRelativeLevel()[@property] parentRelativeLevel The base level of the texture this texture view was created from, or 0 if this is not a texture view.longparentRelativeSlice()[@property] parentRelativeSlice The base slice of the texture this texture view was created from, or 0 if this is not a texture view.MTLTextureparentTexture()[@property] parentTexture The texture this texture view was created from, or nil if this is not a texture view or it was not created from a texture.longpixelFormat()[@property] pixelFormat The MTLPixelFormat that is used to interpret this texture's contents.voidreplaceRegionMipmapLevelSliceWithBytesBytesPerRowBytesPerImage(MTLRegion region, long level, long slice, org.moe.natj.general.ptr.ConstVoidPtr pixelBytes, long bytesPerRow, long bytesPerImage)replaceRegion:mipmapLevel:slice:withBytes:bytesPerRow:bytesPerImage: Copy a block of pixel data from the caller's pointer into a texture slice.voidreplaceRegionMipmapLevelWithBytesBytesPerRow(MTLRegion region, long level, org.moe.natj.general.ptr.ConstVoidPtr pixelBytes, long bytesPerRow)replaceRegion:mipmapLevel:withBytes:bytesPerRow: Convenience for replaceRegion:mipmapLevel:slice:withBytes:bytesPerRow:bytesPerImage: that doesn't require slice related argumentsMTLResourcerootResource()[@property] rootResource The resource this texture was created from.longsampleCount()[@property] sampleCount The number of samples in each pixel of this MTLTexture.MTLTextureSwizzleChannelsswizzle()[@property] swizzle The channel swizzle used when reading or sampling from this texturelongtailSizeInBytes()[@property] tailSizeInBytes Amount of memory in bytes required to map sparse texture tail.longtextureType()[@property] type The type of this texture.longusage()[@property] usage Description of texture usage.longwidth()[@property] width The width of the MTLTexture instance in pixels.-
Methods inherited from interface apple.metal.protocol.MTLResource
allocatedSize, cpuCacheMode, device, hazardTrackingMode, heap, heapOffset, isAliasable, label, makeAliasable, resourceOptions, setLabel, setPurgeableState, storageMode
-
-
-
-
Method Detail
-
arrayLength
long arrayLength()
[@property] arrayLength The number of array elements in this MTLTexture. For non-Array texture types, arrayLength is 1.
-
buffer
MTLBuffer buffer()
[@property] buffer The buffer this texture view was created from, or nil if this is not a texture view or it was not created from a buffer.
-
bufferBytesPerRow
long bufferBytesPerRow()
[@property] bufferBytesPerRow The bytesPerRow of the buffer this texture view was created from, or 0 if this is not a texture view.
-
bufferOffset
long bufferOffset()
[@property] bufferOffset The offset of the buffer this texture view was created from, or 0 if this is not a texture view.
-
depth
long depth()
[@property] depth The depth of this MTLTexture instance in pixels. If this MTLTexture is not a 3D texture, the depth is 1
-
getBytesBytesPerRowBytesPerImageFromRegionMipmapLevelSlice
void getBytesBytesPerRowBytesPerImageFromRegionMipmapLevelSlice(org.moe.natj.general.ptr.VoidPtr pixelBytes, long bytesPerRow, long bytesPerImage, MTLRegion region, long level, long slice)getBytes:bytesPerRow:bytesPerImage:fromRegion:mipmapLevel:slice: Copies a block of pixels from a texture slice into the application's memory.
-
getBytesBytesPerRowFromRegionMipmapLevel
void getBytesBytesPerRowFromRegionMipmapLevel(org.moe.natj.general.ptr.VoidPtr pixelBytes, long bytesPerRow, MTLRegion region, long level)getBytes:bytesPerRow:fromRegion:mipmapLevel: Convenience for getBytes:bytesPerRow:bytesPerImage:fromRegion:mipmapLevel:slice: that doesn't require slice related arguments
-
height
long height()
[@property] height The height of the MTLTexture instance in pixels.
-
isFramebufferOnly
boolean isFramebufferOnly()
[@property] framebufferOnly If YES, this texture can only be used with a MTLAttachmentDescriptor, and cannot be used as a texture argument for MTLRenderCommandEncoder, MTLBlitCommandEncoder, or MTLComputeCommandEncoder. Furthermore, when this property's value is YES, readPixels/writePixels may not be used with this texture. Textures obtained from CAMetalDrawables may have this property set to YES, depending on the value of frameBufferOnly passed to their parent CAMetalLayer. Textures created directly by the application will not have any restrictions.
-
mipmapLevelCount
long mipmapLevelCount()
[@property] mipmapLevelCount The number of mipmap levels in each slice of this MTLTexture.
-
newTextureViewWithPixelFormat
MTLTexture newTextureViewWithPixelFormat(long pixelFormat)
newTextureViewWithPixelFormat: Create a new texture which shares the same storage as the source texture, but with a different (but compatible) pixel format.
-
newTextureViewWithPixelFormatTextureTypeLevelsSlices
MTLTexture newTextureViewWithPixelFormatTextureTypeLevelsSlices(long pixelFormat, long textureType, NSRange levelRange, NSRange sliceRange)
newTextureViewWithPixelFormat:textureType:levels:slices: Create a new texture which shares the same storage as the source texture, but with a different (but compatible) pixel format, texture type, levels and slices.
-
parentRelativeLevel
long parentRelativeLevel()
[@property] parentRelativeLevel The base level of the texture this texture view was created from, or 0 if this is not a texture view.
-
parentRelativeSlice
long parentRelativeSlice()
[@property] parentRelativeSlice The base slice of the texture this texture view was created from, or 0 if this is not a texture view.
-
parentTexture
MTLTexture parentTexture()
[@property] parentTexture The texture this texture view was created from, or nil if this is not a texture view or it was not created from a texture.
-
pixelFormat
long pixelFormat()
[@property] pixelFormat The MTLPixelFormat that is used to interpret this texture's contents.
-
replaceRegionMipmapLevelSliceWithBytesBytesPerRowBytesPerImage
void replaceRegionMipmapLevelSliceWithBytesBytesPerRowBytesPerImage(MTLRegion region, long level, long slice, org.moe.natj.general.ptr.ConstVoidPtr pixelBytes, long bytesPerRow, long bytesPerImage)
replaceRegion:mipmapLevel:slice:withBytes:bytesPerRow:bytesPerImage: Copy a block of pixel data from the caller's pointer into a texture slice.
-
replaceRegionMipmapLevelWithBytesBytesPerRow
void replaceRegionMipmapLevelWithBytesBytesPerRow(MTLRegion region, long level, org.moe.natj.general.ptr.ConstVoidPtr pixelBytes, long bytesPerRow)
replaceRegion:mipmapLevel:withBytes:bytesPerRow: Convenience for replaceRegion:mipmapLevel:slice:withBytes:bytesPerRow:bytesPerImage: that doesn't require slice related arguments
-
rootResource
MTLResource rootResource()
[@property] rootResource The resource this texture was created from. It may be a texture or a buffer. If this texture is not reusing storage of another MTLResource, then nil is returned.
-
sampleCount
long sampleCount()
[@property] sampleCount The number of samples in each pixel of this MTLTexture. If this texture is any type other than 2DMultisample, samples is 1.
-
textureType
long textureType()
[@property] type The type of this texture.
-
usage
long usage()
[@property] usage Description of texture usage.
-
width
long width()
[@property] width The width of the MTLTexture instance in pixels.
-
iosurface
IOSurfaceRef iosurface()
[@property] iosurface If this texture was created from an IOSurface, this returns a reference to that IOSurface. iosurface is nil if this texture was not created from an IOSurface.
-
iosurfacePlane
long iosurfacePlane()
[@property] iosurfacePlane If this texture was created from an IOSurface, this returns the plane of the IOSurface from which the texture was created. iosurfacePlane is 0 if this texture was not created from an IOSurface.
-
allowGPUOptimizedContents
boolean allowGPUOptimizedContents()
[@property] allowGPUOptimizedContents Allow GPU-optimization for the contents texture. The default value is true. Useful for opting-out of GPU-optimization when implicit optimization (e.g. RT writes) is regressing CPU-read-back performance. See the documentation for optimizeContentsForGPUAccess: and optimizeContentsForCPUAccess: APIs.
-
firstMipmapInTail
long firstMipmapInTail()
[@property] firstMipmapInTail For sparse textures this property returns index of first mipmap that is packed in tail. Mapping this mipmap level will map all subsequent mipmap levels.
-
isShareable
boolean isShareable()
[@property] shareable If YES, this texture can be shared with other processes. Texture can be shared across process addres space boundaries through use of sharedTextureHandle and XPC.
-
isSparse
boolean isSparse()
-
newSharedTextureHandle
MTLSharedTextureHandle newSharedTextureHandle()
newSharedTextureHandle Create a new texture handle, that can be shared across process addres space boundaries.
-
newTextureViewWithPixelFormatTextureTypeLevelsSlicesSwizzle
MTLTexture newTextureViewWithPixelFormatTextureTypeLevelsSlicesSwizzle(long pixelFormat, long textureType, NSRange levelRange, NSRange sliceRange, MTLTextureSwizzleChannels swizzle)
newTextureViewWithPixelFormat:textureType:levels:slices:swizzle: Create a new texture which shares the same storage as the source texture, but with a different (but compatible) pixel format, texture type, levels, slices and swizzle.
-
swizzle
MTLTextureSwizzleChannels swizzle()
[@property] swizzle The channel swizzle used when reading or sampling from this texture
-
tailSizeInBytes
long tailSizeInBytes()
[@property] tailSizeInBytes Amount of memory in bytes required to map sparse texture tail.
-
-