#![allow(unused_imports)]
#![allow(deprecated)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#![allow(missing_docs)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::type_complexity)]
#![allow(clippy::upper_case_acronyms)]
#![allow(clippy::identity_op)]
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::doc_lazy_continuation)]
#![allow(rustdoc::broken_intra_doc_links)]
#![allow(rustdoc::bare_urls)]
#![allow(rustdoc::invalid_html_tags)]
#[link(name = "MetalPerformanceShaders", kind = "framework")]
extern "C" {}
#[cfg(feature = "MPSCore")]
#[path = "MPSCore/mod.rs"]
mod __MPSCore;
#[cfg(feature = "MPSImage")]
#[path = "MPSImage/mod.rs"]
mod __MPSImage;
#[cfg(feature = "MPSMatrix")]
#[path = "MPSMatrix/mod.rs"]
mod __MPSMatrix;
#[cfg(feature = "MPSNDArray")]
#[path = "MPSNDArray/mod.rs"]
mod __MPSNDArray;
#[cfg(feature = "MPSNeuralNetwork")]
#[path = "MPSNeuralNetwork/mod.rs"]
mod __MPSNeuralNetwork;
#[cfg(feature = "MPSRayIntersector")]
#[path = "MPSRayIntersector/mod.rs"]
mod __MPSRayIntersector;
#[cfg(feature = "MPSCore")]
pub use self::__MPSCore::*;
#[cfg(feature = "MPSImage")]
pub use self::__MPSImage::*;
#[cfg(feature = "MPSMatrix")]
pub use self::__MPSMatrix::*;
#[cfg(feature = "MPSNDArray")]
pub use self::__MPSNDArray::*;
#[cfg(feature = "MPSNeuralNetwork")]
pub use self::__MPSNeuralNetwork::*;
#[cfg(feature = "MPSRayIntersector")]
pub use self::__MPSRayIntersector::*;
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_metal::*;
use crate::*;
#[inline]
pub unsafe extern "C-unwind" fn MPSSupportsMTLDevice(
device: Option<&ProtocolObject<dyn MTLDevice>>,
) -> bool {
extern "C-unwind" {
fn MPSSupportsMTLDevice(device: Option<&ProtocolObject<dyn MTLDevice>>) -> Bool;
}
unsafe { MPSSupportsMTLDevice(device) }.as_bool()
}
extern "C-unwind" {
pub fn MPSHintTemporaryMemoryHighWaterMark(
cmd_buf: &ProtocolObject<dyn MTLCommandBuffer>,
bytes: NSUInteger,
);
}
extern "C-unwind" {
pub fn MPSSetHeapCacheDuration(
cmd_buf: &ProtocolObject<dyn MTLCommandBuffer>,
seconds: c_double,
);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MPSDeviceOptions(pub NSUInteger);
bitflags::bitflags! {
impl MPSDeviceOptions: NSUInteger {
#[doc(alias = "MPSDeviceOptionsDefault")]
const Default = 0;
#[doc(alias = "MPSDeviceOptionsLowPower")]
const LowPower = 1;
#[doc(alias = "MPSDeviceOptionsSkipRemovable")]
const SkipRemovable = 2;
}
}
unsafe impl Encode for MPSDeviceOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MPSDeviceOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[inline]
pub unsafe extern "C-unwind" fn MPSGetPreferredDevice(
options: MPSDeviceOptions,
) -> Option<Retained<ProtocolObject<dyn MTLDevice>>> {
extern "C-unwind" {
fn MPSGetPreferredDevice(options: MPSDeviceOptions) -> *mut ProtocolObject<dyn MTLDevice>;
}
let ret = unsafe { MPSGetPreferredDevice(options) };
unsafe { Retained::retain_autoreleased(ret) }
}