objc2_compositor_services/generated/
layer_renderer_capabilities.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-metal")]
7use objc2_metal::*;
8
9use crate::*;
10
11extern_class!(
12    /// A type that stores the supported configurations for a layer.
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/compositorservices/cp_object_cp_layer_renderer_capabilities?language=objc)
15    #[unsafe(super(NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    pub struct CP_OBJECT_cp_layer_renderer_capabilities;
18);
19
20extern_conformance!(
21    unsafe impl NSObjectProtocol for CP_OBJECT_cp_layer_renderer_capabilities {}
22);
23
24impl CP_OBJECT_cp_layer_renderer_capabilities {
25    extern_methods!(
26        #[unsafe(method(init))]
27        #[unsafe(method_family = init)]
28        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
29
30        #[unsafe(method(new))]
31        #[unsafe(method_family = new)]
32        pub unsafe fn new() -> Retained<Self>;
33    );
34}
35
36/// A type that stores the supported configurations for a layer.
37///
38/// See also [Apple's documentation](https://developer.apple.com/documentation/compositorservices/cp_layer_renderer_capabilities_t?language=objc)
39pub type cp_layer_renderer_capabilities_t = CP_OBJECT_cp_layer_renderer_capabilities;
40
41extern "C-unwind" {
42    /// Returns a Boolean value that indicates whether the layer supports
43    /// variable rasterization rates.
44    ///
45    /// - Parameters:
46    /// - layer_capabilities: The system-provided layer capabilities type.
47    /// - Returns: `true` if the layer supports variable rasterization rates or
48    /// `false` if you must render the entire layer at the same resolution.
49    ///
50    /// Foveation support lets you reduce the amount of high-resolution drawing
51    /// you do. When foveation support is available, you can render content in
52    /// someone’s peripheral vision at a lower resolution than content under
53    /// their direct gaze.
54    pub fn cp_layer_renderer_capabilities_supports_foveation(
55        layer_capabilities: &cp_layer_renderer_capabilities_t,
56    ) -> bool;
57}
58
59/// The options to provide when calling ``cp_layer_renderer_capabilities_supported_color_formats`` and
60/// ``cp_layer_renderer_capabilities_supported_color_formats_count``
61///
62/// See also [Apple's documentation](https://developer.apple.com/documentation/compositorservices/cp_supported_color_formats_options?language=objc)
63// NS_OPTIONS
64#[repr(transparent)]
65#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
66pub struct cp_supported_color_formats_options(pub u32);
67bitflags::bitflags! {
68    impl cp_supported_color_formats_options: u32 {
69        #[doc(alias = "cp_supported_color_formats_options_none")]
70        const none = 0;
71        #[doc(alias = "cp_supported_color_formats_options_progressive_immersion_enabled")]
72        const progressive_immersion_enabled = 1<<0;
73    }
74}
75
76unsafe impl Encode for cp_supported_color_formats_options {
77    const ENCODING: Encoding = u32::ENCODING;
78}
79
80unsafe impl RefEncode for cp_supported_color_formats_options {
81    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
82}
83
84extern "C-unwind" {
85    /// Returns the number of color formats the specified layer supports.
86    ///
87    /// - Parameters:
88    /// - layer_capabilities: The layer capabilities to query.
89    /// - options: The options to consider when creating the list of supported
90    /// color formats.
91    /// - Returns: The number of color formats the layer supports.
92    ///
93    /// To iterate over the color formats, use the ``cp_layer_renderer_capabilities_supported_color_format``
94    /// function.
95    pub fn cp_layer_renderer_capabilities_supported_color_formats_count_with_options(
96        layer_capabilities: &cp_layer_renderer_capabilities_t,
97        options: cp_supported_color_formats_options,
98    ) -> usize;
99}
100
101extern "C-unwind" {
102    /// Returns the number of color formats the specified layer supports.
103    ///
104    /// - Parameters:
105    /// - layer_capabilities: The layer capabilities to query.
106    /// color formats.
107    /// - Returns: The number of color formats the layer supports.
108    ///
109    /// To iterate over the color formats, use the ``cp_layer_renderer_capabilities_supported_color_format``
110    /// function.
111    pub fn cp_layer_renderer_capabilities_supported_color_formats_count(
112        layer_capabilities: &cp_layer_renderer_capabilities_t,
113    ) -> usize;
114}
115
116extern "C-unwind" {
117    /// Returns the color format at the specified index in the layer capabilities.
118    ///
119    /// - Parameters:
120    /// - layer_capabilities: The layer capabilities to query.
121    /// - options: The options to consider when creating the list of supported
122    /// color formats.
123    /// - index: A zero-based index into the list of color formats.
124    /// - Returns: The color format at the specified index.
125    ///
126    /// Use this function to determine the pixel arrangements and characteristics
127    /// you can apply to the layer.
128    #[cfg(feature = "objc2-metal")]
129    pub fn cp_layer_renderer_capabilities_supported_color_format_with_options(
130        layer_capabilities: &cp_layer_renderer_capabilities_t,
131        options: cp_supported_color_formats_options,
132        index: usize,
133    ) -> MTLPixelFormat;
134}
135
136extern "C-unwind" {
137    /// Returns the color format at the specified index in the layer capabilities.
138    ///
139    /// - Parameters:
140    /// - layer_capabilities: The layer capabilities to query.
141    /// - index: A zero-based index into the list of color formats.
142    /// - Returns: The color format at the specified index.
143    ///
144    /// Use this function to determine the pixel arrangements and characteristics
145    /// you can apply to the layer.
146    #[cfg(feature = "objc2-metal")]
147    pub fn cp_layer_renderer_capabilities_supported_color_format(
148        layer_capabilities: &cp_layer_renderer_capabilities_t,
149        index: usize,
150    ) -> MTLPixelFormat;
151}
152
153extern "C-unwind" {
154    /// Returns the number of depth formats the specified layer supports.
155    ///
156    /// - Parameters:
157    /// - layer_capabilities: The layer capabilities to query.
158    /// - Returns: The number of depth formats the layer supports.
159    ///
160    /// To iterate over the depth formats, use the ``cp_layer_renderer_capabilities_supported_depth_format``
161    /// function.
162    pub fn cp_layer_renderer_capabilities_supported_depth_formats_count(
163        layer_capabilities: &cp_layer_renderer_capabilities_t,
164    ) -> usize;
165}
166
167extern "C-unwind" {
168    /// Returns the depth format at the specified index in the layer capabilities.
169    ///
170    /// - Parameters:
171    /// - layer_capabilities: The layer capabilities to query.
172    /// - index: A zero-based index into the list of depth formats.
173    /// - Returns: The pixel format at the specified index.
174    ///
175    /// Use this function to determine what depth texture formats the layer
176    /// supports.
177    #[cfg(feature = "objc2-metal")]
178    pub fn cp_layer_renderer_capabilities_supported_depth_format(
179        layer_capabilities: &cp_layer_renderer_capabilities_t,
180        index: usize,
181    ) -> MTLPixelFormat;
182}
183
184extern "C-unwind" {
185    /// Returns the number of tracking areas formats the specified layer supports.
186    ///
187    /// - Parameters:
188    /// - layer_capabilities: The layer capabilities to query.
189    /// - Returns: The number of tracking areas formats the layer supports.
190    ///
191    /// To iterate over the index formats, use the ``cp_layer_renderer_capabilities_supported_tracking_areas_format``
192    /// function.
193    pub fn cp_layer_renderer_capabilities_supported_tracking_areas_formats_count(
194        layer_capabilities: &cp_layer_renderer_capabilities_t,
195    ) -> usize;
196}
197
198extern "C-unwind" {
199    /// Returns the tracking areas format at the specified index in the layer capabilities.
200    ///
201    /// - Parameters:
202    /// - layer_capabilities: The layer capabilities to query.
203    /// - index: A zero-based index into the list of index formats.
204    /// - Returns: The pixel format at the specified index.
205    ///
206    /// Use this function to determine what tracking areas texture formats the layer
207    /// supports.
208    #[cfg(feature = "objc2-metal")]
209    pub fn cp_layer_renderer_capabilities_supported_tracking_areas_format(
210        layer_capabilities: &cp_layer_renderer_capabilities_t,
211        index: usize,
212    ) -> MTLPixelFormat;
213}
214
215/// The options to provide when calling ``cp_layer_renderer_capabilities_supported_layout`` and
216/// ``cp_layer_renderer_capabilities_supported_layouts_count``
217///
218/// See also [Apple's documentation](https://developer.apple.com/documentation/compositorservices/cp_supported_layouts_options?language=objc)
219// NS_OPTIONS
220#[repr(transparent)]
221#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
222pub struct cp_supported_layouts_options(pub u32);
223bitflags::bitflags! {
224    impl cp_supported_layouts_options: u32 {
225        #[doc(alias = "cp_supported_layouts_options_none")]
226        const none = 0;
227        #[doc(alias = "cp_supported_layouts_options_foveation_enabled")]
228        const foveation_enabled = 1<<0;
229        #[doc(alias = "cp_supported_layouts_options_progressive_immersion_enabled")]
230        const progressive_immersion_enabled = 1<<1;
231    }
232}
233
234unsafe impl Encode for cp_supported_layouts_options {
235    const ENCODING: Encoding = u32::ENCODING;
236}
237
238unsafe impl RefEncode for cp_supported_layouts_options {
239    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
240}
241
242extern "C-unwind" {
243    /// Returns the number of layouts the specified layer supports.
244    ///
245    /// - Parameters:
246    /// - layer_capabilities: The layer capabilities to query.
247    /// - options: The options to consider when creating the list of supported
248    /// layouts.
249    /// - Returns: The number of layouts the layer supports.
250    ///
251    /// To iterate over the layouts, use the ``cp_layer_renderer_capabilities_supported_layout``
252    /// function.
253    pub fn cp_layer_renderer_capabilities_supported_layouts_count(
254        layer_capabilities: &cp_layer_renderer_capabilities_t,
255        options: cp_supported_layouts_options,
256    ) -> usize;
257}
258
259extern "C-unwind" {
260    /// Returns the layout at the specified index in the layer capabilities.
261    ///
262    /// - Parameters:
263    /// - layer_capabilities: The layer capabilities to query.
264    /// - options: The options to consider when creating the list of supported
265    /// layouts.
266    /// - index: A zero-based index into the list of layouts. This value must
267    /// be less than the value the ``cp_layer_renderer_capabilities_supported_layouts_count``
268    /// function returns for the same value of the `foveation_enabled` parameter.
269    /// - Returns: The layer layout at the specified index.
270    ///
271    /// Use this function to determine what texture layouts the layer supports.
272    #[cfg(feature = "layer_renderer_layout")]
273    pub fn cp_layer_renderer_capabilities_supported_layout(
274        layer_capabilities: &cp_layer_renderer_capabilities_t,
275        options: cp_supported_layouts_options,
276        index: usize,
277    ) -> cp_layer_renderer_layout;
278}
279
280extern "C-unwind" {
281    /// Returns the minimum distance in meters to the near projection plane
282    /// that the layer supports.
283    ///
284    /// The compositor uses the near and far projection planes to compute the
285    /// perspective projection matrix and to clip content that is not between
286    /// the near and far planes. Use this method to retrieve the
287    /// minimum distance to the near plane that the layer allows. When you
288    /// configure your layer, you can specify a different minimum distance,
289    /// but that value must be greater than or equal to the distance this
290    /// method returns.
291    ///
292    /// - Parameters:
293    /// - layer_capabilities: The layer capabilities to query.
294    /// - Returns: The minimum allowed distance in meters from the camera
295    /// origin to the near projection plane.
296    pub fn cp_layer_renderer_capabilities_supported_minimum_near_plane_distance(
297        layer_capabilities: &cp_layer_renderer_capabilities_t,
298    ) -> c_float;
299}
300
301extern "C-unwind" {
302    /// Returns the number of stencil formats the specified layer supports.
303    ///
304    /// - Parameters:
305    /// - layer_capabilities: The layer capabilities to query.
306    /// - Returns: The number of stencil formats the layer supports.
307    ///
308    /// To iterate over the stencil formats, use the ``cp_layer_renderer_capabilities_drawable_render_context_supported_stencil_format``
309    /// function.
310    pub fn cp_layer_renderer_capabilities_drawable_render_context_supported_stencil_formats_count(
311        layer_capabilities: &cp_layer_renderer_capabilities_t,
312    ) -> usize;
313}
314
315extern "C-unwind" {
316    /// Returns the stencil format at the specified index in the layer capabilities.
317    ///
318    /// - Parameters:
319    /// - layer_capabilities: The layer capabilities to query.
320    /// - index: A zero-based index into the list of stencil formats.
321    /// - Returns: The stencil format at the specified index.
322    ///
323    /// Use this function to determine the pixel arrangements and characteristics
324    /// you can apply to the layer.
325    #[cfg(feature = "objc2-metal")]
326    pub fn cp_layer_renderer_capabilities_drawable_render_context_supported_stencil_format(
327        layer_capabilities: &cp_layer_renderer_capabilities_t,
328        index: usize,
329    ) -> MTLPixelFormat;
330}
331
332extern "C-unwind" {
333    /// Returns default render quality for drawing on this platform.
334    ///
335    /// This should be used as a base value for the platform quality
336    /// for drawing.
337    ///
338    ///
339    /// See: ``cp_layer_renderer_configuration_set_max_render_quality``
340    /// for usage.
341    ///
342    /// - Parameters:
343    /// - layer_capabilities: The layer capabilities to query.
344    /// - Returns: The default render quality allowed for drawing.
345    #[cfg(feature = "cp_types")]
346    pub fn cp_layer_renderer_capabilities_get_default_render_quality(
347        layer_capabilities: &cp_layer_renderer_capabilities_t,
348    ) -> cp_render_quality_t;
349}