use objc2::{
extern_class, extern_conformance, extern_methods,
rc::{Allocated, Retained},
runtime::{NSObject, ProtocolObject},
};
use objc2_foundation::{CopyingHelper, NSCopying, NSObjectProtocol};
use super::{MTLLoadAction, MTLStoreAction, MTLStoreActionOptions};
use crate::MTLTexture;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRenderPassAttachmentDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MTLRenderPassAttachmentDescriptor {}
);
unsafe impl CopyingHelper for MTLRenderPassAttachmentDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLRenderPassAttachmentDescriptor {}
);
impl MTLRenderPassAttachmentDescriptor {
extern_methods!(
#[unsafe(method(texture))]
#[unsafe(method_family = none)]
pub fn texture(&self) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[unsafe(method(setTexture:))]
#[unsafe(method_family = none)]
pub fn set_texture(
&self,
texture: Option<&ProtocolObject<dyn MTLTexture>>,
);
#[unsafe(method(level))]
#[unsafe(method_family = none)]
pub fn level(&self) -> usize;
#[unsafe(method(setLevel:))]
#[unsafe(method_family = none)]
pub fn set_level(
&self,
level: usize,
);
#[unsafe(method(slice))]
#[unsafe(method_family = none)]
pub fn slice(&self) -> usize;
#[unsafe(method(setSlice:))]
#[unsafe(method_family = none)]
pub fn set_slice(
&self,
slice: usize,
);
#[unsafe(method(depthPlane))]
#[unsafe(method_family = none)]
pub fn depth_plane(&self) -> usize;
#[unsafe(method(setDepthPlane:))]
#[unsafe(method_family = none)]
pub fn set_depth_plane(
&self,
depth_plane: usize,
);
#[unsafe(method(resolveTexture))]
#[unsafe(method_family = none)]
pub fn resolve_texture(&self) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;
#[unsafe(method(setResolveTexture:))]
#[unsafe(method_family = none)]
pub fn set_resolve_texture(
&self,
texture: Option<&ProtocolObject<dyn MTLTexture>>,
);
#[unsafe(method(resolveLevel))]
#[unsafe(method_family = none)]
pub fn resolve_level(&self) -> usize;
#[unsafe(method(setResolveLevel:))]
#[unsafe(method_family = none)]
pub fn set_resolve_level(
&self,
level: usize,
);
#[unsafe(method(resolveSlice))]
#[unsafe(method_family = none)]
pub fn resolve_slice(&self) -> usize;
#[unsafe(method(setResolveSlice:))]
#[unsafe(method_family = none)]
pub fn set_resolve_slice(
&self,
slice: usize,
);
#[unsafe(method(resolveDepthPlane))]
#[unsafe(method_family = none)]
pub fn resolve_depth_plane(&self) -> usize;
#[unsafe(method(setResolveDepthPlane:))]
#[unsafe(method_family = none)]
pub fn set_resolve_depth_plane(
&self,
depth_plane: usize,
);
#[unsafe(method(loadAction))]
#[unsafe(method_family = none)]
pub fn load_action(&self) -> MTLLoadAction;
#[unsafe(method(setLoadAction:))]
#[unsafe(method_family = none)]
pub fn set_load_action(
&self,
load_action: MTLLoadAction,
);
#[unsafe(method(storeAction))]
#[unsafe(method_family = none)]
pub fn store_action(&self) -> MTLStoreAction;
#[unsafe(method(setStoreAction:))]
#[unsafe(method_family = none)]
pub fn set_store_action(
&self,
store_action: MTLStoreAction,
);
#[deprecated(note = "store action options have no effect on Apple Silicon")]
#[unsafe(method(storeActionOptions))]
#[unsafe(method_family = none)]
pub fn store_action_options(&self) -> MTLStoreActionOptions;
#[deprecated(note = "store action options have no effect on Apple Silicon")]
#[unsafe(method(setStoreActionOptions:))]
#[unsafe(method_family = none)]
pub fn set_store_action_options(
&self,
options: MTLStoreActionOptions,
);
);
}
impl MTLRenderPassAttachmentDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}