objc2_metal_performance_shaders/generated/MPSRayIntersector/
mod.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3#[cfg(feature = "MPSAccelerationStructure")]
4#[path = "MPSAccelerationStructure.rs"]
5mod __MPSAccelerationStructure;
6#[cfg(feature = "MPSAccelerationStructureGroup")]
7#[path = "MPSAccelerationStructureGroup.rs"]
8mod __MPSAccelerationStructureGroup;
9#[cfg(feature = "MPSInstanceAccelerationStructure")]
10#[path = "MPSInstanceAccelerationStructure.rs"]
11mod __MPSInstanceAccelerationStructure;
12#[cfg(feature = "MPSPolygonAccelerationStructure")]
13#[path = "MPSPolygonAccelerationStructure.rs"]
14mod __MPSPolygonAccelerationStructure;
15#[cfg(feature = "MPSPolygonBuffer")]
16#[path = "MPSPolygonBuffer.rs"]
17mod __MPSPolygonBuffer;
18#[cfg(feature = "MPSQuadrilateralAccelerationStructure")]
19#[path = "MPSQuadrilateralAccelerationStructure.rs"]
20mod __MPSQuadrilateralAccelerationStructure;
21#[cfg(feature = "MPSRayIntersectorTypes")]
22#[path = "MPSRayIntersectorTypes.rs"]
23mod __MPSRayIntersectorTypes;
24#[cfg(feature = "MPSSVGF")]
25#[path = "MPSSVGF.rs"]
26mod __MPSSVGF;
27#[cfg(feature = "MPSTemporalAA")]
28#[path = "MPSTemporalAA.rs"]
29mod __MPSTemporalAA;
30#[cfg(feature = "MPSTriangleAccelerationStructure")]
31#[path = "MPSTriangleAccelerationStructure.rs"]
32mod __MPSTriangleAccelerationStructure;
33
34#[cfg(all(
35    feature = "MPSAccelerationStructure",
36    feature = "MPSCore",
37    feature = "MPSKernel"
38))]
39pub use self::__MPSAccelerationStructure::MPSAccelerationStructure;
40#[cfg(all(
41    feature = "MPSAccelerationStructure",
42    feature = "MPSCore",
43    feature = "MPSKernel",
44    feature = "block2"
45))]
46pub use self::__MPSAccelerationStructure::MPSAccelerationStructureCompletionHandler;
47#[cfg(feature = "MPSAccelerationStructure")]
48pub use self::__MPSAccelerationStructure::MPSAccelerationStructureStatus;
49#[cfg(feature = "MPSAccelerationStructure")]
50pub use self::__MPSAccelerationStructure::MPSAccelerationStructureUsage;
51#[cfg(feature = "MPSAccelerationStructureGroup")]
52pub use self::__MPSAccelerationStructureGroup::MPSAccelerationStructureGroup;
53#[cfg(all(
54    feature = "MPSAccelerationStructure",
55    feature = "MPSCore",
56    feature = "MPSInstanceAccelerationStructure",
57    feature = "MPSKernel"
58))]
59pub use self::__MPSInstanceAccelerationStructure::MPSInstanceAccelerationStructure;
60#[cfg(feature = "MPSInstanceAccelerationStructure")]
61pub use self::__MPSInstanceAccelerationStructure::MPSTransformType;
62#[cfg(all(
63    feature = "MPSAccelerationStructure",
64    feature = "MPSCore",
65    feature = "MPSKernel",
66    feature = "MPSPolygonAccelerationStructure"
67))]
68pub use self::__MPSPolygonAccelerationStructure::MPSPolygonAccelerationStructure;
69#[cfg(feature = "MPSPolygonAccelerationStructure")]
70pub use self::__MPSPolygonAccelerationStructure::MPSPolygonType;
71#[cfg(feature = "MPSPolygonBuffer")]
72pub use self::__MPSPolygonBuffer::MPSPolygonBuffer;
73#[cfg(all(
74    feature = "MPSAccelerationStructure",
75    feature = "MPSCore",
76    feature = "MPSKernel",
77    feature = "MPSPolygonAccelerationStructure",
78    feature = "MPSQuadrilateralAccelerationStructure"
79))]
80pub use self::__MPSQuadrilateralAccelerationStructure::MPSQuadrilateralAccelerationStructure;
81#[cfg(feature = "MPSRayIntersectorTypes")]
82pub use self::__MPSRayIntersectorTypes::MPSIntersectionDistance;
83#[cfg(feature = "MPSRayIntersectorTypes")]
84pub use self::__MPSRayIntersectorTypes::MPSIntersectionDistancePrimitiveIndex;
85#[cfg(feature = "MPSRayIntersectorTypes")]
86pub use self::__MPSRayIntersectorTypes::MPSIntersectionDistancePrimitiveIndexBufferIndex;
87#[cfg(feature = "MPSRayIntersectorTypes")]
88pub use self::__MPSRayIntersectorTypes::MPSIntersectionDistancePrimitiveIndexBufferIndexInstanceIndex;
89#[cfg(feature = "MPSRayIntersectorTypes")]
90pub use self::__MPSRayIntersectorTypes::MPSIntersectionDistancePrimitiveIndexInstanceIndex;
91#[cfg(feature = "MPSRayIntersectorTypes")]
92pub use self::__MPSRayIntersectorTypes::MPSRayOriginMaskDirectionMaxDistance;
93#[cfg(feature = "MPSRayIntersectorTypes")]
94pub use self::__MPSRayIntersectorTypes::MPSRayOriginMinDistanceDirectionMaxDistance;
95#[cfg(feature = "MPSRayIntersectorTypes")]
96pub use self::__MPSRayIntersectorTypes::MPSRayPackedOriginDirection;
97#[cfg(all(feature = "MPSCore", feature = "MPSKernel", feature = "MPSTemporalAA"))]
98pub use self::__MPSTemporalAA::MPSTemporalAA;
99#[cfg(all(
100    feature = "MPSAccelerationStructure",
101    feature = "MPSCore",
102    feature = "MPSKernel",
103    feature = "MPSPolygonAccelerationStructure",
104    feature = "MPSTriangleAccelerationStructure"
105))]
106pub use self::__MPSTriangleAccelerationStructure::MPSTriangleAccelerationStructure;
107#[cfg(feature = "MPSSVGF")]
108pub use self::__MPSSVGF::MPSSVGFDefaultTextureAllocator;
109#[cfg(feature = "MPSSVGF")]
110pub use self::__MPSSVGF::MPSSVGFDenoiser;
111#[cfg(feature = "MPSSVGF")]
112pub use self::__MPSSVGF::MPSSVGFTextureAllocator;
113#[cfg(feature = "MPSSVGF")]
114pub use self::__MPSSVGF::MPSTemporalWeighting;
115#[cfg(all(feature = "MPSCore", feature = "MPSKernel", feature = "MPSSVGF"))]
116pub use self::__MPSSVGF::MPSSVGF;
117use core::ffi::*;
118use core::ptr::NonNull;
119use objc2::__framework_prelude::*;
120use objc2_foundation::*;
121use objc2_metal::*;
122
123use crate::*;
124
125/// Options for the MPSRayIntersector intersection type property
126///
127/// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsintersectiontype?language=objc)
128// NS_ENUM
129#[repr(transparent)]
130#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
131pub struct MPSIntersectionType(pub NSUInteger);
132impl MPSIntersectionType {
133    /// Find the closest intersection to the ray's origin along the ray direction. This is
134    /// potentially slower than MPSIntersectionTypeAny but is well suited to primary visibility
135    /// rays.
136    #[doc(alias = "MPSIntersectionTypeNearest")]
137    pub const Nearest: Self = Self(0);
138    /// Find any intersection along the ray direction. This is potentially faster than
139    /// MPSIntersectionTypeNearest and is well suited to shadow and occlusion rays.
140    #[doc(alias = "MPSIntersectionTypeAny")]
141    pub const Any: Self = Self(1);
142}
143
144unsafe impl Encode for MPSIntersectionType {
145    const ENCODING: Encoding = NSUInteger::ENCODING;
146}
147
148unsafe impl RefEncode for MPSIntersectionType {
149    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
150}
151
152/// Options for the MPSRayIntersector triangle intersection test type property
153///
154/// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpstriangleintersectiontesttype?language=objc)
155// NS_ENUM
156#[deprecated]
157#[repr(transparent)]
158#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
159pub struct MPSTriangleIntersectionTestType(pub NSUInteger);
160impl MPSTriangleIntersectionTestType {
161    /// Use the default ray/triangle intersection test
162    #[doc(alias = "MPSTriangleIntersectionTestTypeDefault")]
163    #[deprecated]
164    pub const Default: Self = Self(0);
165    /// Use a watertight ray/triangle intersection test which avoids gaps along shared
166    /// triangle edges. Shared vertices may still have gaps. This intersection test may be slower
167    /// than MPSTriangleIntersectionTestTypeDefault.
168    #[doc(alias = "MPSTriangleIntersectionTestTypeWatertight")]
169    #[deprecated]
170    pub const Watertight: Self = Self(1);
171}
172
173unsafe impl Encode for MPSTriangleIntersectionTestType {
174    const ENCODING: Encoding = NSUInteger::ENCODING;
175}
176
177unsafe impl RefEncode for MPSTriangleIntersectionTestType {
178    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
179}
180
181/// Options for the MPSRayIntersector bounding box intersection test type property
182///
183/// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsboundingboxintersectiontesttype?language=objc)
184// NS_ENUM
185#[deprecated]
186#[repr(transparent)]
187#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
188pub struct MPSBoundingBoxIntersectionTestType(pub NSUInteger);
189impl MPSBoundingBoxIntersectionTestType {
190    /// Use the default MPSBoundingBoxIntersectionTestTypeAxisAligned ray/bounding box
191    /// intersection test.
192    ///
193    /// Note: this option was equivalent to MPSBoundingBoxIntersectionTestTypeFast in
194    /// macOS 10.14/iOS 12.0. This option was changed in macOS 10.15/iOS 13.0 to handle axis-aligned
195    /// rays correctly by default. The old behavior can be restored by explicitly setting the
196    /// intersection test type to MPSBoundingBoxIntersectionTestTypeFast on macOS 10.15/iOS 13.0
197    /// and above.
198    #[doc(alias = "MPSBoundingBoxIntersectionTestTypeDefault")]
199    #[deprecated]
200    pub const Default: Self = Self(0);
201    /// This intersection test is potentially slower than
202    /// MPSBoundingBoxIntersectionTestTypeFast but does not generate false negatives for
203    /// axis aligned rays (i.e. rays which have one or more components of their direction set to
204    /// zero). These rays often do not come up in practice due to perspective projections and
205    /// randomized ray distributions. However, synthetic ray distributions or orthographic
206    /// projections can generate these rays. It may be faster to slightly perturb the ray
207    /// direction and use the fast intersection test type.
208    #[doc(alias = "MPSBoundingBoxIntersectionTestTypeAxisAligned")]
209    #[deprecated]
210    pub const AxisAligned: Self = Self(1);
211    /// This intersection test is potentially faster than
212    /// MPSBoundingBoxIntersectionTestTypeAxisAligned but can generate false negatives for
213    /// axis aligned rays (i.e. rays which have one or more components of their direction set to
214    /// zero). These rays often do not come up in practice due to perspective projections and
215    /// randomized ray distributions. However, synthetic ray distributions or orthographic
216    /// projections can generate these rays.
217    #[doc(alias = "MPSBoundingBoxIntersectionTestTypeFast")]
218    #[deprecated]
219    pub const Fast: Self = Self(2);
220}
221
222unsafe impl Encode for MPSBoundingBoxIntersectionTestType {
223    const ENCODING: Encoding = NSUInteger::ENCODING;
224}
225
226unsafe impl RefEncode for MPSBoundingBoxIntersectionTestType {
227    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
228}
229
230/// Options for the MPSRayIntersector ray mask options property
231///
232/// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsraymaskoptions?language=objc)
233// NS_OPTIONS
234#[deprecated]
235#[repr(transparent)]
236#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
237pub struct MPSRayMaskOptions(pub NSUInteger);
238bitflags::bitflags! {
239    impl MPSRayMaskOptions: NSUInteger {
240/// Disable primitive and instance masks
241        #[doc(alias = "MPSRayMaskOptionNone")]
242#[deprecated]
243        const None = 0;
244/// Enable primitive masks
245        #[doc(alias = "MPSRayMaskOptionPrimitive")]
246#[deprecated]
247        const Primitive = 1;
248/// Enable instance masks
249        #[doc(alias = "MPSRayMaskOptionInstance")]
250#[deprecated]
251        const Instance = 2;
252    }
253}
254
255unsafe impl Encode for MPSRayMaskOptions {
256    const ENCODING: Encoding = NSUInteger::ENCODING;
257}
258
259unsafe impl RefEncode for MPSRayMaskOptions {
260    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
261}
262
263/// Options for the MPSRayIntersector ray data type property
264///
265/// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsraydatatype?language=objc)
266// NS_ENUM
267#[repr(transparent)]
268#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
269pub struct MPSRayDataType(pub NSUInteger);
270impl MPSRayDataType {
271    /// Use the MPSRayOriginDirection struct type
272    #[doc(alias = "MPSRayDataTypeOriginDirection")]
273    pub const OriginDirection: Self = Self(0);
274    /// Use the MPSRayOriginMinDistanceDirectionMaxDistance struct type
275    #[doc(alias = "MPSRayDataTypeOriginMinDistanceDirectionMaxDistance")]
276    pub const OriginMinDistanceDirectionMaxDistance: Self = Self(1);
277    /// Use the MPSRayOriginMaxDistanceDirectionMask struct type
278    #[doc(alias = "MPSRayDataTypeOriginMaskDirectionMaxDistance")]
279    pub const OriginMaskDirectionMaxDistance: Self = Self(2);
280    /// Use the MPSPackedRayOriginDirection struct type
281    #[doc(alias = "MPSRayDataTypePackedOriginDirection")]
282    pub const PackedOriginDirection: Self = Self(3);
283}
284
285unsafe impl Encode for MPSRayDataType {
286    const ENCODING: Encoding = NSUInteger::ENCODING;
287}
288
289unsafe impl RefEncode for MPSRayDataType {
290    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
291}
292
293/// Intersection data type options
294///
295/// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsintersectiondatatype?language=objc)
296// NS_ENUM
297#[repr(transparent)]
298#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
299pub struct MPSIntersectionDataType(pub NSUInteger);
300impl MPSIntersectionDataType {
301    /// Use the MPSIntersectionDistance struct type
302    #[doc(alias = "MPSIntersectionDataTypeDistance")]
303    pub const Distance: Self = Self(0);
304    /// Use the MPSIntersectionDistancePrimitiveIndex struct type
305    #[doc(alias = "MPSIntersectionDataTypeDistancePrimitiveIndex")]
306    pub const DistancePrimitiveIndex: Self = Self(1);
307    /// Use the MPSIntersectionDistancePrimitiveIndexCoordinates struct type
308    #[doc(alias = "MPSIntersectionDataTypeDistancePrimitiveIndexCoordinates")]
309    pub const DistancePrimitiveIndexCoordinates: Self = Self(2);
310    /// Use the DistancePrimitiveIndexInstanceIndex struct type
311    #[doc(alias = "MPSIntersectionDataTypeDistancePrimitiveIndexInstanceIndex")]
312    pub const DistancePrimitiveIndexInstanceIndex: Self = Self(3);
313    /// Use the DistancePrimitiveIndexInstanceIndexCoordinates struct type
314    #[doc(alias = "MPSIntersectionDataTypeDistancePrimitiveIndexInstanceIndexCoordinates")]
315    pub const DistancePrimitiveIndexInstanceIndexCoordinates: Self = Self(4);
316    /// Use the MPSIntersectionDistancePrimitiveIndexBufferIndex struct type
317    #[doc(alias = "MPSIntersectionDataTypeDistancePrimitiveIndexBufferIndex")]
318    pub const DistancePrimitiveIndexBufferIndex: Self = Self(5);
319    /// Use the MPSIntersectionDistancePrimitiveIndexBufferIndexCoordinates struct type
320    #[doc(alias = "MPSIntersectionDataTypeDistancePrimitiveIndexBufferIndexCoordinates")]
321    pub const DistancePrimitiveIndexBufferIndexCoordinates: Self = Self(6);
322    /// Use the DistancePrimitiveIndexBufferIndexInstanceIndex struct type
323    #[doc(alias = "MPSIntersectionDataTypeDistancePrimitiveIndexBufferIndexInstanceIndex")]
324    pub const DistancePrimitiveIndexBufferIndexInstanceIndex: Self = Self(7);
325    /// Use the DistancePrimitiveIndexBufferIndexInstanceIndexCoordinates struct type
326    #[doc(
327        alias = "MPSIntersectionDataTypeDistancePrimitiveIndexBufferIndexInstanceIndexCoordinates"
328    )]
329    pub const DistancePrimitiveIndexBufferIndexInstanceIndexCoordinates: Self = Self(8);
330}
331
332unsafe impl Encode for MPSIntersectionDataType {
333    const ENCODING: Encoding = NSUInteger::ENCODING;
334}
335
336unsafe impl RefEncode for MPSIntersectionDataType {
337    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
338}
339
340/// Options for the MPSRayIntersector ray mask operator property
341///
342/// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsraymaskoperator?language=objc)
343// NS_ENUM
344#[deprecated]
345#[repr(transparent)]
346#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
347pub struct MPSRayMaskOperator(pub NSUInteger);
348impl MPSRayMaskOperator {
349    /// Accept the intersection if (primitive mask
350    /// &
351    /// ray mask) != 0.
352    #[doc(alias = "MPSRayMaskOperatorAnd")]
353    #[deprecated]
354    pub const And: Self = Self(0);
355    /// Accept the intersection if ~(primitive mask
356    /// &
357    /// ray mask) != 0.
358    #[doc(alias = "MPSRayMaskOperatorNotAnd")]
359    #[deprecated]
360    pub const NotAnd: Self = Self(1);
361    /// Accept the intersection if (primitive mask | ray mask) != 0.
362    #[doc(alias = "MPSRayMaskOperatorOr")]
363    #[deprecated]
364    pub const Or: Self = Self(2);
365    /// Accept the intersection if ~(primitive mask | ray mask) != 0.
366    #[doc(alias = "MPSRayMaskOperatorNotOr")]
367    #[deprecated]
368    pub const NotOr: Self = Self(3);
369    /// Accept the intersection if (primitive mask ^ ray mask) != 0.
370    #[doc(alias = "MPSRayMaskOperatorXor")]
371    #[deprecated]
372    pub const Xor: Self = Self(4);
373    /// Accept the intersection if ~(primitive mask ^ ray mask) != 0.
374    #[doc(alias = "MPSRayMaskOperatorNotXor")]
375    #[deprecated]
376    pub const NotXor: Self = Self(5);
377    /// Accept the intersection if primitive mask
378    /// <
379    /// ray mask.
380    #[doc(alias = "MPSRayMaskOperatorLessThan")]
381    #[deprecated]
382    pub const LessThan: Self = Self(6);
383    /// Accept the intersection if primitive mask
384    /// <
385    /// = ray mask.
386    #[doc(alias = "MPSRayMaskOperatorLessThanOrEqualTo")]
387    #[deprecated]
388    pub const LessThanOrEqualTo: Self = Self(7);
389    /// Accept the intersection if primitive mask > ray mask.
390    #[doc(alias = "MPSRayMaskOperatorGreaterThan")]
391    #[deprecated]
392    pub const GreaterThan: Self = Self(8);
393    /// Accept the intersection if primitive mask >= ray mask.
394    #[doc(alias = "MPSRayMaskOperatorGreaterThanOrEqualTo")]
395    #[deprecated]
396    pub const GreaterThanOrEqualTo: Self = Self(9);
397    /// Accept the intersection if primitive mask == ray mask.
398    #[doc(alias = "MPSRayMaskOperatorEqual")]
399    #[deprecated]
400    pub const Equal: Self = Self(10);
401    /// Accept the intersection if primitive mask != ray mask.
402    #[doc(alias = "MPSRayMaskOperatorNotEqual")]
403    #[deprecated]
404    pub const NotEqual: Self = Self(11);
405}
406
407unsafe impl Encode for MPSRayMaskOperator {
408    const ENCODING: Encoding = NSUInteger::ENCODING;
409}
410
411unsafe impl RefEncode for MPSRayMaskOperator {
412    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
413}
414
415extern_class!(
416    /// Performs intersection tests between rays and the geometry in an MPSAccelerationStructure
417    ///
418    ///
419    /// An MPSRayIntersector is used to schedule intersection tests between rays and geometry
420    /// into an MTLCommandBuffer. First, create a raytracer with a Metal device. Then, configure the
421    /// properties of the raytracer:
422    ///
423    ///
424    /// ```text
425    ///      id <MTLDevice> device = MTLCreateSystemDefaultDevice();
426    ///      id <MTLCommandQueue> commandQueue = [device newCommandQueue];
427    ///   
428    ///      MPSRayIntersector *raytracer = [[MPSRayIntersector alloc] initWithDevice:device];
429    ///
430    ///      // Configure raytracer properties
431    /// ```
432    ///
433    /// Before scheduling intersection tests, an MPSAccelerationStructure must be created. The
434    /// acceleration structure is built over geometry and is used to accelerate intersection testing.
435    /// For example, to create a triangle acceleration structure, allocate an
436    /// MPSTriangleAccelerationStructure object. Then, configure the properties of the acceleration
437    /// structure. For example, triangle acceleration structures require a vertex buffer and a triangle
438    /// count:
439    ///
440    ///
441    /// ```text
442    ///      MPSTriangleAccelerationStructure *accelerationStructure =
443    ///          [[MPSTriangleAccelerationStructure alloc] initWithDevice:device];
444    ///   
445    ///      accelerationStructure.vertexBuffer = vertexBuffer;
446    ///      accelerationStructure.triangleCount = triangleCount;
447    /// ```
448    ///
449    /// Acceleration structures must be built at least once before they are used for intersection
450    /// testing, and must be rebuilt when the geometry changes. Rebuilding an acceleration structure
451    /// is a time consuming operation, so an asynchronous version of this method is also available.
452    ///
453    ///
454    /// ```text
455    ///      [accelerationStructure rebuild];
456    /// ```
457    ///
458    /// The raytracer is then used to schedule intersection tests into an MTLCommandBuffer. Rays
459    /// are provided in batches through a Metal buffer, and intersection results are returned through
460    /// another Metal buffer in the same order, one intersection per ray.
461    ///
462    /// There are several choices of ray data type controlled by the rayDataType property. The default
463    /// ray data type is MPSRayOriginDirection, which includes just the ray origin direction. The other
464    /// data types add support for minimum and maximum intersection distances and ray masks. These
465    /// data types are available in the Metal Shading Language by including the
466    /// MetalPerformanceShaders/MetalPerformanceShaders.h header. Additional application specific
467    /// per-ray data can also be appended to the end of the ray data type using the rayStride property.
468    /// This data will be ignored by the intersector.
469    ///
470    /// If the rays were generated on the CPU:
471    ///
472    ///
473    /// ```text
474    ///      typedef MPSRayOriginDirection Ray;
475    ///
476    ///      // Create a buffer to hold the rays
477    ///      id <MTLBuffer> rayBuffer = [device newBufferWithLength:sizeof(Ray) * rayCount options:0];
478    ///
479    ///      // Copy the rays into the ray buffer
480    ///      memcpy(rayBuffer.contents, rays, sizeof(Ray) * rayCount);
481    ///   
482    ///      // Create a buffer to hold the intersections
483    ///      id <MTLBuffer> intersectionBuffer = [device newBufferWithLength:sizeof(Intersection) * rayCount
484    ///                                                              options:0];
485    /// ```
486    ///
487    /// It can be useful to prevent certain rays from participating in intersection testing. For
488    /// example: rays which have bounced out of the scene in previous intersection tests. It may be
489    /// more efficient to do this by compacting the ray buffer so that threads with invalid rays are
490    /// not left idle during intersection testing. However, it can be more convenient to disable the
491    /// ray in place. This can be done by setting most fields to invalid values. For example, setting
492    /// the maximum distance to a negative value, setting the mask to zero, setting the direction to
493    /// the zero vector, etc.
494    ///
495    /// Finally, the intersection testing is encoded into an MTLCommandBuffer. There are two
496    /// intersection types. The "nearest" intersection type returns the closest intersection along each
497    /// ray. The "any" intersection type returns immediately when the first intersection is found. The
498    /// "any" intersection type is useful for determining whether a point is visible from another point
499    /// for, e.g., shadow rays or ambient occlusion rays and is typically much faster than the "nearest"
500    /// intersection type.
501    ///
502    ///
503    /// ```text
504    ///      id <MTLCommandBuffer> commandBuffer = [commandQueue commandBuffer];
505    ///   
506    ///      [raytracer encodeIntersectionToCommandBuffer:commandBuffer
507    ///                                  intersectionType:MPSIntersectionTypeNearest
508    ///                                         rayBuffer:rayBuffer
509    ///                                   rayBufferOffset:0
510    ///                                intersectionBuffer:intersectionBuffer
511    ///                          intersectionBufferOffset:0
512    ///                                          rayCount:rayCount
513    ///                             accelerationStructure:accelerationStructure];
514    ///
515    ///      [commandBuffer commit];
516    /// ```
517    ///
518    /// The intersection results are not available until the command buffer has finished executing
519    /// on the GPU. It is not safe for the CPU to write or read the contents of the ray buffer,
520    /// intersection buffer, vertex buffer, etc. until the command buffer has finished executing.
521    /// Use the waitUntilCompleted or addCompletedHandler methods of the MTLCommandBuffer to block
522    /// the CPU until the GPU has finished executing. Then retrieve the intersection results
523    /// from the intersection buffer:
524    ///
525    ///
526    /// ```text
527    ///      typedef MPSIntersectionDistancePrimitiveIndexCoordinates Intersection;
528    /// ```
529    ///
530    ///
531    /// ```text
532    ///      [commandBuffer waitUntilCompleted];
533    ///
534    ///      Intersection *intersections = (Intersection *)intersectionBuffer.contents;
535    /// ```
536    ///
537    /// There are also several choices of intersection data type controlled by the intersectionDataType
538    /// property. The default intersection data type is MPSIntersectionDistancePrimitiveIndexCoordinates,
539    /// which includes the intersection distance, primitive index, and barycentric coordinates. The
540    /// other data types remove the primitive index or barycentric coordinates, which can be used to
541    /// reduce the memory and memory bandwidth usage of the intersection buffer. These data types are
542    /// available in the Metal Shading Language by including the
543    /// MetalPerformanceShaders/MetalPerformanceShaders.h header.
544    ///
545    /// The intersection distance field is positive when an intersection has been found and negative
546    /// when there is no intersection. When using the "nearest" intersection type, the intersection
547    /// point is the ray origin plus the ray direction multiplied by the intersection distance. The
548    /// other fields are not valid if there is no intersection. Only the intersection distance field is
549    /// valid for the "any" intersection type, and the distance is either a negative or positive value
550    /// to indicate an intersection or miss. It does not necessarily contain the actual intersection
551    /// distance when using the "any" intersection type.
552    ///
553    /// Asynchronous Raytracing: Copying rays and intersections to and from the CPU is expensive.
554    /// Furthermore, generating rays and consuming intersections on the CPU causes the CPU and GPU to
555    /// block each other. If the CPU must generate rays and consume intersections, it is better
556    /// to add an asynchronous completion handler to the MTLCommandBuffer. The CPU can then proceed
557    /// to do other useful work and will be notified when the GPU has finished executing. Use double
558    /// or triple buffered ray and intersection buffers to avoid race conditions such as the CPU
559    /// overwriting data the GPU may be reading. Then the CPU can safely write to one range of the
560    /// buffer while the GPU reads from another range of the buffer. Once the GPU is done
561    /// executing, the CPU and GPU can advance to the next range of the buffer. This method can be
562    /// implemented using a completion handler and a semaphore:
563    ///
564    ///
565    /// ```text
566    ///      #define MAX_ASYNC_OPERATIONS 3
567    ///
568    ///      // Initialization:
569    ///
570    ///      // Create a semaphore with the maximum number of asynchronous operations in flight
571    ///      dispatch_semaphore_t asyncOperationSemaphore = dispatch_semaphore_create(MAX_ASYNC_OPERATIONS);
572    ///
573    ///      // Create a ray and intersection buffer large enough for the maximum number of operations
574    ///      id <MTLBuffer> rayBuffer =
575    ///          [device newBufferWithLength:sizeof(Ray) * rayCount * MAX_ASYNC_OPERATIONS
576    ///                              options:0];
577    ///
578    ///      id <MTLBuffer> intersectionBuffer =
579    ///          [device newBufferWithLength:sizeof(Intersection) * rayCount * MAX_ASYNC_OPERATIONS
580    ///                              options:0];
581    ///
582    ///      NSUInteger asyncOperationIndex = 0;
583    ///
584    ///      // Encode intersection testing:
585    ///
586    ///      // Wait until there is a free buffer range
587    ///      dispatch_semaphore_wait(asyncOperationSemaphore, DISPATCH_TIME_FOREVER);
588    ///
589    ///      // Copy rays into ray buffer
590    ///      NSUInteger rayBufferOffset = sizeof(Ray) * rayCount * asyncOperationIndex;
591    ///      NSUInteger intersectionBufferOffset = sizeof(Intersection) * rayCount * asyncOperationIndex;
592    ///
593    ///      memcpy((uint8_t *)rayBuffer.contents + rayBufferOffset, rays, sizeof(Ray) * rayCount);
594    ///
595    ///      // Advance the async operation index
596    ///      asyncOperationIndex = (asyncOperationIndex + 1) % MAX_ASYNC_OPERATIONS;
597    ///
598    ///      // Create a command buffer
599    ///      id <MTLCommandBuffer> commandBuffer = [commandQueue commandBuffer];
600    ///
601    ///      // Encode actual intersection work
602    ///      [raytracer encodeIntersectionToCommandBuffer:commandBuffer
603    ///                                  intersectionType:MPSIntersectionTypeNearest
604    ///                                         rayBuffer:rayBuffer
605    ///                                   rayBufferOffset:rayBufferOffset
606    ///                                intersectionBuffer:intersectionBuffer
607    ///                          intersectionBufferOffset:intersectionBufferOffset
608    ///                                          rayCount:rayCount
609    ///                             accelerationStructure:accelerationStructure];
610    ///
611    ///      // Register a completion handler to run when the GPU finishes executing
612    ///      [commandBuffer addCompletedHandler:^(id <MTLCommandBuffer> commandBuffer) {
613    ///          Intersection *intersections = (Intersection *)((uint8_t *)intersectionBuffer.contents +
614    ///              intersectionBufferOffset);
615    ///
616    ///          // Process intersections
617    ///
618    ///          // Signal that the ray and intersection buffer ranges are now available for reuse
619    ///          dispatch_semaphore_signal(asyncOperationSemaphore);
620    ///      }];
621    ///
622    ///      // Commit the command buffer to allow the GPU to start executing
623    ///      [commandBuffer commit];
624    /// ```
625    ///
626    /// GPU Driven Raytracing: Pipelining CPU and GPU work with asynchronous raytracing is better than
627    /// allowing the CPU and GPU block each other, but it is even better to produce rays and consume
628    /// intersections entirely on the GPU. This avoids the need to copy rays and intersections to and
629    /// from the GPU and avoids any kind of CPU/GPU synchronization. To do this, encode compute kernels
630    /// before and after intersection testing. By processing rays in parallel, the compute kernels may
631    /// also be able to generate and consume rays faster than the CPU. The ray generation kernel
632    /// typically produces rays according to some camera model, and the intersection consumption kernel
633    /// typically updates the output buffer or texture according to some shading model.
634    ///
635    /// Since the rays and intersections will never leave the GPU, store them in private Metal buffers
636    /// that are allocated in GPU memory rather than system memory. Because the ray generation,
637    /// intersection testing, and intersection consumption kernels are pipelined on the GPU, there
638    /// is no need to double or triple buffer the ray or intersection buffers, which saves memory.
639    ///
640    ///
641    /// ```text
642    ///      id <MTLBuffer> rayBuffer =
643    ///          [device newBufferWithLength:sizeof(Ray) * rayCount
644    ///                              options:MTLResourceStorageModePrivate];
645    ///      id <MTLBuffer> intersectionBuffer =
646    ///          [device newBufferWithLength:sizeof(Intersection) * rayCount
647    ///                              options:MTLResourceStorageModePrivate];
648    ///
649    ///      id <MTLCommandBuffer> commandBuffer = [commandQueue commandBuffer];
650    ///
651    ///      // Generate rays
652    ///      id <MTLComputeCommandEncoder> encoder = [commandBuffer computeCommandEncoder];
653    ///
654    ///      [encoder setBuffer:rayBuffer offset:0 atIndex:0];
655    ///      [encoder setBytes:&uniformData length:sizeof(uniformData) atIndex:1];
656    ///
657    ///      [encoder setComputePipelineState:cameraPipeline];
658    ///
659    ///      [encoder dispatchThreads:MTLSizeMake(rayCount, 1, 1)
660    ///         threadsPerThreadgroup:MTLSizeMake(64, 1, 1)];
661    ///
662    ///      [encoder endEncoding];
663    ///
664    ///      [raytracer encodeIntersectionToCommandBuffer:commandBuffer
665    ///                                  intersectionType:MPSIntersectionTypeNearest
666    ///                                         rayBuffer:rayBuffer
667    ///                                   rayBufferOffset:0
668    ///                                intersectionBuffer:intersectionBuffer
669    ///                          intersectionBufferOffset:0
670    ///                                          rayCount:rayCount
671    ///                             accelerationStructure:accelerationStructure];
672    ///
673    ///      // Perform shading at intersections and update framebuffer texture
674    ///      encoder = [commandBuffer computeCommandEncoder];
675    ///
676    ///      [encoder setBuffer:rayBuffer offset:0 atIndex:0];
677    ///      [encoder setBuffer:intersectionBuffer offset:0 atIndex:1];
678    ///      [encoder setBytes:&uniformData length:sizeof(uniformData) atIndex:2];
679    ///
680    ///      [encoder setTexture:framebufferTexture atIndex:0];
681    ///
682    ///      [encoder setComputePipelineState:shadingPipeline];
683    ///
684    ///      [encoder dispatchThreads:MTLSizeMake(rayCount, 1, 1)
685    ///         threadsPerThreadgroup:MTLSizeMake(64, 1, 1)];
686    ///
687    ///      [encoder endEncoding];
688    ///
689    ///      [commandBuffer commit];
690    /// ```
691    ///
692    /// Note that the intersection consumption kernel can in turn produce new rays that can be passed
693    /// back to the MPSRayIntersector. This technique can be used to implement iterative techniques such as
694    /// progressive path tracing without leaving the GPU. For example, the shading kernel in the example
695    /// above could produce both a secondary ray that will be passed back to the raytracer in the
696    /// next iteration as well as a shadow ray that will be used to sample the direct lighting. A
697    /// final kernel can consume the shadow ray intersections to accumulate lighting contributions
698    /// into the framebuffer.
699    ///
700    /// There is an alternative version of the intersection test encoding method that does not accept
701    /// a literal ray count. The ray count is instead fetched indirectly by the GPU. For example,
702    /// this can be combined with a parallel reduction on the GPU to compact the ray buffer after each
703    /// iteration as rays bounce out of the scene or are absorbed. Alternatively, setting the maximum
704    /// distance of a ray to a negative number indicates that the ray has become inactive and causes the
705    /// raytracer to ignore the ray.
706    ///
707    ///
708    /// ```text
709    ///      [raytracer encodeIntersectionToCommandBuffer:commandBuffer
710    ///                                  intersectionType:MPSIntersectionTypeNearest
711    ///                                         rayBuffer:rayBuffer
712    ///                                   rayBufferOffset:0
713    ///                                intersectionBuffer:intersectionBuffer
714    ///                          intersectionBufferOffset:0
715    ///                                    rayCountBuffer:rayCountBuffer
716    ///                              rayCountBufferOffset:0
717    ///                             accelerationStructure:accelerationStructure];
718    /// ```
719    ///
720    /// Multi-GPU Raytracing: to implement multi-GPU raytracing, create the MPSRayIntersector and
721    /// MPSAccelerationStructure objects first with one Metal device and copy them to the other Metal
722    /// device(s). The raytracing process can then proceed independently on each GPU. For example,
723    /// divide the output image into tiles or slices that are rendered independently. Then composite
724    /// finished tiles or slices back together on one GPU and present the output image to the screen.
725    /// The workload should be distributed across GPUs according to their performance to avoid a more
726    /// powerful GPU idly waiting for a less powerful GPU to finish.
727    ///
728    /// Acceleration Structure Serialization: MPSAccelerationStructure objects can be serialized
729    /// and deserialized using the NSSecureCoding protocol. This can be used to build acceleration
730    /// structures offline and reload them at runtime rather than building them from scratch.
731    ///
732    /// Performance Guidelines:
733    ///
734    /// - For vertex buffers, ray buffers, intersection buffers, etc., use private or managed
735    /// buffers rather than shared buffers when possible on discrete memory GPU architectures as
736    /// they are much faster than fetching data over the PCIe bus. If the CPU only writes once
737    /// to a ray buffer once and reads once from the intersection buffer, then a shared buffer may
738    /// be acceptable and avoids extra copies to and from the GPU. However, it is generally
739    /// preferable to generate and consume rays and intersections on the GPU instead, in which
740    /// case a private buffer should be used. Vertex data is typically static and reused many
741    /// times so it should be stored in private or managed buffers.
742    ///
743    /// - If the CPU must generate and consume rays and intersections, use double or triple
744    /// buffering as described above. This avoids the CPU and GPU mutually blocking each other.
745    ///
746    /// - In general, disable any unused features such as ray masks, backface culling,
747    /// etc. Enabling extra features increases the number of instructions and register usage of
748    /// the ray intersection kernel(s), reducing intersection performance. For example, it may be
749    /// more efficient to compute barycentric coordinates in your intersection consumption
750    /// kernel rather getting them from the raytracer. Use of an index buffer may also reduce
751    /// performance, so consider disabling the index buffer if there is enough memory available.
752    ///
753    /// - Try to submit rays in large batches. This amortizes the costs involved in dispatching
754    /// work to the GPU and also allows the GPU to perform more effective latency hiding.
755    /// Use the recommendedMinimumRayBatchSizeForRayCount method to get an estimate of the
756    /// minimum recommended ray batch size. For this reason, small images or sample counts
757    /// may not perform as well as large images or sample counts. Note, however, that submitting
758    /// rays in very large batches can reduce the responsiveness of the system because the GPU
759    /// will be busy for long periods. Experiment to find a balance between raytracing throughput
760    /// and system responsiveness.
761    ///
762    /// - When possible, organize rays within a batch for spatial locality. Rays that originate
763    /// at nearby points or are oriented in similar directions tend to access the same
764    /// locations in memory and can therefore make more effective use of the GPU's caches.
765    /// For example, the camera rays associated with nearby pixels in the output image will likely
766    /// originate at the same point and travel in very similar directions. Therefore, divide the
767    /// output image into small tiles (e.g., 8x8). Rather than laying out all of the rays in the
768    /// ray buffer in scanline order, first lay out the ray in scanline order within each tile,
769    /// then lay out the tiles in scanline order or according to some space filling curve.
770    ///
771    /// - If CPU encode time is an issue, disable Metal API validation and enable
772    /// MPSKernelOptionsSkipAPIValidation.
773    ///
774    /// - Choose the minimal ray and intersection data types for your use case. Loading and storing
775    /// extra values such as ray masks or primitive indices can reduce raytracing performance, so
776    /// use a simpler data type if they are not needed. For example, camera rays typically have no
777    /// need for a maximum distance field, while shadow rays do.
778    ///
779    /// - Use MPSIntersectionTestTypeAny when possible: this is typically much faster than
780    /// MPSIntersectionTestTypeNearest and can be used when you only need to check for
781    /// binary visibility between two points such as shadow and ambient occlusion rays. Combine
782    /// this with MPSRayDataTypeDistance to minimize memory bandwidth usage.
783    ///
784    /// - Try to keep the geometry, textures, ray buffers, etc. within the Metal device's
785    /// recommended working set size. Paging data into GPU memory can significantly reduce
786    /// raytracing performance.
787    ///
788    /// - Changes to MPSRayIntersector properties can trigger internal pipeline compilations when
789    /// intersection tests are next encoded. If you need to avoid hitches due to pipeline
790    /// compilation, encode a small ray intersection with each raytracer configuration you will
791    /// use at encode-time. This creates and caches the corresponding pipelines.
792    ///
793    /// - Disable rays which should not participate in intersection testing. This can be done either
794    /// by compacting the ray buffer such that it only contains valid rays, or by setting fields
795    /// of the ray struct to invalid values. For example, setting the maximum distance to a
796    /// negative value, setting the mask to zero, setting the direction to the zero vector, etc.
797    /// In particular, rays should NOT be disabled using schemes such as moving their origin
798    /// outside the scene. These rays will still partially traverse the acceleration structure,
799    /// potentially evicting data from the cache which could have been used by valid rays. Note
800    /// that it is preferable to provide only valid rays so that threads are not left idle if
801    /// their rays are found to be invalid, but it can be convenient to disable rays in place in
802    /// the ray buffer.
803    ///
804    /// See MPSAccelerationStructure and MPSInstanceAccelerationStructure for more performance
805    /// guidelines.
806    ///
807    /// Thread Safety: MPSRayIntersectors are generally not thread safe: changing properties and encoding
808    /// intersection tests from multiple threads result in undefined behavior. Instead, multiple
809    /// threads should copy or create their own MPSRayIntersectors.
810    ///
811    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsrayintersector?language=objc)
812    #[unsafe(super(MPSKernel, NSObject))]
813    #[derive(Debug, PartialEq, Eq, Hash)]
814    #[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
815    #[deprecated]
816    pub struct MPSRayIntersector;
817);
818
819#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
820extern_conformance!(
821    unsafe impl NSCoding for MPSRayIntersector {}
822);
823
824#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
825extern_conformance!(
826    unsafe impl NSCopying for MPSRayIntersector {}
827);
828
829#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
830unsafe impl CopyingHelper for MPSRayIntersector {
831    type Result = Self;
832}
833
834#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
835extern_conformance!(
836    unsafe impl NSObjectProtocol for MPSRayIntersector {}
837);
838
839#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
840extern_conformance!(
841    unsafe impl NSSecureCoding for MPSRayIntersector {}
842);
843
844#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
845impl MPSRayIntersector {
846    extern_methods!(
847        /// Whether to ignore intersections between rays and back-facing or front-facing triangles
848        /// or quadrilaterals. Defaults to MTLCullModeNone.
849        ///
850        ///
851        /// A triangle or quadrilateral is back-facing if its normal points in the same
852        /// direction as a ray and front-facing if its normal points in the opposite direction as a ray. If
853        /// the cull mode is set to MTLCullModeBack, then back-facing triangles and quadrilaterals will be
854        /// ignored. If the cull mode is set to MTLCullModeFront, then front-facing triangles and
855        /// quadrilaterals will be ignored. Otherwise, if the cull mode is set to MTLCullModeNone, no
856        /// triangles or quadrilaterals will be ignored. The front and back faces can be swapped using the
857        /// frontFacingWinding property.
858        ///
859        /// Backface culling is necessary for some scenes but can reduce raytracing performance.
860        #[deprecated]
861        #[unsafe(method(cullMode))]
862        #[unsafe(method_family = none)]
863        pub unsafe fn cullMode(&self) -> MTLCullMode;
864
865        /// Setter for [`cullMode`][Self::cullMode].
866        #[deprecated]
867        #[unsafe(method(setCullMode:))]
868        #[unsafe(method_family = none)]
869        pub unsafe fn setCullMode(&self, cull_mode: MTLCullMode);
870
871        /// Winding order used to determine which direction a triangle or quadrilateral's normal
872        /// points when back face or front face culling is enabled. Defaults to MTLWindingClockwise.
873        ///
874        ///
875        /// If the front face winding is set to MTLWindingClockwise, the triangle or
876        /// quadrilateral normal is considered to point towards the direction where the vertices are in
877        /// clockwise order when viewed from that direction. Otherwise, if the front facing winding is set
878        /// to MTLWindingCounterClockwise, the triangle or quadrilateral normal is considered to point in
879        /// the opposite direction.
880        #[deprecated]
881        #[unsafe(method(frontFacingWinding))]
882        #[unsafe(method_family = none)]
883        pub unsafe fn frontFacingWinding(&self) -> MTLWinding;
884
885        /// Setter for [`frontFacingWinding`][Self::frontFacingWinding].
886        #[deprecated]
887        #[unsafe(method(setFrontFacingWinding:))]
888        #[unsafe(method_family = none)]
889        pub unsafe fn setFrontFacingWinding(&self, front_facing_winding: MTLWinding);
890
891        /// Ray/triangle intersection test type. Defaults to MPSTriangleIntersectionTestTypeDefault.
892        /// Quads are broken into two triangles for intersection testing, so this property also applies to
893        /// quadrilateral intersections.
894        #[deprecated]
895        #[unsafe(method(triangleIntersectionTestType))]
896        #[unsafe(method_family = none)]
897        pub unsafe fn triangleIntersectionTestType(&self) -> MPSTriangleIntersectionTestType;
898
899        /// Setter for [`triangleIntersectionTestType`][Self::triangleIntersectionTestType].
900        #[deprecated]
901        #[unsafe(method(setTriangleIntersectionTestType:))]
902        #[unsafe(method_family = none)]
903        pub unsafe fn setTriangleIntersectionTestType(
904            &self,
905            triangle_intersection_test_type: MPSTriangleIntersectionTestType,
906        );
907
908        /// Ray/bounding box intersection test type. Defaults to
909        /// MPSBoundingBoxIntersectionTestTypeDefault.
910        #[deprecated]
911        #[unsafe(method(boundingBoxIntersectionTestType))]
912        #[unsafe(method_family = none)]
913        pub unsafe fn boundingBoxIntersectionTestType(&self) -> MPSBoundingBoxIntersectionTestType;
914
915        /// Setter for [`boundingBoxIntersectionTestType`][Self::boundingBoxIntersectionTestType].
916        #[deprecated]
917        #[unsafe(method(setBoundingBoxIntersectionTestType:))]
918        #[unsafe(method_family = none)]
919        pub unsafe fn setBoundingBoxIntersectionTestType(
920            &self,
921            bounding_box_intersection_test_type: MPSBoundingBoxIntersectionTestType,
922        );
923
924        /// Whether to enable primitive and instance masks. Defaults to MPSRayMaskOptionNone.
925        ///
926        ///
927        /// If MPSRayMaskOptionPrimitive or MPSRayMaskOptionInstance is enabled, each ray and
928        /// primitive and/or instance is associated with a 32 bit unsigned integer mask. Before checking
929        /// for intersection between a ray and a primitive or instance, the corresponding masks are
930        /// compared using the ray mask operator defined by the rayMaskOperator property. If the result is
931        /// zero, the intersection is skipped.
932        ///
933        /// This can be used to make certain primitives or instances invisible to certain rays. For example,
934        /// objects can be grouped into layers and their visibility can be toggled by modifying the ray
935        /// masks rather than removing the objects from the scene and rebuilding the acceleration structure.
936        /// Alternatively, certain objects can be prevented from casting shadows by making them invisible to
937        /// shadow rays.
938        ///
939        /// Enabling this option may reduce raytracing performance.
940        #[deprecated]
941        #[unsafe(method(rayMaskOptions))]
942        #[unsafe(method_family = none)]
943        pub unsafe fn rayMaskOptions(&self) -> MPSRayMaskOptions;
944
945        /// Setter for [`rayMaskOptions`][Self::rayMaskOptions].
946        #[deprecated]
947        #[unsafe(method(setRayMaskOptions:))]
948        #[unsafe(method_family = none)]
949        pub unsafe fn setRayMaskOptions(&self, ray_mask_options: MPSRayMaskOptions);
950
951        /// The operator to apply to determine whether to accept an intersection between a ray and a
952        /// primitive or instance. Defaults to MPSRayMaskOperatorAnd.
953        #[deprecated]
954        #[unsafe(method(rayMaskOperator))]
955        #[unsafe(method_family = none)]
956        pub unsafe fn rayMaskOperator(&self) -> MPSRayMaskOperator;
957
958        /// Setter for [`rayMaskOperator`][Self::rayMaskOperator].
959        #[deprecated]
960        #[unsafe(method(setRayMaskOperator:))]
961        #[unsafe(method_family = none)]
962        pub unsafe fn setRayMaskOperator(&self, ray_mask_operator: MPSRayMaskOperator);
963
964        /// Offset, in bytes, between consecutive rays in the ray buffer. Defaults to 0, indicating
965        /// that the rays are packed according to their natural aligned size.
966        ///
967        ///
968        /// This can be used to skip past any additional per-ray data that may be stored
969        /// alongside the MPSRay struct such as the current radiance along the ray or the source pixel
970        /// coordinates. Must be aligned to the alignment of the ray data type.
971        #[deprecated]
972        #[unsafe(method(rayStride))]
973        #[unsafe(method_family = none)]
974        pub unsafe fn rayStride(&self) -> NSUInteger;
975
976        /// Setter for [`rayStride`][Self::rayStride].
977        #[deprecated]
978        #[unsafe(method(setRayStride:))]
979        #[unsafe(method_family = none)]
980        pub unsafe fn setRayStride(&self, ray_stride: NSUInteger);
981
982        /// Offset, in bytes, between consecutive intersections in the intersection buffer. Defaults
983        /// to 0, indicating that the intersections are packed according to their natural aligned size.
984        ///
985        ///
986        /// This can be used to skip past any additional per-intersection that which may be
987        /// stored alongside the MPSRayIntersection struct such as the surface normal at the point
988        /// of intersection. Must be aligned to the alignment of the intersection data type.
989        #[deprecated]
990        #[unsafe(method(intersectionStride))]
991        #[unsafe(method_family = none)]
992        pub unsafe fn intersectionStride(&self) -> NSUInteger;
993
994        /// Setter for [`intersectionStride`][Self::intersectionStride].
995        #[deprecated]
996        #[unsafe(method(setIntersectionStride:))]
997        #[unsafe(method_family = none)]
998        pub unsafe fn setIntersectionStride(&self, intersection_stride: NSUInteger);
999
1000        /// Ray data type. Defaults to MPSRayDataTypeOriginDirection.
1001        #[deprecated]
1002        #[unsafe(method(rayDataType))]
1003        #[unsafe(method_family = none)]
1004        pub unsafe fn rayDataType(&self) -> MPSRayDataType;
1005
1006        /// Setter for [`rayDataType`][Self::rayDataType].
1007        #[deprecated]
1008        #[unsafe(method(setRayDataType:))]
1009        #[unsafe(method_family = none)]
1010        pub unsafe fn setRayDataType(&self, ray_data_type: MPSRayDataType);
1011
1012        /// Intersection data type. Defaults to
1013        /// MPSIntersectionDataTypeDistancePrimitiveIndexCoordinates.
1014        #[deprecated]
1015        #[unsafe(method(intersectionDataType))]
1016        #[unsafe(method_family = none)]
1017        pub unsafe fn intersectionDataType(&self) -> MPSIntersectionDataType;
1018
1019        /// Setter for [`intersectionDataType`][Self::intersectionDataType].
1020        #[deprecated]
1021        #[unsafe(method(setIntersectionDataType:))]
1022        #[unsafe(method_family = none)]
1023        pub unsafe fn setIntersectionDataType(
1024            &self,
1025            intersection_data_type: MPSIntersectionDataType,
1026        );
1027
1028        #[cfg(feature = "MPSCoreTypes")]
1029        /// Ray index data type. Defaults to MPSDataTypeUInt32. Only MPSDataTypeUInt16 and
1030        /// MPSDataTypeUInt32 are supported.
1031        #[deprecated]
1032        #[unsafe(method(rayIndexDataType))]
1033        #[unsafe(method_family = none)]
1034        pub unsafe fn rayIndexDataType(&self) -> MPSDataType;
1035
1036        #[cfg(feature = "MPSCoreTypes")]
1037        /// Setter for [`rayIndexDataType`][Self::rayIndexDataType].
1038        #[deprecated]
1039        #[unsafe(method(setRayIndexDataType:))]
1040        #[unsafe(method_family = none)]
1041        pub unsafe fn setRayIndexDataType(&self, ray_index_data_type: MPSDataType);
1042
1043        /// Global ray mask. Defaults to 0xFFFFFFFF. This value will be logically AND-ed with the
1044        /// per-ray mask if the ray data type contains a mask.
1045        #[deprecated]
1046        #[unsafe(method(rayMask))]
1047        #[unsafe(method_family = none)]
1048        pub unsafe fn rayMask(&self) -> c_uint;
1049
1050        /// Setter for [`rayMask`][Self::rayMask].
1051        #[deprecated]
1052        #[unsafe(method(setRayMask:))]
1053        #[unsafe(method_family = none)]
1054        pub unsafe fn setRayMask(&self, ray_mask: c_uint);
1055
1056        #[deprecated]
1057        #[unsafe(method(init))]
1058        #[unsafe(method_family = init)]
1059        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1060
1061        /// Initialize the raytracer with a Metal device
1062        #[deprecated]
1063        #[unsafe(method(initWithDevice:))]
1064        #[unsafe(method_family = init)]
1065        pub unsafe fn initWithDevice(
1066            this: Allocated<Self>,
1067            device: &ProtocolObject<dyn MTLDevice>,
1068        ) -> Retained<Self>;
1069
1070        /// Initialize the raytracer with an NSCoder and a Metal device
1071        ///
1072        /// # Safety
1073        ///
1074        /// `a_decoder` possibly has further requirements.
1075        #[deprecated]
1076        #[unsafe(method(initWithCoder:device:))]
1077        #[unsafe(method_family = init)]
1078        pub unsafe fn initWithCoder_device(
1079            this: Allocated<Self>,
1080            a_decoder: &NSCoder,
1081            device: &ProtocolObject<dyn MTLDevice>,
1082        ) -> Option<Retained<Self>>;
1083
1084        /// Copy the raytracer with a Metal device
1085        ///
1086        ///
1087        /// Parameter `zone`: The NSZone in which to allocate the object
1088        ///
1089        /// Parameter `device`: The Metal device for the new MPSRayIntersector
1090        ///
1091        ///
1092        /// Returns: A pointer to a copy of this MPSRayIntersector
1093        ///
1094        /// # Safety
1095        ///
1096        /// `zone` must be a valid pointer or null.
1097        #[deprecated]
1098        #[unsafe(method(copyWithZone:device:))]
1099        #[unsafe(method_family = copy)]
1100        pub unsafe fn copyWithZone_device(
1101            &self,
1102            zone: *mut NSZone,
1103            device: Option<&ProtocolObject<dyn MTLDevice>>,
1104        ) -> Retained<Self>;
1105
1106        /// Get the recommended minimum number of rays to submit for intersection in one batch
1107        ///
1108        ///
1109        /// In order to keep the system responsive, and to limit the amount of memory allocated
1110        /// to ray and intersection buffers, it may be desirable to divide the rays to be intersected
1111        /// against an acceleration structure into smaller batches. However, submitting too few rays in a
1112        /// batch reduces GPU utilization and performance. This method provides a recommended minimum
1113        /// number of rays to submit in any given batch. For example, for a 1920x1080 image, this method may
1114        /// recommend that the image be divided into 512x512 tiles. The actual recommendation varies per
1115        /// device and total ray count.
1116        ///
1117        ///
1118        /// Parameter `rayCount`: The total number of rays to be submitted
1119        ///
1120        ///
1121        /// Returns: The recommended minimum ray batch size
1122        #[deprecated]
1123        #[unsafe(method(recommendedMinimumRayBatchSizeForRayCount:))]
1124        #[unsafe(method_family = none)]
1125        pub unsafe fn recommendedMinimumRayBatchSizeForRayCount(
1126            &self,
1127            ray_count: NSUInteger,
1128        ) -> NSUInteger;
1129
1130        /// # Safety
1131        ///
1132        /// `coder` possibly has further requirements.
1133        #[deprecated]
1134        #[unsafe(method(encodeWithCoder:))]
1135        #[unsafe(method_family = none)]
1136        pub unsafe fn encodeWithCoder(&self, coder: &NSCoder);
1137
1138        #[cfg(feature = "MPSAccelerationStructure")]
1139        /// Schedule intersection tests between rays and an acceleration structure
1140        ///
1141        ///
1142        /// Parameter `commandBuffer`: Command buffer to schedule intersection testing in
1143        ///
1144        /// Parameter `intersectionType`: Which type of intersection to test for
1145        ///
1146        /// Parameter `rayBuffer`: Buffer containing rays to intersect against the acceleration
1147        /// structure. The ray data type is defined by the rayDataType
1148        /// and rayStride properties.
1149        ///
1150        /// Parameter `rayBufferOffset`: Offset, in bytes, into the ray buffer. Must be a multiple of
1151        /// the ray stride.
1152        ///
1153        /// Parameter `intersectionBuffer`: Buffer to store intersection in. Intersections are stored in
1154        /// the same order as the ray buffer, one intersection per ray.
1155        /// The intersection data type is defined by the
1156        /// intersectionDataType and intersectionStride properties.
1157        ///
1158        /// Parameter `intersectionBufferOffset`: Offset, in bytes, into the intersection buffer. Must be a
1159        /// multiple of the intersection stride.
1160        ///
1161        /// Parameter `rayCount`: Number of rays
1162        ///
1163        /// Parameter `accelerationStructure`: Acceleration structure to test against
1164        ///
1165        /// # Safety
1166        ///
1167        /// - `ray_buffer` may need to be synchronized.
1168        /// - `ray_buffer` may be unretained, you must ensure it is kept alive while in use.
1169        /// - `ray_buffer` contents should be of the correct type.
1170        /// - `intersection_buffer` may need to be synchronized.
1171        /// - `intersection_buffer` may be unretained, you must ensure it is kept alive while in use.
1172        /// - `intersection_buffer` contents should be of the correct type.
1173        #[deprecated]
1174        #[unsafe(method(encodeIntersectionToCommandBuffer:intersectionType:rayBuffer:rayBufferOffset:intersectionBuffer:intersectionBufferOffset:rayCount:accelerationStructure:))]
1175        #[unsafe(method_family = none)]
1176        pub unsafe fn encodeIntersectionToCommandBuffer_intersectionType_rayBuffer_rayBufferOffset_intersectionBuffer_intersectionBufferOffset_rayCount_accelerationStructure(
1177            &self,
1178            command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
1179            intersection_type: MPSIntersectionType,
1180            ray_buffer: &ProtocolObject<dyn MTLBuffer>,
1181            ray_buffer_offset: NSUInteger,
1182            intersection_buffer: &ProtocolObject<dyn MTLBuffer>,
1183            intersection_buffer_offset: NSUInteger,
1184            ray_count: NSUInteger,
1185            acceleration_structure: &MPSAccelerationStructure,
1186        );
1187
1188        #[cfg(feature = "MPSAccelerationStructure")]
1189        /// Schedule intersection tests between rays and an acceleration structure with a ray count
1190        /// provided in a buffer
1191        ///
1192        ///
1193        /// Parameter `commandBuffer`: Command buffer to schedule intersection testing in
1194        ///
1195        /// Parameter `intersectionType`: Which type of intersection to test for
1196        ///
1197        /// Parameter `rayBuffer`: Buffer containing rays to intersect against the acceleration
1198        /// structure. The ray data type is defined by the rayDataType
1199        /// and rayStride properties.
1200        ///
1201        /// Parameter `rayBufferOffset`: Offset, in bytes, into the ray buffer. Must be a multiple of
1202        /// the ray stride.
1203        ///
1204        /// Parameter `intersectionBuffer`: Buffer to store intersection in. Intersections are stored in
1205        /// the same order as the ray buffer, one intersection per ray.
1206        /// The intersection data type is defined by the
1207        /// intersectionDataType and intersectionStride properties.
1208        ///
1209        /// Parameter `intersectionBufferOffset`: Offset, in bytes, into the intersection buffer. Must be a
1210        /// multiple of the intersection stride.
1211        ///
1212        /// Parameter `rayCountBuffer`: Buffer containing number of rays as a 32 bit unsigned integer
1213        ///
1214        /// Parameter `rayCountBufferOffset`: Offset, in bytes, into the ray count buffer. Must be a multiple
1215        /// of 4 bytes.
1216        ///
1217        /// Parameter `accelerationStructure`: Acceleration structure to test against
1218        ///
1219        /// # Safety
1220        ///
1221        /// - `ray_buffer` may need to be synchronized.
1222        /// - `ray_buffer` may be unretained, you must ensure it is kept alive while in use.
1223        /// - `ray_buffer` contents should be of the correct type.
1224        /// - `intersection_buffer` may need to be synchronized.
1225        /// - `intersection_buffer` may be unretained, you must ensure it is kept alive while in use.
1226        /// - `intersection_buffer` contents should be of the correct type.
1227        /// - `ray_count_buffer` may need to be synchronized.
1228        /// - `ray_count_buffer` may be unretained, you must ensure it is kept alive while in use.
1229        /// - `ray_count_buffer` contents should be of the correct type.
1230        #[deprecated]
1231        #[unsafe(method(encodeIntersectionToCommandBuffer:intersectionType:rayBuffer:rayBufferOffset:intersectionBuffer:intersectionBufferOffset:rayCountBuffer:rayCountBufferOffset:accelerationStructure:))]
1232        #[unsafe(method_family = none)]
1233        pub unsafe fn encodeIntersectionToCommandBuffer_intersectionType_rayBuffer_rayBufferOffset_intersectionBuffer_intersectionBufferOffset_rayCountBuffer_rayCountBufferOffset_accelerationStructure(
1234            &self,
1235            command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
1236            intersection_type: MPSIntersectionType,
1237            ray_buffer: &ProtocolObject<dyn MTLBuffer>,
1238            ray_buffer_offset: NSUInteger,
1239            intersection_buffer: &ProtocolObject<dyn MTLBuffer>,
1240            intersection_buffer_offset: NSUInteger,
1241            ray_count_buffer: &ProtocolObject<dyn MTLBuffer>,
1242            ray_count_buffer_offset: NSUInteger,
1243            acceleration_structure: &MPSAccelerationStructure,
1244        );
1245
1246        #[cfg(feature = "MPSAccelerationStructure")]
1247        /// Schedule intersection tests between rays and an acceleration structure
1248        ///
1249        ///
1250        /// Parameter `commandBuffer`: Command buffer to schedule intersection testing in
1251        ///
1252        /// Parameter `intersectionType`: Which type of intersection to test for
1253        ///
1254        /// Parameter `rayBuffer`: Buffer containing rays to intersect against the acceleration
1255        /// structure. The ray data type is defined by the rayDataType
1256        /// and rayStride properties.
1257        ///
1258        /// Parameter `rayBufferOffset`: Offset, in bytes, into the ray buffer. Must be a multiple of
1259        /// the ray stride.
1260        ///
1261        /// Parameter `rayIndexBuffer`: Buffer containing ray indices. Each index references a ray in
1262        /// the ray buffer. The ray index data type is controlled by the
1263        /// rayIndexDataType property.
1264        ///
1265        /// Parameter `rayIndexBufferOffset`: Offset, in bytes, into the ray index buffer. Must be a multiple
1266        /// of the stride of the ray index type.
1267        ///
1268        /// Parameter `intersectionBuffer`: Buffer to store intersection in. Intersections are stored in
1269        /// the same order as the ray buffer, one intersection per ray.
1270        /// The intersection data type is defined by the
1271        /// intersectionDataType and intersectionStride properties.
1272        ///
1273        /// Parameter `intersectionBufferOffset`: Offset, in bytes, into the intersection buffer. Must be a
1274        /// multiple of the intersection stride.
1275        ///
1276        /// Parameter `rayIndexCount`: Number of ray indices
1277        ///
1278        /// Parameter `accelerationStructure`: Acceleration structure to test against
1279        ///
1280        /// # Safety
1281        ///
1282        /// - `ray_buffer` may need to be synchronized.
1283        /// - `ray_buffer` may be unretained, you must ensure it is kept alive while in use.
1284        /// - `ray_buffer` contents should be of the correct type.
1285        /// - `ray_index_buffer` may need to be synchronized.
1286        /// - `ray_index_buffer` may be unretained, you must ensure it is kept alive while in use.
1287        /// - `ray_index_buffer` contents should be of the correct type.
1288        /// - `intersection_buffer` may need to be synchronized.
1289        /// - `intersection_buffer` may be unretained, you must ensure it is kept alive while in use.
1290        /// - `intersection_buffer` contents should be of the correct type.
1291        #[deprecated]
1292        #[unsafe(method(encodeIntersectionToCommandBuffer:intersectionType:rayBuffer:rayBufferOffset:rayIndexBuffer:rayIndexBufferOffset:intersectionBuffer:intersectionBufferOffset:rayIndexCount:accelerationStructure:))]
1293        #[unsafe(method_family = none)]
1294        pub unsafe fn encodeIntersectionToCommandBuffer_intersectionType_rayBuffer_rayBufferOffset_rayIndexBuffer_rayIndexBufferOffset_intersectionBuffer_intersectionBufferOffset_rayIndexCount_accelerationStructure(
1295            &self,
1296            command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
1297            intersection_type: MPSIntersectionType,
1298            ray_buffer: &ProtocolObject<dyn MTLBuffer>,
1299            ray_buffer_offset: NSUInteger,
1300            ray_index_buffer: &ProtocolObject<dyn MTLBuffer>,
1301            ray_index_buffer_offset: NSUInteger,
1302            intersection_buffer: &ProtocolObject<dyn MTLBuffer>,
1303            intersection_buffer_offset: NSUInteger,
1304            ray_index_count: NSUInteger,
1305            acceleration_structure: &MPSAccelerationStructure,
1306        );
1307
1308        #[cfg(feature = "MPSAccelerationStructure")]
1309        /// Schedule intersection tests between rays and an acceleration structure with a ray count
1310        /// provided in a buffer
1311        ///
1312        ///
1313        /// Parameter `commandBuffer`: Command buffer to schedule intersection testing in
1314        ///
1315        /// Parameter `intersectionType`: Which type of intersection to test for
1316        ///
1317        /// Parameter `rayBuffer`: Buffer containing rays to intersect against the acceleration
1318        /// structure. The ray data type is defined by the rayDataType
1319        /// and rayStride properties.
1320        ///
1321        /// Parameter `rayBufferOffset`: Offset, in bytes, into the ray buffer. Must be a multiple of
1322        /// the ray stride.
1323        ///
1324        /// Parameter `rayIndexBuffer`: Buffer containing ray indices. Each index references a ray in
1325        /// the ray buffer. The ray index data type is controlled by the
1326        /// rayIndexDataType property.
1327        ///
1328        /// Parameter `rayIndexBufferOffset`: Offset, in bytes, into the ray index buffer. Must be a multiple
1329        /// of the stride of the ray index type.
1330        ///
1331        /// Parameter `intersectionBuffer`: Buffer to store intersection in. Intersections are stored in
1332        /// the same order as the ray buffer, one intersection per ray.
1333        /// The intersection data type is defined by the
1334        /// intersectionDataType and intersectionStride properties.
1335        ///
1336        /// Parameter `intersectionBufferOffset`: Offset, in bytes, into the intersection buffer. Must be a
1337        /// multiple of the intersection stride.
1338        ///
1339        /// Parameter `rayIndexCountBuffer`: Buffer containing number of rays as a 32 bit unsigned integer
1340        ///
1341        /// Parameter `rayIndexCountBufferOffset`: Offset, in bytes, into the ray count buffer. Must be a multiple
1342        /// of 4 bytes.
1343        ///
1344        /// Parameter `accelerationStructure`: Acceleration structure to test against
1345        ///
1346        /// # Safety
1347        ///
1348        /// - `ray_buffer` may need to be synchronized.
1349        /// - `ray_buffer` may be unretained, you must ensure it is kept alive while in use.
1350        /// - `ray_buffer` contents should be of the correct type.
1351        /// - `ray_index_buffer` may need to be synchronized.
1352        /// - `ray_index_buffer` may be unretained, you must ensure it is kept alive while in use.
1353        /// - `ray_index_buffer` contents should be of the correct type.
1354        /// - `intersection_buffer` may need to be synchronized.
1355        /// - `intersection_buffer` may be unretained, you must ensure it is kept alive while in use.
1356        /// - `intersection_buffer` contents should be of the correct type.
1357        /// - `ray_index_count_buffer` may need to be synchronized.
1358        /// - `ray_index_count_buffer` may be unretained, you must ensure it is kept alive while in use.
1359        /// - `ray_index_count_buffer` contents should be of the correct type.
1360        #[deprecated]
1361        #[unsafe(method(encodeIntersectionToCommandBuffer:intersectionType:rayBuffer:rayBufferOffset:rayIndexBuffer:rayIndexBufferOffset:intersectionBuffer:intersectionBufferOffset:rayIndexCountBuffer:rayIndexCountBufferOffset:accelerationStructure:))]
1362        #[unsafe(method_family = none)]
1363        pub unsafe fn encodeIntersectionToCommandBuffer_intersectionType_rayBuffer_rayBufferOffset_rayIndexBuffer_rayIndexBufferOffset_intersectionBuffer_intersectionBufferOffset_rayIndexCountBuffer_rayIndexCountBufferOffset_accelerationStructure(
1364            &self,
1365            command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
1366            intersection_type: MPSIntersectionType,
1367            ray_buffer: &ProtocolObject<dyn MTLBuffer>,
1368            ray_buffer_offset: NSUInteger,
1369            ray_index_buffer: &ProtocolObject<dyn MTLBuffer>,
1370            ray_index_buffer_offset: NSUInteger,
1371            intersection_buffer: &ProtocolObject<dyn MTLBuffer>,
1372            intersection_buffer_offset: NSUInteger,
1373            ray_index_count_buffer: &ProtocolObject<dyn MTLBuffer>,
1374            ray_index_count_buffer_offset: NSUInteger,
1375            acceleration_structure: &MPSAccelerationStructure,
1376        );
1377
1378        #[cfg(feature = "MPSAccelerationStructure")]
1379        /// Schedule intersection tests between rays and an acceleration structure, where rays and
1380        /// loaded from a texture and intersections are stored into a texture.
1381        ///
1382        /// This is convenient for hybrid rendering applications which produce ray data from a fragment
1383        /// shader. The ray and intersection texture must be 2D array textures. Ray data must be packed into
1384        /// consecutive channels and slices of the ray texture. Intersection data will be packed the same
1385        /// way. The ray and intersection data types are defined by the rayDataType and intersectionDataType
1386        /// properties. The rayStride and intersectionStride properties are ignored. Channels and slices
1387        /// beyond the required number are ignored when reading from the ray texture. Channels and slices
1388        /// beyond the required number are undefined when writing to the intersection texture.
1389        ///
1390        /// For example, if the ray data type is MPSRayDataTypeOriginMaskDirectionMaxDistance, the ray
1391        /// texture must have pixel format MTLPixelFormatRGBA32Float and at least two array slices, packed
1392        /// as follows:
1393        ///
1394        ///
1395        /// ```text
1396        ///      tex.write(float4(ray.position, as_type<float>(ray.mask)), pixel, 0); // slice 0
1397        ///      tex.write(float4(ray.direction, ray.maxDistance), pixel, 1);         // slice 1
1398        ///      @end
1399        ///
1400        ///  If the intersection data type is MPSIntersectionDataTypeDistance, the intersection texture may
1401        ///  have pixel format MTLPixelFormatR32Float with just a single channel and one array slice, and
1402        ///  should be unpacked as follows:
1403        ///
1404        ///      @code
1405        ///      float distance = tex.read(pixel, 0).x;
1406        ///      @end
1407        ///
1408        ///  On the other hand, if the intersection data type is
1409        ///  MPSIntersectionDistancePrimitiveIndexInstanceIndexCoordinates, the intersection texture must
1410        ///  have pixel format MTLPixelFormatRGBA32Float and at least two slices:
1411        ///
1412        ///      @code
1413        ///      float3 f0 = tex.read(pixel, 0);
1414        ///
1415        ///      float distance = f0.x;
1416        ///      unsigned int primitiveIndex = as_type<unsigned int>(f0.y);
1417        ///      unsigned int instanceIndex = as_type<unsigned int>(f0.z);
1418        ///      // w component is padding for this intersection data type
1419        ///
1420        ///      float2 coordinates = tex.read(pixel, 1).xy;
1421        ///      @end
1422        ///
1423        ///  @param commandBuffer            Command buffer to schedule intersection testing in
1424        ///  @param intersectionType         Which type of intersection to test for
1425        ///  @param rayTexture               A 2D array texture containing rays to intersect against the
1426        ///                                  acceleration structure. The ray data type is defined by the
1427        ///                                  rayDataType property.
1428        ///  @param intersectionTexture      Texture to store intersection in. Intersections are stored in
1429        ///                                  the same position as the ray texture, one intersection per ray.
1430        ///                                  The intersection data type is defined by the
1431        ///                                  intersectionDataType property.
1432        ///  @param accelerationStructure    Acceleration structure to test against
1433        ///  
1434        ///
1435        /// ```
1436        ///
1437        /// # Safety
1438        ///
1439        /// - `ray_texture` may need to be synchronized.
1440        /// - `ray_texture` may be unretained, you must ensure it is kept alive while in use.
1441        /// - `intersection_texture` may need to be synchronized.
1442        /// - `intersection_texture` may be unretained, you must ensure it is kept alive while in use.
1443        #[deprecated]
1444        #[unsafe(method(encodeIntersectionToCommandBuffer:intersectionType:rayTexture:intersectionTexture:accelerationStructure:))]
1445        #[unsafe(method_family = none)]
1446        pub unsafe fn encodeIntersectionToCommandBuffer_intersectionType_rayTexture_intersectionTexture_accelerationStructure(
1447            &self,
1448            command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
1449            intersection_type: MPSIntersectionType,
1450            ray_texture: &ProtocolObject<dyn MTLTexture>,
1451            intersection_texture: &ProtocolObject<dyn MTLTexture>,
1452            acceleration_structure: &MPSAccelerationStructure,
1453        );
1454    );
1455}
1456
1457/// Methods declared on superclass `MPSKernel`.
1458#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
1459impl MPSRayIntersector {
1460    extern_methods!(
1461        /// Called by NSCoder to decode MPSKernels
1462        ///
1463        /// This isn't the right interface to decode a MPSKernel, but
1464        /// it is the one that NSCoder uses. To enable your NSCoder
1465        /// (e.g. NSKeyedUnarchiver) to set which device to use
1466        /// extend the object to adopt the MPSDeviceProvider
1467        /// protocol. Otherwise, the Metal system default device
1468        /// will be used.
1469        ///
1470        /// # Safety
1471        ///
1472        /// `a_decoder` possibly has further requirements.
1473        #[unsafe(method(initWithCoder:))]
1474        #[unsafe(method_family = init)]
1475        pub unsafe fn initWithCoder(
1476            this: Allocated<Self>,
1477            a_decoder: &NSCoder,
1478        ) -> Option<Retained<Self>>;
1479    );
1480}
1481
1482/// Methods declared on superclass `NSObject`.
1483#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
1484impl MPSRayIntersector {
1485    extern_methods!(
1486        #[unsafe(method(new))]
1487        #[unsafe(method_family = new)]
1488        pub unsafe fn new() -> Retained<Self>;
1489    );
1490}