use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-metal")]
use objc2_metal::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct cp_drawable_state(pub u32);
impl cp_drawable_state {
#[doc(alias = "cp_drawable_state_available")]
pub const available: Self = Self(0);
#[doc(alias = "cp_drawable_state_rendering")]
pub const rendering: Self = Self(1);
#[doc(alias = "cp_drawable_state_presenting")]
pub const presenting: Self = Self(2);
}
unsafe impl Encode for cp_drawable_state {
const ENCODING: Encoding = u32::ENCODING;
}
unsafe impl RefEncode for cp_drawable_state {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct cp_drawable_target(pub u32);
impl cp_drawable_target {
#[doc(alias = "cp_drawable_target_built_in")]
pub const built_in: Self = Self(0);
#[doc(alias = "cp_drawable_target_capture")]
pub const capture: Self = Self(1);
}
unsafe impl Encode for cp_drawable_target {
const ENCODING: Encoding = u32::ENCODING;
}
unsafe impl RefEncode for cp_drawable_target {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(C)]
#[derive(Debug)]
pub struct cp_drawable {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
unsafe impl RefEncode for cp_drawable {
const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("cp_drawable", &[]));
}
pub type cp_drawable_t = *mut cp_drawable;
impl cp_drawable {
#[doc(alias = "cp_drawable_get_texture_count")]
#[inline]
pub unsafe fn texture_count(drawable: cp_drawable_t) -> usize {
extern "C-unwind" {
fn cp_drawable_get_texture_count(drawable: cp_drawable_t) -> usize;
}
unsafe { cp_drawable_get_texture_count(drawable) }
}
#[doc(alias = "cp_drawable_get_tracking_areas_texture_count")]
#[inline]
pub unsafe fn tracking_areas_texture_count(drawable: cp_drawable_t) -> usize {
extern "C-unwind" {
fn cp_drawable_get_tracking_areas_texture_count(drawable: cp_drawable_t) -> usize;
}
unsafe { cp_drawable_get_tracking_areas_texture_count(drawable) }
}
#[doc(alias = "cp_drawable_get_depth_texture")]
#[cfg(feature = "objc2-metal")]
#[inline]
pub unsafe fn depth_texture(
drawable: cp_drawable_t,
index: usize,
) -> Retained<ProtocolObject<dyn MTLTexture>> {
extern "C-unwind" {
fn cp_drawable_get_depth_texture(
drawable: cp_drawable_t,
index: usize,
) -> *mut ProtocolObject<dyn MTLTexture>;
}
let ret = unsafe { cp_drawable_get_depth_texture(drawable, index) };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
#[doc(alias = "cp_drawable_get_color_texture")]
#[cfg(feature = "objc2-metal")]
#[inline]
pub unsafe fn color_texture(
drawable: cp_drawable_t,
index: usize,
) -> Retained<ProtocolObject<dyn MTLTexture>> {
extern "C-unwind" {
fn cp_drawable_get_color_texture(
drawable: cp_drawable_t,
index: usize,
) -> *mut ProtocolObject<dyn MTLTexture>;
}
let ret = unsafe { cp_drawable_get_color_texture(drawable, index) };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
#[doc(alias = "cp_drawable_get_tracking_areas_texture")]
#[cfg(feature = "objc2-metal")]
#[inline]
pub unsafe fn tracking_areas_texture(
drawable: cp_drawable_t,
index: usize,
) -> Retained<ProtocolObject<dyn MTLTexture>> {
extern "C-unwind" {
fn cp_drawable_get_tracking_areas_texture(
drawable: cp_drawable_t,
index: usize,
) -> *mut ProtocolObject<dyn MTLTexture>;
}
let ret = unsafe { cp_drawable_get_tracking_areas_texture(drawable, index) };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
#[doc(alias = "cp_drawable_add_tracking_area")]
#[cfg(feature = "tracking_area")]
#[inline]
pub unsafe fn add_tracking_area(
drawable: cp_drawable_t,
identifier: cp_tracking_area_identifier,
) -> cp_tracking_area_t {
extern "C-unwind" {
fn cp_drawable_add_tracking_area(
drawable: cp_drawable_t,
identifier: cp_tracking_area_identifier,
) -> cp_tracking_area_t;
}
unsafe { cp_drawable_add_tracking_area(drawable, identifier) }
}
#[doc(alias = "cp_drawable_get_rasterization_rate_map_count")]
#[inline]
pub unsafe fn rasterization_rate_map_count(drawable: cp_drawable_t) -> usize {
extern "C-unwind" {
fn cp_drawable_get_rasterization_rate_map_count(drawable: cp_drawable_t) -> usize;
}
unsafe { cp_drawable_get_rasterization_rate_map_count(drawable) }
}
#[doc(alias = "cp_drawable_get_rasterization_rate_map")]
#[cfg(feature = "objc2-metal")]
#[inline]
pub unsafe fn rasterization_rate_map(
drawable: cp_drawable_t,
index: usize,
) -> Retained<ProtocolObject<dyn MTLRasterizationRateMap>> {
extern "C-unwind" {
fn cp_drawable_get_rasterization_rate_map(
drawable: cp_drawable_t,
index: usize,
) -> *mut ProtocolObject<dyn MTLRasterizationRateMap>;
}
let ret = unsafe { cp_drawable_get_rasterization_rate_map(drawable, index) };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
#[doc(alias = "cp_drawable_get_flipped_rasterization_rate_map")]
#[cfg(feature = "objc2-metal")]
#[inline]
pub unsafe fn flipped_rasterization_rate_map(
drawable: cp_drawable_t,
index: usize,
) -> Retained<ProtocolObject<dyn MTLRasterizationRateMap>> {
extern "C-unwind" {
fn cp_drawable_get_flipped_rasterization_rate_map(
drawable: cp_drawable_t,
index: usize,
) -> *mut ProtocolObject<dyn MTLRasterizationRateMap>;
}
let ret = unsafe { cp_drawable_get_flipped_rasterization_rate_map(drawable, index) };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
#[doc(alias = "cp_drawable_get_view_count")]
#[inline]
pub unsafe fn view_count(drawable: cp_drawable_t) -> usize {
extern "C-unwind" {
fn cp_drawable_get_view_count(drawable: cp_drawable_t) -> usize;
}
unsafe { cp_drawable_get_view_count(drawable) }
}
#[doc(alias = "cp_drawable_get_view")]
#[cfg(feature = "view")]
#[inline]
pub unsafe fn view(drawable: cp_drawable_t, index: usize) -> cp_view_t {
extern "C-unwind" {
fn cp_drawable_get_view(drawable: cp_drawable_t, index: usize) -> cp_view_t;
}
unsafe { cp_drawable_get_view(drawable, index) }
}
#[doc(alias = "cp_drawable_encode_present")]
#[cfg(feature = "objc2-metal")]
#[inline]
pub unsafe fn encode_present(
drawable: cp_drawable_t,
command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
) {
extern "C-unwind" {
fn cp_drawable_encode_present(
drawable: cp_drawable_t,
command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
);
}
unsafe { cp_drawable_encode_present(drawable, command_buffer) }
}
#[doc(alias = "cp_drawable_mtl4_encode_present")]
#[inline]
pub unsafe fn mtl4_encode_present(drawable: cp_drawable_t) {
extern "C-unwind" {
fn cp_drawable_mtl4_encode_present(drawable: cp_drawable_t);
}
unsafe { cp_drawable_mtl4_encode_present(drawable) }
}
#[doc(alias = "cp_drawable_get_state")]
#[inline]
pub unsafe fn state(drawable: cp_drawable_t) -> cp_drawable_state {
extern "C-unwind" {
fn cp_drawable_get_state(drawable: cp_drawable_t) -> cp_drawable_state;
}
unsafe { cp_drawable_get_state(drawable) }
}
#[doc(alias = "cp_drawable_get_target")]
#[inline]
pub unsafe fn target(drawable: cp_drawable_t) -> cp_drawable_target {
extern "C-unwind" {
fn cp_drawable_get_target(drawable: cp_drawable_t) -> cp_drawable_target;
}
unsafe { cp_drawable_get_target(drawable) }
}
#[doc(alias = "cp_drawable_get_presentation_frame_index")]
#[cfg(feature = "cp_types")]
#[inline]
pub unsafe fn presentation_frame_index(drawable: cp_drawable_t) -> cp_compositor_frame_index_t {
extern "C-unwind" {
fn cp_drawable_get_presentation_frame_index(
drawable: cp_drawable_t,
) -> cp_compositor_frame_index_t;
}
unsafe { cp_drawable_get_presentation_frame_index(drawable) }
}
#[doc(alias = "cp_drawable_get_frame_timing")]
#[cfg(feature = "frame_timing")]
#[inline]
pub unsafe fn frame_timing(drawable: cp_drawable_t) -> cp_frame_timing_t {
extern "C-unwind" {
fn cp_drawable_get_frame_timing(drawable: cp_drawable_t) -> cp_frame_timing_t;
}
unsafe { cp_drawable_get_frame_timing(drawable) }
}
#[doc(alias = "cp_drawable_is_content_capture_protected")]
#[inline]
pub unsafe fn is_content_capture_protected(drawable: cp_drawable_t) -> bool {
extern "C-unwind" {
fn cp_drawable_is_content_capture_protected(drawable: cp_drawable_t) -> bool;
}
unsafe { cp_drawable_is_content_capture_protected(drawable) }
}
#[doc(alias = "cp_drawable_add_render_context")]
#[cfg(all(feature = "drawable_render_context", feature = "objc2-metal"))]
#[inline]
pub unsafe fn add_render_context(
drawable: cp_drawable_t,
cmd_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
) -> cp_drawable_render_context_t {
extern "C-unwind" {
fn cp_drawable_add_render_context(
drawable: cp_drawable_t,
cmd_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
) -> cp_drawable_render_context_t;
}
unsafe { cp_drawable_add_render_context(drawable, cmd_buffer) }
}
#[doc(alias = "cp_drawable_add_mtl4_render_context")]
#[cfg(feature = "drawable_render_context")]
#[inline]
pub unsafe fn add_mtl4_render_context(drawable: cp_drawable_t) -> cp_drawable_render_context_t {
extern "C-unwind" {
fn cp_drawable_add_mtl4_render_context(
drawable: cp_drawable_t,
) -> cp_drawable_render_context_t;
}
unsafe { cp_drawable_add_mtl4_render_context(drawable) }
}
}
#[repr(C)]
#[derive(Debug)]
pub struct cp_drawable_array {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
unsafe impl RefEncode for cp_drawable_array {
const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("cp_drawable_array", &[]));
}
pub type cp_drawable_array_t = *mut cp_drawable_array;
impl cp_drawable_array {
#[doc(alias = "cp_drawable_array_get_drawable")]
#[inline]
pub unsafe fn drawable(drawable_array: cp_drawable_array_t, index: usize) -> cp_drawable_t {
extern "C-unwind" {
fn cp_drawable_array_get_drawable(
drawable_array: cp_drawable_array_t,
index: usize,
) -> cp_drawable_t;
}
unsafe { cp_drawable_array_get_drawable(drawable_array, index) }
}
#[doc(alias = "cp_drawable_array_get_count")]
#[inline]
pub unsafe fn count(drawable_array: cp_drawable_array_t) -> usize {
extern "C-unwind" {
fn cp_drawable_array_get_count(drawable_array: cp_drawable_array_t) -> usize;
}
unsafe { cp_drawable_array_get_count(drawable_array) }
}
}
extern "C-unwind" {
#[deprecated = "renamed to `cp_drawable::texture_count`"]
pub fn cp_drawable_get_texture_count(drawable: cp_drawable_t) -> usize;
}
extern "C-unwind" {
#[deprecated = "renamed to `cp_drawable::tracking_areas_texture_count`"]
pub fn cp_drawable_get_tracking_areas_texture_count(drawable: cp_drawable_t) -> usize;
}
#[cfg(feature = "objc2-metal")]
#[deprecated = "renamed to `cp_drawable::depth_texture`"]
#[inline]
pub unsafe extern "C-unwind" fn cp_drawable_get_depth_texture(
drawable: cp_drawable_t,
index: usize,
) -> Retained<ProtocolObject<dyn MTLTexture>> {
extern "C-unwind" {
fn cp_drawable_get_depth_texture(
drawable: cp_drawable_t,
index: usize,
) -> *mut ProtocolObject<dyn MTLTexture>;
}
let ret = unsafe { cp_drawable_get_depth_texture(drawable, index) };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
#[cfg(feature = "objc2-metal")]
#[deprecated = "renamed to `cp_drawable::color_texture`"]
#[inline]
pub unsafe extern "C-unwind" fn cp_drawable_get_color_texture(
drawable: cp_drawable_t,
index: usize,
) -> Retained<ProtocolObject<dyn MTLTexture>> {
extern "C-unwind" {
fn cp_drawable_get_color_texture(
drawable: cp_drawable_t,
index: usize,
) -> *mut ProtocolObject<dyn MTLTexture>;
}
let ret = unsafe { cp_drawable_get_color_texture(drawable, index) };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
#[cfg(feature = "objc2-metal")]
#[deprecated = "renamed to `cp_drawable::tracking_areas_texture`"]
#[inline]
pub unsafe extern "C-unwind" fn cp_drawable_get_tracking_areas_texture(
drawable: cp_drawable_t,
index: usize,
) -> Retained<ProtocolObject<dyn MTLTexture>> {
extern "C-unwind" {
fn cp_drawable_get_tracking_areas_texture(
drawable: cp_drawable_t,
index: usize,
) -> *mut ProtocolObject<dyn MTLTexture>;
}
let ret = unsafe { cp_drawable_get_tracking_areas_texture(drawable, index) };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
extern "C-unwind" {
#[cfg(feature = "tracking_area")]
#[deprecated = "renamed to `cp_drawable::add_tracking_area`"]
pub fn cp_drawable_add_tracking_area(
drawable: cp_drawable_t,
identifier: cp_tracking_area_identifier,
) -> cp_tracking_area_t;
}
extern "C-unwind" {
#[deprecated = "renamed to `cp_drawable::rasterization_rate_map_count`"]
pub fn cp_drawable_get_rasterization_rate_map_count(drawable: cp_drawable_t) -> usize;
}
#[cfg(feature = "objc2-metal")]
#[deprecated = "renamed to `cp_drawable::rasterization_rate_map`"]
#[inline]
pub unsafe extern "C-unwind" fn cp_drawable_get_rasterization_rate_map(
drawable: cp_drawable_t,
index: usize,
) -> Retained<ProtocolObject<dyn MTLRasterizationRateMap>> {
extern "C-unwind" {
fn cp_drawable_get_rasterization_rate_map(
drawable: cp_drawable_t,
index: usize,
) -> *mut ProtocolObject<dyn MTLRasterizationRateMap>;
}
let ret = unsafe { cp_drawable_get_rasterization_rate_map(drawable, index) };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
#[cfg(feature = "objc2-metal")]
#[deprecated = "renamed to `cp_drawable::flipped_rasterization_rate_map`"]
#[inline]
pub unsafe extern "C-unwind" fn cp_drawable_get_flipped_rasterization_rate_map(
drawable: cp_drawable_t,
index: usize,
) -> Retained<ProtocolObject<dyn MTLRasterizationRateMap>> {
extern "C-unwind" {
fn cp_drawable_get_flipped_rasterization_rate_map(
drawable: cp_drawable_t,
index: usize,
) -> *mut ProtocolObject<dyn MTLRasterizationRateMap>;
}
let ret = unsafe { cp_drawable_get_flipped_rasterization_rate_map(drawable, index) };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
extern "C-unwind" {
#[deprecated = "renamed to `cp_drawable::view_count`"]
pub fn cp_drawable_get_view_count(drawable: cp_drawable_t) -> usize;
}
extern "C-unwind" {
#[cfg(feature = "view")]
#[deprecated = "renamed to `cp_drawable::view`"]
pub fn cp_drawable_get_view(drawable: cp_drawable_t, index: usize) -> cp_view_t;
}
extern "C-unwind" {
#[cfg(feature = "objc2-metal")]
#[deprecated = "renamed to `cp_drawable::encode_present`"]
pub fn cp_drawable_encode_present(
drawable: cp_drawable_t,
command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
);
}
extern "C-unwind" {
#[deprecated = "renamed to `cp_drawable::mtl4_encode_present`"]
pub fn cp_drawable_mtl4_encode_present(drawable: cp_drawable_t);
}
extern "C-unwind" {
#[deprecated = "renamed to `cp_drawable::state`"]
pub fn cp_drawable_get_state(drawable: cp_drawable_t) -> cp_drawable_state;
}
extern "C-unwind" {
#[deprecated = "renamed to `cp_drawable::target`"]
pub fn cp_drawable_get_target(drawable: cp_drawable_t) -> cp_drawable_target;
}
extern "C-unwind" {
#[cfg(feature = "cp_types")]
#[deprecated = "renamed to `cp_drawable::presentation_frame_index`"]
pub fn cp_drawable_get_presentation_frame_index(
drawable: cp_drawable_t,
) -> cp_compositor_frame_index_t;
}
extern "C-unwind" {
#[cfg(feature = "frame_timing")]
#[deprecated = "renamed to `cp_drawable::frame_timing`"]
pub fn cp_drawable_get_frame_timing(drawable: cp_drawable_t) -> cp_frame_timing_t;
}
extern "C-unwind" {
#[deprecated = "renamed to `cp_drawable::is_content_capture_protected`"]
pub fn cp_drawable_is_content_capture_protected(drawable: cp_drawable_t) -> bool;
}
extern "C-unwind" {
#[cfg(all(feature = "drawable_render_context", feature = "objc2-metal"))]
#[deprecated = "renamed to `cp_drawable::add_render_context`"]
pub fn cp_drawable_add_render_context(
drawable: cp_drawable_t,
cmd_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
) -> cp_drawable_render_context_t;
}
extern "C-unwind" {
#[cfg(feature = "drawable_render_context")]
#[deprecated = "renamed to `cp_drawable::add_mtl4_render_context`"]
pub fn cp_drawable_add_mtl4_render_context(
drawable: cp_drawable_t,
) -> cp_drawable_render_context_t;
}
extern "C-unwind" {
#[deprecated = "renamed to `cp_drawable_array::drawable`"]
pub fn cp_drawable_array_get_drawable(
drawable_array: cp_drawable_array_t,
index: usize,
) -> cp_drawable_t;
}
extern "C-unwind" {
#[deprecated = "renamed to `cp_drawable_array::count`"]
pub fn cp_drawable_array_get_count(drawable_array: cp_drawable_array_t) -> usize;
}