pub struct TextureDescriptor(/* private fields */);Expand description
Configuration for creating textures.
C++ equivalent: MTL::TextureDescriptor
Implementations§
Source§impl TextureDescriptor
impl TextureDescriptor
Sourcepub fn new() -> Option<Self>
pub fn new() -> Option<Self>
Create a new texture descriptor.
C++ equivalent: static TextureDescriptor* alloc()->init()
Sourcepub fn texture_2d_descriptor(
pixel_format: PixelFormat,
width: UInteger,
height: UInteger,
mipmapped: bool,
) -> Option<Self>
pub fn texture_2d_descriptor( pixel_format: PixelFormat, width: UInteger, height: UInteger, mipmapped: bool, ) -> Option<Self>
Create a descriptor for a 2D texture.
C++ equivalent: static TextureDescriptor* texture2DDescriptor(PixelFormat, NS::UInteger, NS::UInteger, bool)
Sourcepub fn texture_cube_descriptor(
pixel_format: PixelFormat,
size: UInteger,
mipmapped: bool,
) -> Option<Self>
pub fn texture_cube_descriptor( pixel_format: PixelFormat, size: UInteger, mipmapped: bool, ) -> Option<Self>
Create a descriptor for a cube texture.
C++ equivalent: static TextureDescriptor* textureCubeDescriptor(PixelFormat, NS::UInteger, bool)
Sourcepub fn texture_buffer_descriptor(
pixel_format: PixelFormat,
width: UInteger,
resource_options: ResourceOptions,
usage: TextureUsage,
) -> Option<Self>
pub fn texture_buffer_descriptor( pixel_format: PixelFormat, width: UInteger, resource_options: ResourceOptions, usage: TextureUsage, ) -> Option<Self>
Create a descriptor for a texture buffer.
C++ equivalent: static TextureDescriptor* textureBufferDescriptor(PixelFormat, NS::UInteger, ResourceOptions, TextureUsage)
Sourcepub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
Create a TextureDescriptor from a raw pointer.
§Safety
The pointer must be a valid Metal texture descriptor object.
Sourcepub fn texture_type(&self) -> TextureType
pub fn texture_type(&self) -> TextureType
Get the texture type.
Sourcepub fn pixel_format(&self) -> PixelFormat
pub fn pixel_format(&self) -> PixelFormat
Get the pixel format.
Sourcepub fn mipmap_level_count(&self) -> UInteger
pub fn mipmap_level_count(&self) -> UInteger
Get the mipmap level count.
Sourcepub fn sample_count(&self) -> UInteger
pub fn sample_count(&self) -> UInteger
Get the sample count.
Sourcepub fn array_length(&self) -> UInteger
pub fn array_length(&self) -> UInteger
Get the array length.
Sourcepub fn storage_mode(&self) -> StorageMode
pub fn storage_mode(&self) -> StorageMode
Get the storage mode.
Sourcepub fn cpu_cache_mode(&self) -> CPUCacheMode
pub fn cpu_cache_mode(&self) -> CPUCacheMode
Get the CPU cache mode.
Sourcepub fn hazard_tracking_mode(&self) -> HazardTrackingMode
pub fn hazard_tracking_mode(&self) -> HazardTrackingMode
Get the hazard tracking mode.
Sourcepub fn resource_options(&self) -> ResourceOptions
pub fn resource_options(&self) -> ResourceOptions
Get the resource options.
Sourcepub fn usage(&self) -> TextureUsage
pub fn usage(&self) -> TextureUsage
Get the usage flags.
Sourcepub fn allow_gpu_optimized_contents(&self) -> bool
pub fn allow_gpu_optimized_contents(&self) -> bool
Get whether GPU-optimized contents are allowed.
Sourcepub fn compression_type(&self) -> TextureCompressionType
pub fn compression_type(&self) -> TextureCompressionType
Get the compression type.
Sourcepub fn swizzle(&self) -> TextureSwizzleChannels
pub fn swizzle(&self) -> TextureSwizzleChannels
Get the swizzle channels.
Sourcepub fn placement_sparse_page_size(&self) -> SparsePageSize
pub fn placement_sparse_page_size(&self) -> SparsePageSize
Get the placement sparse page size.
Sourcepub fn set_texture_type(&self, texture_type: TextureType)
pub fn set_texture_type(&self, texture_type: TextureType)
Set the texture type.
Sourcepub fn set_pixel_format(&self, pixel_format: PixelFormat)
pub fn set_pixel_format(&self, pixel_format: PixelFormat)
Set the pixel format.
Sourcepub fn set_height(&self, height: UInteger)
pub fn set_height(&self, height: UInteger)
Set the height.
Sourcepub fn set_mipmap_level_count(&self, count: UInteger)
pub fn set_mipmap_level_count(&self, count: UInteger)
Set the mipmap level count.
Sourcepub fn set_sample_count(&self, count: UInteger)
pub fn set_sample_count(&self, count: UInteger)
Set the sample count.
Sourcepub fn set_array_length(&self, length: UInteger)
pub fn set_array_length(&self, length: UInteger)
Set the array length.
Sourcepub fn set_storage_mode(&self, mode: StorageMode)
pub fn set_storage_mode(&self, mode: StorageMode)
Set the storage mode.
Sourcepub fn set_cpu_cache_mode(&self, mode: CPUCacheMode)
pub fn set_cpu_cache_mode(&self, mode: CPUCacheMode)
Set the CPU cache mode.
Sourcepub fn set_hazard_tracking_mode(&self, mode: HazardTrackingMode)
pub fn set_hazard_tracking_mode(&self, mode: HazardTrackingMode)
Set the hazard tracking mode.
Sourcepub fn set_resource_options(&self, options: ResourceOptions)
pub fn set_resource_options(&self, options: ResourceOptions)
Set the resource options.
Sourcepub fn set_usage(&self, usage: TextureUsage)
pub fn set_usage(&self, usage: TextureUsage)
Set the usage flags.
Sourcepub fn set_allow_gpu_optimized_contents(&self, allow: bool)
pub fn set_allow_gpu_optimized_contents(&self, allow: bool)
Set whether GPU-optimized contents are allowed.
Sourcepub fn set_compression_type(&self, compression_type: TextureCompressionType)
pub fn set_compression_type(&self, compression_type: TextureCompressionType)
Set the compression type.
Sourcepub fn set_swizzle(&self, swizzle: TextureSwizzleChannels)
pub fn set_swizzle(&self, swizzle: TextureSwizzleChannels)
Set the swizzle channels.
Sourcepub fn set_placement_sparse_page_size(&self, size: SparsePageSize)
pub fn set_placement_sparse_page_size(&self, size: SparsePageSize)
Set the placement sparse page size.