//! This file has been automatically generated by `objc2`'s `header-translator`. //! DO NOT EDIT use core::ffi::*; use core::ptr::NonNull; #[cfg(feature = "dispatch2")] use dispatch2::*; use objc2::__framework_prelude::*; use objc2_foundation::*; #[cfg(feature = "objc2-io-surface")] use objc2_io_surface::*;
/// Returns a reference to the preferred system default Metal device. /// /// On Mac OS X systems that support automatic graphics switching, calling /// this API to get a Metal device will cause the system to switch to the high power /// GPU. On other systems that support more than one GPU it will return the GPU that /// is associated with the main display. #[inline] pubextern"C-unwind"fn MTLCreateSystemDefaultDevice(
) -> Option<Retained<ProtocolObject<dyn MTLDevice>>> { extern"C-unwind" { fn MTLCreateSystemDefaultDevice() -> *mut ProtocolObject<dyn MTLDevice>;
} let ret = unsafe { MTLCreateSystemDefaultDevice() }; unsafe { Retained::from_raw(ret) }
}
extern"C" { /// This notification is posted when the user has requested that applications cease using a particular device. Applications /// should assume that the device will be removed (terminated) imminently. Additionally, the device will be removed from the internal /// device array prior to this notification being posted. Applications should immediately begin the process of releasing all resources /// created on the given device, as well as any references to the device itself. /// /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtldeviceremovalrequestednotification?language=objc) pubstatic MTLDeviceRemovalRequestedNotification: &'static MTLDeviceNotificationName;
}
extern"C" { /// This notification is posted if the device is removed while there are still outstanding references to it, due to either a surprise /// or forced disconnect by the user. Applications must expect that any attempt to use the device after this point will fail. /// /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtldevicewasremovednotification?language=objc) pubstatic MTLDeviceWasRemovedNotification: &'static MTLDeviceNotificationName;
}
/// Returns an NSArray of the current set of available Metal devices and installs a notification handler /// to be notified of any further changes (additions, removals, etc.). The observer return value is retained by Metal and may be /// passed to MTLRemoveDeviceObserver() if the application no longer wishes to receive notifications. /// /// Note: The observer out parameter is returned with a +1 retain count in addition to the retain mentioned above. /// /// # Safety /// /// - `observer` must be a valid pointer. /// - `handler` must be a valid pointer. #[cfg(feature = "block2")] #[inline] pubunsafeextern"C-unwind"fn MTLCopyAllDevicesWithObserver(
observer: NonNull<*mut ProtocolObject<dyn NSObjectProtocol>>,
handler: MTLDeviceNotificationHandler,
) -> Retained<NSArray<ProtocolObject<dyn MTLDevice>>> { extern"C-unwind" { fn MTLCopyAllDevicesWithObserver(
observer: NonNull<*mut ProtocolObject<dyn NSObjectProtocol>>,
handler: MTLDeviceNotificationHandler,
) -> *mut NSArray<ProtocolObject<dyn MTLDevice>>;
} let ret = unsafe { MTLCopyAllDevicesWithObserver(observer, handler) }; unsafe { Retained::from_raw(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
extern"C-unwind" { /// Removes a previously installed observer for device change notifications. /// /// # Safety /// /// `observer` should be of the correct type. pubfn MTLRemoveDeviceObserver(observer: &ProtocolObject<dyn NSObjectProtocol>);
}
/// Describes the memory requirements for an acceleration structure /// /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlaccelerationstructuresizes?language=objc) #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq)] pubstruct MTLAccelerationStructureSizes { /// The required size, in bytes, of the built acceleration structure pub accelerationStructureSize: NSUInteger, /// The required size, in bytes, of the scratch buffer used to build the acceleration structure pub buildScratchBufferSize: NSUInteger, /// The required size, in bytes, of the scratch buffer used to refit the acceleration structure pub refitScratchBufferSize: NSUInteger,
}
/// The length of an array of constants, textures, or samplers, or 0 for non-array arguments #[unsafe(method(arrayLength))] #[unsafe(method_family = none)] pubfn arrayLength(&self) -> NSUInteger;
/// if set forces the constant block to be aligned to the given alignment /// /// Should only be set on the first constant of the block and is only valid if a corresponding /// explicit "alignas" is applied to the constant in the metal shader language. #[unsafe(method(constantBlockAlignment))] #[unsafe(method_family = none)] pubfn constantBlockAlignment(&self) -> NSUInteger;
extern_protocol!( /// MTLDevice represents a processor capable of data parallel computations /// /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtldevice?language=objc) pubunsafetrait MTLDevice: NSObjectProtocol + Send + Sync { /// The full name of the vendor device. #[unsafe(method(name))] #[unsafe(method_family = none)] fn name(&self) -> Retained<NSString>;
/// Returns the IORegistry ID for the Metal device /// /// The registryID value for a Metal device is global to all tasks, and may be used /// to identify the GPU across task boundaries. #[unsafe(method(registryID))] #[unsafe(method_family = none)] fn registryID(&self) -> u64;
#[cfg(feature = "MTLTypes")] /// The maximum number of threads along each dimension. #[unsafe(method(maxThreadsPerThreadgroup))] #[unsafe(method_family = none)] fn maxThreadsPerThreadgroup(&self) -> MTLSize;
/// On systems that support automatic graphics switching, this will return YES for the the low power device. #[unsafe(method(isLowPower))] #[unsafe(method_family = none)] fn isLowPower(&self) -> bool;
/// On systems that include more that one GPU, this will return YES for any device that does not support any displays. Only available on Mac OS X. #[unsafe(method(isHeadless))] #[unsafe(method_family = none)] fn isHeadless(&self) -> bool;
/// If this GPU is removable, this property will return YES. /// /// If a GPU is is removed without warning, APIs may fail even with good input, even before a notification can get posted informing /// the application that the device has been removed. #[unsafe(method(isRemovable))] #[unsafe(method_family = none)] fn isRemovable(&self) -> bool;
/// Returns YES if this GPU shares its memory with the rest of the machine (CPU, etc.) /// /// Some GPU architectures do not have dedicated local memory and instead only use the same memory shared with the rest /// of the machine. This property will return YES for GPUs that fall into that category. #[unsafe(method(hasUnifiedMemory))] #[unsafe(method_family = none)] fn hasUnifiedMemory(&self) -> bool;
/// Returns an approximation of how much memory this device can use with good performance. /// /// Performance may be improved by keeping the total size of all resources (texture and buffers) /// and heaps less than this threshold, beyond which the device is likely to be overcommitted and incur a /// performance penalty. #[unsafe(method(recommendedMaxWorkingSetSize))] #[unsafe(method_family = none)] fn recommendedMaxWorkingSetSize(&self) -> u64;
/// Returns an enum that indicates where the GPU is located relative to the host computer. /// /// The returned value indicates if the GPU is built into the computer, inserted into /// a slot internal to the computer, or external to the computer. Otherwise it is Unspecified #[unsafe(method(location))] #[unsafe(method_family = none)] fn location(&self) -> MTLDeviceLocation;
/// Returns a value that further specifies the GPU's location /// /// The returned value indicates which slot or Thunderbolt port the GPU is attached /// to. For Built-in GPUs, if LowPower this value is 0, otherwise it is 1. It is possible for multiple GPUs to have /// the same location and locationNumber; e.g.: A PCI card with multiple GPUs, or an eGPU /// daisy-chained off of another eGPU attached to a host Thunderbolt port. #[unsafe(method(locationNumber))] #[unsafe(method_family = none)] fn locationNumber(&self) -> NSUInteger;
/// Upper bound of System RAM /// < /// => VRAM transfer rate in bytes/sec /// /// The returned value indicates the theoretical maximum data rate in bytes/second /// from host memory to the GPU's VRAM. This is derived from the raw data clock rate and as /// such may not be reachable under real-world conditions. For Built-in GPUs this value is 0. #[unsafe(method(maxTransferRate))] #[unsafe(method_family = none)] fn maxTransferRate(&self) -> u64;
/// Query device for raster order groups support. /// /// Returns: BOOL value. If YES, the device supports raster order groups. If NO, the device does not. #[unsafe(method(areRasterOrderGroupsSupported))] #[unsafe(method_family = none)] fn areRasterOrderGroupsSupported(&self) -> bool;
/// Query device for 32-bit Float texture filtering support. Specifically, R32Float, RG32Float, and RGBA32Float. /// /// Returns: BOOL value. If YES, the device supports filtering 32-bit Float textures. If NO, the device does not. #[unsafe(method(supports32BitFloatFiltering))] #[unsafe(method_family = none)] fn supports32BitFloatFiltering(&self) -> bool;
/// Query device for 32-bit MSAA texture support. Specifically, added support for allocating 32-bit Integer format textures (R32Uint, R32Sint, RG32Uint, RG32Sint, RGBA32Uint, and RGBA32Sint) and resolving 32-bit Float format textures (R32Float, RG32Float, and RGBA32Float). /// /// Returns: BOOL value. If YES, the device supports these additional 32-bit MSAA texture capabilities. If NO, the devices does not. #[unsafe(method(supports32BitMSAA))] #[unsafe(method_family = none)] fn supports32BitMSAA(&self) -> bool;
/// Query device for whether it supports the `calculate_clampled_lod` and `calculate_unclamped_lod` Metal shading language functionality. /// /// Returns: BOOL value. If YES, the device supports the calculate LOD functionality. If NO, the device does not. #[unsafe(method(supportsQueryTextureLOD))] #[unsafe(method_family = none)] fn supportsQueryTextureLOD(&self) -> bool;
/// Query device for BC Texture format support /// /// Returns: BOOL value. If YES, the device supports compressed BC Texture formats. If NO, the device does not. #[unsafe(method(supportsBCTextureCompression))] #[unsafe(method_family = none)] fn supportsBCTextureCompression(&self) -> bool;
/// Query device for pull model interpolation support which allows a fragment shader to compute multiple interpolations (at center, at centroid, at offset, at sample) of a fragment input. /// /// Returns: BOOL value. If YES, the device supports pull model interpolation. If NO, the device does not. #[unsafe(method(supportsPullModelInterpolation))] #[unsafe(method_family = none)] fn supportsPullModelInterpolation(&self) -> bool;
/// Query device for Barycentric coordinates support; deprecated, use supportsShaderBarycentricCoordinates /// /// Returns: BOOL value. If YES, the device barycentric coordinates #[deprecated] #[unsafe(method(areBarycentricCoordsSupported))] #[unsafe(method_family = none)] fn areBarycentricCoordsSupported(&self) -> bool;
/// Query device for Barycentric Coordinates support. /// /// Returns: BOOL value. If YES, the device supports barycentric coordinates. If NO, the device does not. #[unsafe(method(supportsShaderBarycentricCoordinates))] #[unsafe(method_family = none)] fn supportsShaderBarycentricCoordinates(&self) -> bool;
/// The current size in bytes of all resources allocated by this device #[unsafe(method(currentAllocatedSize))] #[unsafe(method_family = none)] fn currentAllocatedSize(&self) -> NSUInteger;
#[cfg(feature = "MTLLogState")] /// This method will create a new MTLLogState. #[unsafe(method(newLogStateWithDescriptor:error:_))] #[unsafe(method_family = new)] fn newLogStateWithDescriptor_error(
&self,
descriptor: &MTLLogStateDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLLogState>>, Retained<NSError>>;
#[cfg(feature = "MTLCommandQueue")] /// Create and return a new command queue. Command Queues created via this method will only allow up to 64 non-completed command buffers. /// /// Returns: The new command queue object #[unsafe(method(newCommandQueue))] #[unsafe(method_family = new)] fn newCommandQueue(&self) -> Option<Retained<ProtocolObject<dyn MTLCommandQueue>>>;
#[cfg(feature = "MTLCommandQueue")] /// Create and return a new command queue with a given upper bound on non-completed command buffers. /// /// Returns: The new command queue object #[unsafe(method(newCommandQueueWithMaxCommandBufferCount:))] #[unsafe(method_family = new)] fn newCommandQueueWithMaxCommandBufferCount(
&self,
max_command_buffer_count: NSUInteger,
) -> Option<Retained<ProtocolObject<dyn MTLCommandQueue>>>;
#[cfg(feature = "MTLCommandQueue")] /// Create a MTLCommandQueue according to MTLCommandQueueDescriptor. #[unsafe(method(newCommandQueueWithDescriptor:))] #[unsafe(method_family = new)] fn newCommandQueueWithDescriptor(
&self,
descriptor: &MTLCommandQueueDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLCommandQueue>>>;
#[cfg(feature = "MTLTexture")] /// Determine the byte size of textures when sub-allocated from a heap. /// /// This method can be used to help determine the required heap size. #[unsafe(method(heapTextureSizeAndAlignWithDescriptor:))] #[unsafe(method_family = none)] fn heapTextureSizeAndAlignWithDescriptor(
&self,
desc: &MTLTextureDescriptor,
) -> MTLSizeAndAlign;
#[cfg(feature = "MTLResource")] /// Determine the byte size of buffers when sub-allocated from a heap. /// /// This method can be used to help determine the required heap size. #[unsafe(method(heapBufferSizeAndAlignWithLength:options:))] #[unsafe(method_family = none)] fn heapBufferSizeAndAlignWithLength_options(
&self,
length: NSUInteger,
options: MTLResourceOptions,
) -> MTLSizeAndAlign;
#[cfg(all(feature = "MTLAllocation", feature = "MTLHeap"))] /// Create a new heap with the given descriptor. #[unsafe(method(newHeapWithDescriptor:))] #[unsafe(method_family = new)] fn newHeapWithDescriptor(
&self,
descriptor: &MTLHeapDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLHeap>>>;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLBuffer",
feature = "MTLResource"
))] /// Create a buffer by allocating new memory and specifing the initial contents to be copied into it. /// /// # Safety /// /// `pointer` must be a valid pointer. #[unsafe(method(newBufferWithBytes:length:options:))] #[unsafe(method_family = new)] unsafefn newBufferWithBytes_length_options(
&self,
pointer: NonNull<c_void>,
length: NSUInteger,
options: MTLResourceOptions,
) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLBuffer",
feature = "MTLResource",
feature = "block2"
))] /// Create a buffer by wrapping an existing part of the address space. /// /// # Safety /// /// - `pointer` must be a valid pointer. /// - `deallocator` block must be sendable. #[unsafe(method(newBufferWithBytesNoCopy:length:options:deallocator:))] #[unsafe(method_family = new)] unsafefn newBufferWithBytesNoCopy_length_options_deallocator(
&self,
pointer: NonNull<c_void>,
length: NSUInteger,
options: MTLResourceOptions,
deallocator: Option<&block2::DynBlock<dynFn(NonNull<c_void>, NSUInteger)>>,
) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;
#[cfg(feature = "MTLDepthStencil")] /// Create a depth/stencil test state object. #[unsafe(method(newDepthStencilStateWithDescriptor:))] #[unsafe(method_family = new)] fn newDepthStencilStateWithDescriptor(
&self,
descriptor: &MTLDepthStencilDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLDepthStencilState>>>;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLResource",
feature = "MTLTexture",
feature = "objc2-io-surface"
))] /// Create a new texture from an IOSurface. /// /// Parameter `descriptor`: A description of the properties for the new texture. /// /// Parameter `iosurface`: The IOSurface to use as storage for the new texture. /// /// Parameter `plane`: The plane within the IOSurface to use. /// /// Returns: A new texture object. #[unsafe(method(newTextureWithDescriptor:iosurface:plane:))] #[unsafe(method_family = new)] fn newTextureWithDescriptor_iosurface_plane(
&self,
descriptor: &MTLTextureDescriptor,
iosurface: &IOSurfaceRef,
plane: NSUInteger,
) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLResource",
feature = "MTLTexture"
))] /// Create a new texture that can be shared across process boundaries. /// /// This texture can be shared between process boundaries /// but not between different GPUs, by passing its MTLSharedTextureHandle. /// /// Parameter `descriptor`: A description of the properties for the new texture. /// /// Returns: A new texture object. #[unsafe(method(newSharedTextureWithDescriptor:))] #[unsafe(method_family = new)] fn newSharedTextureWithDescriptor(
&self,
descriptor: &MTLTextureDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLResource",
feature = "MTLTexture"
))] /// Recreate shared texture from received texture handle. /// /// This texture was shared between process boundaries by other /// process using MTLSharedTextureHandle. Current process will now share /// it with other processes and will be able to interact with it (but still /// in scope of the same GPUs). /// /// Parameter `sharedHandle`: Handle to shared texture in this process space. /// /// Returns: A new texture object. #[unsafe(method(newSharedTextureWithHandle:))] #[unsafe(method_family = new)] fn newSharedTextureWithHandle(
&self,
shared_handle: &MTLSharedTextureHandle,
) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[cfg(feature = "MTLLibrary")] /// Returns the default library for the main bundle. /// /// use newDefaultLibraryWithBundle:error: to get an NSError in case of failure. #[unsafe(method(newDefaultLibrary))] #[unsafe(method_family = new)] fn newDefaultLibrary(&self) -> Option<Retained<ProtocolObject<dynMTLLibrary>>>;
#[cfg(feature = "MTLLibrary")] /// Load a MTLLibrary from a metallib file. #[deprecated = "Use -newLibraryWithURL:error: instead"] #[unsafe(method(newLibraryWithFile:error:_))] #[unsafe(method_family = new)] fn newLibraryWithFile_error(
&self,
filepath: &NSString,
) -> Result<Retained<ProtocolObject<dyn MTLLibrary>>, Retained<NSError>>;
#[cfg(feature = "MTLLibrary")] /// Load a MTLLibrary from a metallib file. #[unsafe(method(newLibraryWithURL:error:_))] #[unsafe(method_family = new)] fn newLibraryWithURL_error(
&self,
url: &NSURL,
) -> Result<Retained<ProtocolObject<dyn MTLLibrary>>, Retained<NSError>>;
#[cfg(all(feature = "MTLLibrary", feature = "dispatch2"))] /// Load a MTLLibrary from a dispatch_data_t /// /// Parameter `data`: A metallib file already loaded as data in the form of dispatch_data_t. /// /// Parameter `error`: An error if we fail to open the metallib data. #[unsafe(method(newLibraryWithData:error:_))] #[unsafe(method_family = new)] fn newLibraryWithData_error(
&self,
data: &DispatchData,
) -> Result<Retained<ProtocolObject<dyn MTLLibrary>>, Retained<NSError>>;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLComputePipeline",
feature = "MTLLibrary",
feature = "block2"
))] /// Create and compile a new MTLComputePipelineState object asynchronously. /// /// # Safety /// /// `completion_handler` must be a valid pointer. #[unsafe(method(newComputePipelineStateWithDescriptor:options:completionHandler:))] #[unsafe(method_family = none)] unsafefn newComputePipelineStateWithDescriptor_options_completionHandler(
&self,
descriptor: &MTLComputePipelineDescriptor,
options: MTLPipelineOption,
completion_handler: MTLNewComputePipelineStateWithReflectionCompletionHandler,
);
#[cfg(feature = "MTLFence")] /// Create a new MTLFence object #[unsafe(method(newFence))] #[unsafe(method_family = new)] fn newFence(&self) -> Option<Retained<ProtocolObject<dyn MTLFence>>>;
/// Returns TRUE if the feature set is supported by this MTLDevice. #[deprecated = "Use supportsFamily instead"] #[unsafe(method(supportsFeatureSet:))] #[unsafe(method_family = none)] fn supportsFeatureSet(&self, feature_set: MTLFeatureSet) -> bool;
/// Returns TRUE if the GPU Family is supported by this MTLDevice. #[unsafe(method(supportsFamily:))] #[unsafe(method_family = none)] fn supportsFamily(&self, gpu_family: MTLGPUFamily) -> bool;
/// Query device if it support textures with a given sampleCount. /// /// Returns: BOOL value. If YES, device supports the given sampleCount for textures. If NO, device does not support the given sampleCount. #[unsafe(method(supportsTextureSampleCount:))] #[unsafe(method_family = none)] fn supportsTextureSampleCount(&self, sample_count: NSUInteger) -> bool;
#[cfg(feature = "MTLPixelFormat")] /// Returns the minimum alignment required for offset and rowBytes when creating a linear texture. An error is thrown for queries with invalid pixel formats (depth, stencil, or compressed formats). #[unsafe(method(minimumLinearTextureAlignmentForPixelFormat:))] #[unsafe(method_family = none)] fn minimumLinearTextureAlignmentForPixelFormat(&self, format: MTLPixelFormat)
-> NSUInteger;
#[cfg(feature = "MTLPixelFormat")] /// Returns the minimum alignment required for offset and rowBytes when creating a texture buffer from a buffer. #[unsafe(method(minimumTextureBufferAlignmentForPixelFormat:))] #[unsafe(method_family = none)] fn minimumTextureBufferAlignmentForPixelFormat(&self, format: MTLPixelFormat)
-> NSUInteger;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLLibrary",
feature = "MTLRenderPipeline"
))] /// Create and compile a new MTLRenderPipelineState object synchronously given a MTLTileRenderPipelineDescriptor. #[unsafe(method(newRenderPipelineStateWithTileDescriptor:options:reflection:error:_))] #[unsafe(method_family = new)] fn newRenderPipelineStateWithTileDescriptor_options_reflection_error(
&self,
descriptor: &MTLTileRenderPipelineDescriptor,
options: MTLPipelineOption,
reflection: Option<&mut Option<Retained<MTLAutoreleasedRenderPipelineReflection>>>,
) -> Result<Retained<ProtocolObject<dyn MTLRenderPipelineState>>, Retained<NSError>>;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLLibrary",
feature = "MTLRenderPipeline",
feature = "block2"
))] /// Create and compile a new MTLRenderPipelineState object asynchronously given a MTLTileRenderPipelineDescriptor. /// /// # Safety /// /// `completion_handler` must be a valid pointer. #[unsafe(method(newRenderPipelineStateWithTileDescriptor:options:completionHandler:))] #[unsafe(method_family = none)] unsafefn newRenderPipelineStateWithTileDescriptor_options_completionHandler(
&self,
descriptor: &MTLTileRenderPipelineDescriptor,
options: MTLPipelineOption,
completion_handler: MTLNewRenderPipelineStateWithReflectionCompletionHandler,
);
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLLibrary",
feature = "MTLRenderPipeline"
))] /// Create and compile a new MTLRenderPipelineState object synchronously given a MTLMeshRenderPipelineDescriptor. #[unsafe(method(newRenderPipelineStateWithMeshDescriptor:options:reflection:error:_))] #[unsafe(method_family = new)] fn newRenderPipelineStateWithMeshDescriptor_options_reflection_error(
&self,
descriptor: &MTLMeshRenderPipelineDescriptor,
options: MTLPipelineOption,
reflection: Option<&mut Option<Retained<MTLAutoreleasedRenderPipelineReflection>>>,
) -> Result<Retained<ProtocolObject<dyn MTLRenderPipelineState>>, Retained<NSError>>;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLLibrary",
feature = "MTLRenderPipeline",
feature = "block2"
))] /// Create and compile a new MTLRenderPipelineState object asynchronously given a MTLMeshRenderPipelineDescriptor. /// /// # Safety /// /// `completion_handler` must be a valid pointer. #[unsafe(method(newRenderPipelineStateWithMeshDescriptor:options:completionHandler:))] #[unsafe(method_family = none)] unsafefn newRenderPipelineStateWithMeshDescriptor_options_completionHandler(
&self,
descriptor: &MTLMeshRenderPipelineDescriptor,
options: MTLPipelineOption,
completion_handler: MTLNewRenderPipelineStateWithReflectionCompletionHandler,
);
/// The maximum threadgroup memory available, in bytes. #[unsafe(method(maxThreadgroupMemoryLength))] #[unsafe(method_family = none)] fn maxThreadgroupMemoryLength(&self) -> NSUInteger;
/// The maximum number of unique argument buffer samplers per app. /// /// This limit is only applicable to samplers that have their supportArgumentBuffers property set to true. A MTLSamplerState object is considered unique if the configuration of its originating MTLSamplerDescriptor properties is unique. For example, two samplers with equal minFilter values but different magFilter values are considered unique. #[unsafe(method(maxArgumentBufferSamplerCount))] #[unsafe(method_family = none)] fn maxArgumentBufferSamplerCount(&self) -> NSUInteger;
/// Query device for programmable sample position support. /// /// Returns: BOOL value. If YES, the device supports programmable sample positions. If NO, the device does not. #[unsafe(method(areProgrammableSamplePositionsSupported))] #[unsafe(method_family = none)] fn areProgrammableSamplePositionsSupported(&self) -> bool;
#[cfg(feature = "MTLTypes")] /// Retrieve the default sample positions. /// /// Parameter `positions`: The destination array for default sample position data. /// /// Parameter `count`: Specifies the sample count for which to retrieve the default positions, the length of the positions array, and must be set to a valid sample count. /// /// # Safety /// /// - `positions` must be a valid pointer. /// - `count` might not be bounds-checked. #[unsafe(method(getDefaultSamplePositions:count:))] #[unsafe(method_family = none)] unsafefn getDefaultSamplePositions_count(
&self,
positions: NonNull<MTLSamplePosition>,
count: NSUInteger,
);
#[cfg(feature = "MTLArgumentEncoder")] /// Creates an argument encoder for an array of argument descriptors which will be encoded sequentially. #[unsafe(method(newArgumentEncoderWithArguments:))] #[unsafe(method_family = new)] fn newArgumentEncoderWithArguments(
&self,
arguments: &NSArray<MTLArgumentDescriptor>,
) -> Option<Retained<ProtocolObject<dyn MTLArgumentEncoder>>>;
/// Query device for variable rasterization rate support with the given number of layers. /// /// Parameter `layerCount`: The number of layers for which to query device support. /// /// Returns: YES if the device supports creation of rendering using a MTLRasterizationRateMap with the given number of layers. /// /// # Safety /// /// `layerCount` might not be bounds-checked. #[unsafe(method(supportsRasterizationRateMapWithLayerCount:))] #[unsafe(method_family = none)] unsafefn supportsRasterizationRateMapWithLayerCount(
&self,
layer_count: NSUInteger,
) -> bool;
#[cfg(feature = "MTLRasterizationRate")] /// Creates a new variable rasterization rate map with the given descriptor. /// /// If '[self supportsRasterizationRateMapWithLayerCount:descriptor.layerCount]' returns NO, or descriptor.screenSize describes an empty region, the result will always be nil. /// /// Returns: A MTLRasterizationRateMap instance that can be used for rendering on this MTLDevice, or nil if the device does not support the combination of parameters stored in the descriptor. #[unsafe(method(newRasterizationRateMapWithDescriptor:))] #[unsafe(method_family = new)] fn newRasterizationRateMapWithDescriptor(
&self,
descriptor: &MTLRasterizationRateMapDescriptor,
) -> Option<Retained<ProtocolObject<dyn MTLRasterizationRateMap>>>;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLIndirectCommandBuffer",
feature = "MTLResource"
))] /// Creates a new indirect command buffer with the given descriptor and count. /// /// Parameter `descriptor`: The descriptor encodes the maximum logical stride of each command. /// /// Parameter `maxCount`: The maximum number of commands that this buffer can contain. /// /// Parameter `options`: The options for the indirect command buffer. /// /// The returned buffer can be safely executed without first encoding into (but is wasteful). /// /// # Safety /// /// `maxCount` might not be bounds-checked. #[unsafe(method(newIndirectCommandBufferWithDescriptor:maxCommandCount:options:))] #[unsafe(method_family = new)] unsafefn newIndirectCommandBufferWithDescriptor_maxCommandCount_options(
&self,
descriptor: &MTLIndirectCommandBufferDescriptor,
max_count: NSUInteger,
options: MTLResourceOptions,
) -> Option<Retained<ProtocolObject<dyn MTLIndirectCommandBuffer>>>;
#[cfg(feature = "MTLEvent")] /// Returns a new single-device non-shareable Metal event object #[unsafe(method(newEvent))] #[unsafe(method_family = new)] fn newEvent(&self) -> Option<Retained<ProtocolObject<dyn MTLEvent>>>;
#[cfg(feature = "MTLEvent")] /// Creates a shareable multi-device event from an existing shared event handle. #[unsafe(method(newSharedEventWithHandle:))] #[unsafe(method_family = new)] fn newSharedEventWithHandle(
&self,
shared_event_handle: &MTLSharedEventHandle,
) -> Option<Retained<ProtocolObject<dyn MTLSharedEvent>>>;
/// If a device supports peer to peer transfers with another device (or devices), this property will return /// a unique 64-bit identifier associated with all devices in the same peer group. #[unsafe(method(peerGroupID))] #[unsafe(method_family = none)] fn peerGroupID(&self) -> u64;
/// All Metal devices that are part of the same peer group will have a unique index value within the group in /// the range from 0 to peerCount - 1. #[unsafe(method(peerIndex))] #[unsafe(method_family = none)] fn peerIndex(&self) -> u32;
/// For Metal devices that are part of a peer group, this property returns the total number of devices in that group. #[unsafe(method(peerCount))] #[unsafe(method_family = none)] fn peerCount(&self) -> u32;
#[cfg(feature = "MTLIOCommandQueue")] /// Create and return a handle that points to a raw file on disk. This object can be used by /// MTLIOCommandBuffer load commands to source data for MTLResources. If the creation /// of the handle fails the return value will be nil and the optional error if passed in will be non-nil /// with details of the error. #[deprecated] #[unsafe(method(newIOHandleWithURL:error:_))] #[unsafe(method_family = new)] fn newIOHandleWithURL_error(
&self,
url: &NSURL,
) -> Result<Retained<ProtocolObject<dyn MTLIOFileHandle>>, Retained<NSError>>;
#[cfg(feature = "MTLIOCommandQueue")] /// Create and return an IO queue. If the creation /// of the queue fails the return value will be nil and the optional error if passed in will be non-nil /// with details of the error. #[unsafe(method(newIOCommandQueueWithDescriptor:error:_))] #[unsafe(method_family = new)] fn newIOCommandQueueWithDescriptor_error(
&self,
descriptor: &MTLIOCommandQueueDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLIOCommandQueue>>, Retained<NSError>>;
#[cfg(feature = "MTLIOCommandQueue")] /// Create and return a handle that points to a compressed file on disk (a file that was /// created with MTLIOCompressionContext). This object can be used by /// MTLIOCommandBuffer load commands to source data for MTLResources. If the creation /// of the handle fails the return value will be nil and the optional error if passed in will be non-nil /// with details of the error. #[deprecated] #[unsafe(method(newIOHandleWithURL:compressionMethod:error:_))] #[unsafe(method_family = new)] fn newIOHandleWithURL_compressionMethod_error(
&self,
url: &NSURL,
compression_method: MTLIOCompressionMethod,
) -> Result<Retained<ProtocolObject<dyn MTLIOFileHandle>>, Retained<NSError>>;
#[cfg(feature = "MTLIOCommandQueue")] /// Create and return a handle that points to a raw file on disk. This object can be used by /// MTLIOCommandBuffer load commands to source data for MTLResources. If the creation /// of the handle fails the return value will be nil and the optional error if passed in will be non-nil /// with details of the error. #[unsafe(method(newIOFileHandleWithURL:error:_))] #[unsafe(method_family = new)] fn newIOFileHandleWithURL_error(
&self,
url: &NSURL,
) -> Result<Retained<ProtocolObject<dyn MTLIOFileHandle>>, Retained<NSError>>;
#[cfg(feature = "MTLIOCommandQueue")] /// Create and return a handle that points to a compressed file on disk (a file that was /// created with MTLIOCompressionContext). This object can be used by /// MTLIOCommandBuffer load commands to source data for MTLResources. If the creation /// of the handle fails the return value will be nil and the optional error if passed in will be non-nil /// with details of the error. #[unsafe(method(newIOFileHandleWithURL:compressionMethod:error:_))] #[unsafe(method_family = new)] fn newIOFileHandleWithURL_compressionMethod_error(
&self,
url: &NSURL,
compression_method: MTLIOCompressionMethod,
) -> Result<Retained<ProtocolObject<dyn MTLIOFileHandle>>, Retained<NSError>>;
#[cfg(all(
feature = "MTLPixelFormat",
feature = "MTLTexture",
feature = "MTLTypes"
))] /// Returns tile size for sparse texture with given type, pixel format and sample count. /// /// # Safety /// /// `sampleCount` might not be bounds-checked. #[unsafe(method(sparseTileSizeWithTextureType:pixelFormat:sampleCount:))] #[unsafe(method_family = none)] unsafefn sparseTileSizeWithTextureType_pixelFormat_sampleCount(
&self,
texture_type: MTLTextureType,
pixel_format: MTLPixelFormat,
sample_count: NSUInteger,
) -> MTLSize;
/// Returns the number of bytes required to map one sparse texture tile. #[unsafe(method(sparseTileSizeInBytes))] #[unsafe(method_family = none)] fn sparseTileSizeInBytes(&self) -> NSUInteger;
#[cfg(feature = "MTLTypes")] /// Converts regions in pixels to regions in sparse tiles using specified alignment mode. /// Tile size can be obtained from tileSizeWithTextureType:pixelFormat:sampleCount: method. /// /// # Safety /// /// - `pixel_regions` must be a valid pointer. /// - `tile_regions` must be a valid pointer. /// - `tileSize` might not be bounds-checked. #[optional] #[unsafe(method(convertSparsePixelRegions:toTileRegions:withTileSize:alignmentMode:numRegions:))] #[unsafe(method_family = none)] unsafefn convertSparsePixelRegions_toTileRegions_withTileSize_alignmentMode_numRegions(
&self,
pixel_regions: NonNull<MTLRegion>,
tile_regions: NonNull<MTLRegion>,
tile_size: MTLSize,
mode: MTLSparseTextureRegionAlignmentMode,
num_regions: NSUInteger,
);
#[cfg(feature = "MTLTypes")] /// Convertes region in sparse tiles to region in pixels /// Tile size can be obtained from tileSizeWithTextureType:pixelFormat:sampleCount: method. /// /// # Safety /// /// - `tile_regions` must be a valid pointer. /// - `pixel_regions` must be a valid pointer. /// - `tileSize` might not be bounds-checked. #[optional] #[unsafe(method(convertSparseTileRegions:toPixelRegions:withTileSize:numRegions:))] #[unsafe(method_family = none)] unsafefn convertSparseTileRegions_toPixelRegions_withTileSize_numRegions(
&self,
tile_regions: NonNull<MTLRegion>,
pixel_regions: NonNull<MTLRegion>,
tile_size: MTLSize,
num_regions: NSUInteger,
);
#[cfg(feature = "MTLResource")] /// Returns the number of bytes required to map one sparse texture tile for a given MTLSparsePageSize #[unsafe(method(sparseTileSizeInBytesForSparsePageSize:))] #[unsafe(method_family = none)] fn sparseTileSizeInBytesForSparsePageSize(
&self,
sparse_page_size: MTLSparsePageSize,
) -> NSUInteger;
#[cfg(all(
feature = "MTLPixelFormat",
feature = "MTLResource",
feature = "MTLTexture",
feature = "MTLTypes"
))] /// Returns tile size for sparse texture with given type, pixel format and sample count. /// /// # Safety /// /// `sampleCount` might not be bounds-checked. #[unsafe(method(sparseTileSizeWithTextureType:pixelFormat:sampleCount:sparsePageSize:))] #[unsafe(method_family = none)] unsafefn sparseTileSizeWithTextureType_pixelFormat_sampleCount_sparsePageSize(
&self,
texture_type: MTLTextureType,
pixel_format: MTLPixelFormat,
sample_count: NSUInteger,
sparse_page_size: MTLSparsePageSize,
) -> MTLSize;
#[cfg(feature = "MTLCounters")] /// Returns the set of Counter Sets exposed by the device. #[unsafe(method(counterSets))] #[unsafe(method_family = none)] fn counterSets(&self) -> Option<Retained<NSArray<ProtocolObject<dyn MTLCounterSet>>>>;
#[cfg(feature = "MTLCounters")] /// Given a counter sample buffer descriptor, allocate a new counter /// sample buffer. /// This may return nil if the counters may not all be collected simultaneously. /// /// Parameter `descriptor`: The descriptor to create a sample buffer for /// /// Parameter `error`: An error return on failure. #[unsafe(method(newCounterSampleBufferWithDescriptor:error:_))] #[unsafe(method_family = new)] fn newCounterSampleBufferWithDescriptor_error(
&self,
descriptor: &MTLCounterSampleBufferDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLCounterSampleBuffer>>, Retained<NSError>>;
/// Sample the CPU and GPU timestamps as closely as possible. /// /// Parameter `cpuTimestamp`: The timestamp on the CPU /// /// Parameter `gpuTimestamp`: The timestamp on the GPU /// /// # Safety /// /// - `cpu_timestamp` must be a valid pointer. /// - `gpu_timestamp` must be a valid pointer. #[unsafe(method(sampleTimestamps:gpuTimestamp:))] #[unsafe(method_family = none)] unsafefn sampleTimestamps_gpuTimestamp(
&self,
cpu_timestamp: NonNull<MTLTimestamp>,
gpu_timestamp: NonNull<MTLTimestamp>,
);
/// Query device for counter sampling points support. /// /// Parameter `samplingPoint`: Query index /// /// Returns: BOOL value. If YES, the device supports counter sampling at given point. #[unsafe(method(supportsCounterSampling:))] #[unsafe(method_family = none)] fn supportsCounterSampling(&self, sampling_point: MTLCounterSamplingPoint) -> bool;
/// Query device for vertex amplification support. /// /// Parameter `count`: The amplification count to check /// /// Returns: BOOL value. If YES, the device supports vertex amplification with the given count. If NO, the device does not. #[unsafe(method(supportsVertexAmplificationCount:))] #[unsafe(method_family = none)] fn supportsVertexAmplificationCount(&self, count: NSUInteger) -> bool;
/// Query device support for creating and using dynamic libraries in a compute pipeline. /// /// Returns: BOOL value. If YES, the device supports creating and using dynamic libraries in a compute pipeline. If NO, the device does not. #[unsafe(method(supportsDynamicLibraries))] #[unsafe(method_family = none)] fn supportsDynamicLibraries(&self) -> bool;
/// Query device support for creating and using dynamic libraries in render pipeline stages. /// /// Returns: BOOL value. If YES, the device supports creating and using dynamic libraries in render pipeline stages. If NO, the device does not. #[unsafe(method(supportsRenderDynamicLibraries))] #[unsafe(method_family = none)] fn supportsRenderDynamicLibraries(&self) -> bool;
#[cfg(all(feature = "MTLDynamicLibrary", feature = "MTLLibrary"))] /// Creates a MTLDynamicLibrary by compiling the code in a MTLLibrary. /// /// See: MTLDynamicLibrary /// /// Parameter `library`: The MTLLibrary from which to compile code. This library must have .type set to MTLLibraryTypeDynamic. /// /// Parameter `error`: If an error occurs during creation, this parameter is updated to describe the failure. /// /// Returns: On success, the MTLDynamicLibrary containing compiled code. On failure, nil. #[unsafe(method(newDynamicLibrary:error:_))] #[unsafe(method_family = new)] fn newDynamicLibrary_error(
&self,
library: &ProtocolObject<dyn MTLLibrary>,
) -> Result<Retained<ProtocolObject<dyn MTLDynamicLibrary>>, Retained<NSError>>;
#[cfg(feature = "MTLDynamicLibrary")] /// Creates a MTLDynamicLibrary by loading compiled code from a file. /// /// See: MTLDynamicLibrary /// /// Parameter `url`: The file URL from which to load. If the file contains no compiled code for this device, compilation is attempted as with newDynamicLibrary:error: /// /// Parameter `error`: If an error occurs during creation, this parameter is updated to describe the failure. /// /// Returns: On success, the MTLDynamicLibrary containing compiled code (either loaded or compiled). On failure, nil. #[unsafe(method(newDynamicLibraryWithURL:error:_))] #[unsafe(method_family = new)] fn newDynamicLibraryWithURL_error(
&self,
url: &NSURL,
) -> Result<Retained<ProtocolObject<dyn MTLDynamicLibrary>>, Retained<NSError>>;
#[cfg(feature = "MTLBinaryArchive")] /// Creates a MTLBinaryArchive using the configuration in the descriptor. /// /// See: MTLBinaryArchive /// /// Parameter `descriptor`: The descriptor for the configuration of the binary archive to create. /// /// Parameter `error`: If an error occurs during creation, this parameter is updated to describe the failure. /// /// Returns: On success, the created MTLBinaryArchive. On failure, nil. #[unsafe(method(newBinaryArchiveWithDescriptor:error:_))] #[unsafe(method_family = new)] fn newBinaryArchiveWithDescriptor_error(
&self,
descriptor: &MTLBinaryArchiveDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLBinaryArchive>>, Retained<NSError>>;
/// Query device support for using ray tracing from compute pipelines. /// /// Returns: BOOL value. If YES, the device supports ray tracing from compute pipelines. If NO, the device does not. #[unsafe(method(supportsRaytracing))] #[unsafe(method_family = none)] fn supportsRaytracing(&self) -> bool;
/// Determine the byte size of acceleration structures when sub-allocated from a heap. /// /// This method can be used to help determine the required heap size. /// /// # Safety /// /// `size` might not be bounds-checked. #[unsafe(method(heapAccelerationStructureSizeAndAlignWithSize:))] #[unsafe(method_family = none)] unsafefn heapAccelerationStructureSizeAndAlignWithSize(
&self,
size: NSUInteger,
) -> MTLSizeAndAlign;
#[cfg(feature = "MTLAccelerationStructure")] /// Determine the byte size of acceleration structures when sub-allocated from a heap. This is a convenience method which computes the acceleration structure size based on the descriptor. /// /// This method can be used to help determine the required heap size. #[unsafe(method(heapAccelerationStructureSizeAndAlignWithDescriptor:))] #[unsafe(method_family = none)] fn heapAccelerationStructureSizeAndAlignWithDescriptor(
&self,
descriptor: &MTLAccelerationStructureDescriptor,
) -> MTLSizeAndAlign;
/// Query device support for using function pointers from compute pipelines. /// /// Returns: BOOL value. If YES, the device supports function pointers from compute pipelines. If NO, the device does not. #[unsafe(method(supportsFunctionPointers))] #[unsafe(method_family = none)] fn supportsFunctionPointers(&self) -> bool;
/// Query device support for using function pointers from render pipeline stages. /// /// Returns: BOOL value. If YES, the device supports function pointers from render pipeline stages. If NO, the device does not. #[unsafe(method(supportsFunctionPointersFromRender))] #[unsafe(method_family = none)] fn supportsFunctionPointersFromRender(&self) -> bool;
/// Query device support for using ray tracing from render pipeline stages. /// /// Returns: BOOL value. If YES, the device supports ray tracing from render pipeline stages. If NO, the device does not. #[unsafe(method(supportsRaytracingFromRender))] #[unsafe(method_family = none)] fn supportsRaytracingFromRender(&self) -> bool;
/// Query device support for using ray tracing primitive motion blur. /// /// Returns: BOOL value. If YES, the device supports the primitive motion blur api. If NO, the device does not. #[unsafe(method(supportsPrimitiveMotionBlur))] #[unsafe(method_family = none)] fn supportsPrimitiveMotionBlur(&self) -> bool;
/// Allow this device to use additional CPU threads (scaled automatically to the host machine) to be used for compilation tasks. Default is `NO`. /// /// Use the `maximumConcurrentCompilationTaskCount` property to determine the current number of concurrent CPU threads that this device is using. #[unsafe(method(shouldMaximizeConcurrentCompilation))] #[unsafe(method_family = none)] fn shouldMaximizeConcurrentCompilation(&self) -> bool;
/// Returns the maximum count of concurrent executing compilation tasks. /// /// The property returns a different value depending on the value of the property `shouldMaximizeConcurrentCompilation`. #[unsafe(method(maximumConcurrentCompilationTaskCount))] #[unsafe(method_family = none)] fn maximumConcurrentCompilationTaskCount(&self) -> NSUInteger;
#[cfg(feature = "MTLResidencySet")] /// Creates a new residency set with a descriptor. #[unsafe(method(newResidencySetWithDescriptor:error:_))] #[unsafe(method_family = new)] fn newResidencySetWithDescriptor_error(
&self,
desc: &MTLResidencySetDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLResidencySet>>, Retained<NSError>>;
#[cfg(feature = "MTLTensor")] /// Determines the size and alignment required to hold the data of a tensor you create with a descriptor in a buffer. /// /// - Parameters: /// - descriptor: A description of the properties for the new tensor. /// - Returns: The size and alignment required to hold the data of a tensor you create with `descriptor` in a buffer. #[unsafe(method(tensorSizeAndAlignWithDescriptor:))] #[unsafe(method_family = none)] fn tensorSizeAndAlignWithDescriptor(
&self,
descriptor: &MTLTensorDescriptor,
) -> MTLSizeAndAlign;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLResource",
feature = "MTLTensor"
))] /// Creates a tensor by allocating new memory. /// /// - Parameters: /// - descriptor: A description of the properties for the new tensor. /// - error: Metal populates this parameter with information in case an error occurs. /// - Returns: A new tensor instance that Metal configures using `descriptor` or `nil` if an error occurred. #[unsafe(method(newTensorWithDescriptor:error:_))] #[unsafe(method_family = new)] fn newTensorWithDescriptor_error(
&self,
descriptor: &MTLTensorDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLTensor>>, Retained<NSError>>;
#[cfg(all(feature = "MTLFunctionHandle", feature = "MTLLibrary"))] /// Returns the function handle for a function that was compiled with MTLFunctionOptionPipelineIndependent and MTLFunctionOptionCompileToBinary. /// /// # Safety /// /// - `function` must be safe to call. /// - `function` must have the correct argument and return types. #[unsafe(method(functionHandleWithFunction:))] #[unsafe(method_family = none)] unsafefn functionHandleWithFunction(
&self,
function: &ProtocolObject<dyn MTLFunction>,
) -> Option<Retained<ProtocolObject<dyn MTLFunctionHandle>>>;
#[cfg(feature = "MTL4CommandAllocator")] /// Creates a new command allocator. /// /// - Returns: A ``MTL4CommandAllocator`` instance, or `nil` if the function failed. #[unsafe(method(newCommandAllocator))] #[unsafe(method_family = new)] fn newCommandAllocator(&self)
-> Option<Retained<ProtocolObject<dyn MTL4CommandAllocator>>>;
#[cfg(feature = "MTL4CommandAllocator")] /// Creates a new command allocator from a command allocator descriptor. /// /// - Parameters: /// - descriptor: A ``MTL4CommandAllocatorDescriptor`` instance that configures the /// ``MTL4CommandAllocator`` instance. /// - error: Optional pointer to a `NSError` instance that Metal uses to describe the failure /// if this function fails. /// /// - Returns: A ``MTL4CommandAllocator`` instance, or `nil` if the function failed. #[unsafe(method(newCommandAllocatorWithDescriptor:error:_))] #[unsafe(method_family = new)] fn newCommandAllocatorWithDescriptor_error(
&self,
descriptor: &MTL4CommandAllocatorDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTL4CommandAllocator>>, Retained<NSError>>;
#[cfg(feature = "MTL4CommandQueue")] /// Creates a new command queue. /// /// - Returns: A ``MTL4CommandQueue`` instance, or `nil` if the function failed. #[unsafe(method(newMTL4CommandQueue))] #[unsafe(method_family = new)] fn newMTL4CommandQueue(&self) -> Option<Retained<ProtocolObject<dyn MTL4CommandQueue>>>;
#[cfg(feature = "MTL4CommandQueue")] /// Creates a new command queue from a queue descriptor. /// /// - Parameters: /// - descriptor: A ``MTL4CommandQueueDescriptor`` instance that configures the /// ``MTL4CommandQueue`` instance. /// - error: Optional pointer to a `NSError` instance that Metal uses to describe the failure /// if this function fails. /// /// - Returns: A ``MTL4CommandQueue`` instance, or `nil` if the function failed. #[unsafe(method(newMTL4CommandQueueWithDescriptor:error:_))] #[unsafe(method_family = new)] fn newMTL4CommandQueueWithDescriptor_error(
&self,
descriptor: &MTL4CommandQueueDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTL4CommandQueue>>, Retained<NSError>>;
#[cfg(feature = "MTL4CommandBuffer")] /// Creates a new command buffer. /// /// - Returns: A ``MTL4CommandBuffer`` instance, or `nil` if the function failed. #[unsafe(method(newCommandBuffer))] #[unsafe(method_family = new)] fn newCommandBuffer(&self) -> Option<Retained<ProtocolObject<dyn MTL4CommandBuffer>>>;
#[cfg(feature = "MTL4ArgumentTable")] /// Creates a new argument table from an argument table descriptor. /// /// - Parameters: /// - descriptor: A ``MTL4ArgumentTableDescriptor`` instance that configures the /// ``MTL4ArgumentTable`` instance. /// - error: Optional pointer to a `NSError` instance that Metal uses to describe the failure /// if this function fails. /// /// - Returns: A ``MTL4ArgumentTable`` instance, or `nil` if the function failed. #[unsafe(method(newArgumentTableWithDescriptor:error:_))] #[unsafe(method_family = new)] fn newArgumentTableWithDescriptor_error(
&self,
descriptor: &MTL4ArgumentTableDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTL4ArgumentTable>>, Retained<NSError>>;
#[cfg(all(feature = "MTLResourceViewPool", feature = "MTLTextureViewPool"))] /// Creates a new texture view pool from a resource view pool descriptor. /// /// - Parameters: /// - descriptor: A ``MTLResourceViewPoolDescriptor`` instance that configures the /// ``MTLTextureViewPool`` instance. /// - error: Optional pointer to a `NSError` instance that Metal uses to describe the failure /// if this function fails. /// /// - Returns: A ``MTLTextureViewPool`` instance, or `nil` if the function failed. #[unsafe(method(newTextureViewPoolWithDescriptor:error:_))] #[unsafe(method_family = new)] fn newTextureViewPoolWithDescriptor_error(
&self,
descriptor: &MTLResourceViewPoolDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLTextureViewPool>>, Retained<NSError>>;
#[cfg(feature = "MTL4Compiler")] /// Creates a new compiler from a compiler descriptor. /// /// - Parameters: /// - descriptor: A ``MTL4CompilerDescriptor`` instance that configures the /// ``MTL4Compiler`` instance. /// - error: Optional pointer to a `NSError` instance that Metal uses to describe the failure /// if this function fails. /// /// - Returns: A ``MTL4Compiler`` instance, or `nil` if the function failed. #[unsafe(method(newCompilerWithDescriptor:error:_))] #[unsafe(method_family = new)] fn newCompilerWithDescriptor_error(
&self,
descriptor: &MTL4CompilerDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTL4Compiler>>, Retained<NSError>>;
#[cfg(feature = "MTL4Archive")] /// Creates a new archive from data available at an `NSURL` address. /// /// - Parameters: /// - url: An `NSURL` instance that represents the path from which the device loads the ``MTL4Archive``. /// - error: Optional pointer to a `NSError` instance that Metal uses to describe the failure /// if this function fails. /// /// - Returns: A ``MTL4Archive`` instance, or `nil` if the function failed. #[unsafe(method(newArchiveWithURL:error:_))] #[unsafe(method_family = new)] fn newArchiveWithURL_error(
&self,
url: &NSURL,
) -> Result<Retained<ProtocolObject<dyn MTL4Archive>>, Retained<NSError>>;
#[cfg(feature = "MTL4PipelineDataSetSerializer")] /// Creates a new pipeline data set serializer instance from a descriptor. /// /// - Parameter descriptor: A ``MTL4PipelineDataSetSerializerDescriptor`` instance that configures /// the new ``MTL4PipelineDataSetSerializer`` instance. /// /// - Returns: A ``MTL4PipelineDataSetSerializer`` instance, or `nil` if the function failed. #[unsafe(method(newPipelineDataSetSerializerWithDescriptor:))] #[unsafe(method_family = new)] fn newPipelineDataSetSerializerWithDescriptor(
&self,
descriptor: &MTL4PipelineDataSetSerializerDescriptor,
) -> Retained<ProtocolObject<dyn MTL4PipelineDataSetSerializer>>;
#[cfg(all(
feature = "MTLAllocation",
feature = "MTLBuffer",
feature = "MTLResource"
))] /// Creates a new placement sparse buffer of a specific length. /// /// This method creates a new placement sparse ``MTLBuffer`` of a specific length. You assign memory to /// placement sparse buffers using a ``MTLHeap`` of type ``MTLHeapType/MTLHeapTypePlacement``. /// /// - Parameters: /// - length: The size of the ``MTLBuffer``, in bytes. /// - options: A ``MTLResourceOptions`` instance that establishes the buffer’s storage modes. /// - placementSparsePageSize: ``MTLSparsePageSize`` to use for the placement sparse buffer. /// /// - Returns: A ``MTLBuffer`` instance, or `nil` if the function failed. /// /// # Safety /// /// This might not be bounds-checked. #[unsafe(method(newBufferWithLength:options:placementSparsePageSize:))] #[unsafe(method_family = new)] unsafefn newBufferWithLength_options_placementSparsePageSize(
&self,
length: NSUInteger,
options: MTLResourceOptions,
placement_sparse_page_size: MTLSparsePageSize,
) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;
#[cfg(feature = "MTL4Counters")] /// Creates a new counter heap configured from a counter heap descriptor. /// /// - Parameters: /// - descriptor: ``MTL4CounterHeapDescriptor`` instance that configures the ``MTL4CounterHeap`` instance. /// - error: Optional pointer to a `NSError` instance that Metal uses to describe the failure /// if this function fails. /// /// - Returns: A ``MTL4CounterHeap`` instance, or `nil` if the function failed. #[unsafe(method(newCounterHeapWithDescriptor:error:_))] #[unsafe(method_family = new)] fn newCounterHeapWithDescriptor_error(
&self,
descriptor: &MTL4CounterHeapDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTL4CounterHeap>>, Retained<NSError>>;
#[cfg(feature = "MTL4Counters")] /// Returns the size, in bytes, of each entry in a counter heap of a specific counter heap type when /// your app resolves it into a usable format. /// /// In order to use the data available in a ``MTL4CounterHeap``, your app first resolves it either in the CPU timeline /// or in the GPU timeline. When your app calls ``MTL4CommandBuffer/resolveCounterHeap:withRange:intoBuffer:waitFence:updateFence:`` /// to resolve counter data in the GPU timeline, Metal writes the data into a ``MTLBuffer``. /// /// During this process, Metal transform the data in the heap into a format consisting of entries of the size /// that this method advertises, based on the ``MTL4CounterHeapType``. /// /// - Parameters: /// - type: ``MTL4CounterHeapType`` value that represents the type of the ``MTL4CounterHeap`` to resolve. /// /// - Returns: The size of the post-transformation entry from a ``MTL4CounterHeap`` of type ``MTL4CounterHeapType``. #[unsafe(method(sizeOfCounterHeapEntry:))] #[unsafe(method_family = none)] fn sizeOfCounterHeapEntry(&self, r#type: MTL4CounterHeapType) -> NSUInteger;
/// Queries the frequency of the GPU timestamp in ticks per second. /// /// - Returns: The frequency of the GPU timestamp in ticks per second. #[unsafe(method(queryTimestampFrequency))] #[unsafe(method_family = none)] fn queryTimestampFrequency(&self) -> u64;
#[cfg(all(feature = "MTL4BinaryFunction", feature = "MTLFunctionHandle"))] /// Get the function handle for the specified binary-linked function from the pipeline state. /// /// - Parameters: /// - function: A ``MTL4BinaryFunction`` instance representing the function binary. /// /// - Returns: A ``MTLFunctionHandle`` instance for a binary function that was compiled with ``MTLFunctionOptionPipelineIndependent``, otherwise `nil`. #[unsafe(method(functionHandleWithBinaryFunction:))] #[unsafe(method_family = none)] fn functionHandleWithBinaryFunction(
&self,
function: &ProtocolObject<dyn MTL4BinaryFunction>,
) -> Option<Retained<ProtocolObject<dyn MTLFunctionHandle>>>;
}
);
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.43Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.