objc2_metal/generated/MTL4AccelerationStructure.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 /// Base class for Metal 4 acceleration structure descriptors.
12 ///
13 /// Don't use this class directly. Use one of its subclasses instead.
14 ///
15 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4accelerationstructuredescriptor?language=objc)
16 #[unsafe(super(MTLAccelerationStructureDescriptor, NSObject))]
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 #[cfg(feature = "MTLAccelerationStructure")]
19 pub struct MTL4AccelerationStructureDescriptor;
20);
21
22#[cfg(feature = "MTLAccelerationStructure")]
23extern_conformance!(
24 unsafe impl NSCopying for MTL4AccelerationStructureDescriptor {}
25);
26
27#[cfg(feature = "MTLAccelerationStructure")]
28unsafe impl CopyingHelper for MTL4AccelerationStructureDescriptor {
29 type Result = Self;
30}
31
32#[cfg(feature = "MTLAccelerationStructure")]
33extern_conformance!(
34 unsafe impl NSObjectProtocol for MTL4AccelerationStructureDescriptor {}
35);
36
37#[cfg(feature = "MTLAccelerationStructure")]
38impl MTL4AccelerationStructureDescriptor {
39 extern_methods!();
40}
41
42/// Methods declared on superclass `NSObject`.
43#[cfg(feature = "MTLAccelerationStructure")]
44impl MTL4AccelerationStructureDescriptor {
45 extern_methods!(
46 #[unsafe(method(init))]
47 #[unsafe(method_family = init)]
48 pub fn init(this: Allocated<Self>) -> Retained<Self>;
49
50 #[unsafe(method(new))]
51 #[unsafe(method_family = new)]
52 pub fn new() -> Retained<Self>;
53 );
54}
55
56#[cfg(feature = "MTLAccelerationStructure")]
57impl DefaultRetained for MTL4AccelerationStructureDescriptor {
58 #[inline]
59 fn default_retained() -> Retained<Self> {
60 Self::new()
61 }
62}
63
64extern_class!(
65 /// Base class for all Metal 4 acceleration structure geometry descriptors.
66 ///
67 /// Don't use this class directly. Use one of the derived classes instead.
68 ///
69 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4accelerationstructuregeometrydescriptor?language=objc)
70 #[unsafe(super(NSObject))]
71 #[derive(Debug, PartialEq, Eq, Hash)]
72 pub struct MTL4AccelerationStructureGeometryDescriptor;
73);
74
75extern_conformance!(
76 unsafe impl NSCopying for MTL4AccelerationStructureGeometryDescriptor {}
77);
78
79unsafe impl CopyingHelper for MTL4AccelerationStructureGeometryDescriptor {
80 type Result = Self;
81}
82
83extern_conformance!(
84 unsafe impl NSObjectProtocol for MTL4AccelerationStructureGeometryDescriptor {}
85);
86
87impl MTL4AccelerationStructureGeometryDescriptor {
88 extern_methods!(
89 /// Sets the offset that this geometry contributes to determining the intersection function to invoke when a ray intersects it.
90 ///
91 /// When you perform a ray tracing operation in the Metal Shading Language, and provide the ray intersector object
92 /// with an instance of ``MTLIntersectionFunctionTable``, Metal adds this offset to the instance offset from structs such
93 /// as:
94 ///
95 /// - ``MTLAccelerationStructureInstanceDescriptor``
96 /// - ``MTLAccelerationStructureUserIDInstanceDescriptor``
97 /// - ``MTLAccelerationStructureMotionInstanceDescriptor``
98 /// - ``MTLIndirectAccelerationStructureInstanceDescriptor``
99 /// - ``MTLIndirectAccelerationStructureMotionInstanceDescriptor``
100 ///
101 /// The sum of these offsets provides an index into the intersection function table that the ray tracing system uses
102 /// to retrieve and invoke the function at this index, allowing you to customize the intersection evaluation process.
103 #[unsafe(method(intersectionFunctionTableOffset))]
104 #[unsafe(method_family = none)]
105 pub fn intersectionFunctionTableOffset(&self) -> NSUInteger;
106
107 /// Setter for [`intersectionFunctionTableOffset`][Self::intersectionFunctionTableOffset].
108 ///
109 /// # Safety
110 ///
111 /// This might not be bounds-checked.
112 #[unsafe(method(setIntersectionFunctionTableOffset:))]
113 #[unsafe(method_family = none)]
114 pub unsafe fn setIntersectionFunctionTableOffset(
115 &self,
116 intersection_function_table_offset: NSUInteger,
117 );
118
119 /// Provides a hint to Metal that this geometry is opaque, potentially accelerating the ray/primitive intersection process.
120 #[unsafe(method(opaque))]
121 #[unsafe(method_family = none)]
122 pub fn opaque(&self) -> bool;
123
124 /// Setter for [`opaque`][Self::opaque].
125 #[unsafe(method(setOpaque:))]
126 #[unsafe(method_family = none)]
127 pub fn setOpaque(&self, opaque: bool);
128
129 /// A boolean value that indicates whether the ray-tracing system in Metal allows the invocation of intersection functions
130 /// more than once per ray-primitive intersection.
131 ///
132 /// The property's default value is
133 /// <doc
134 /// ://com.apple.documentation/documentation/swift/true>.
135 #[unsafe(method(allowDuplicateIntersectionFunctionInvocation))]
136 #[unsafe(method_family = none)]
137 pub fn allowDuplicateIntersectionFunctionInvocation(&self) -> bool;
138
139 /// Setter for [`allowDuplicateIntersectionFunctionInvocation`][Self::allowDuplicateIntersectionFunctionInvocation].
140 #[unsafe(method(setAllowDuplicateIntersectionFunctionInvocation:))]
141 #[unsafe(method_family = none)]
142 pub fn setAllowDuplicateIntersectionFunctionInvocation(
143 &self,
144 allow_duplicate_intersection_function_invocation: bool,
145 );
146
147 /// Assigns an optional label you can assign to this geometry for debugging purposes.
148 #[unsafe(method(label))]
149 #[unsafe(method_family = none)]
150 pub fn label(&self) -> Option<Retained<NSString>>;
151
152 /// Setter for [`label`][Self::label].
153 ///
154 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
155 #[unsafe(method(setLabel:))]
156 #[unsafe(method_family = none)]
157 pub fn setLabel(&self, label: Option<&NSString>);
158
159 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
160 /// Assigns optional buffer containing data to associate with each primitive in this geometry.
161 ///
162 /// You can use zero as the buffer address in this buffer range.
163 #[unsafe(method(primitiveDataBuffer))]
164 #[unsafe(method_family = none)]
165 pub fn primitiveDataBuffer(&self) -> MTL4BufferRange;
166
167 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
168 /// Setter for [`primitiveDataBuffer`][Self::primitiveDataBuffer].
169 #[unsafe(method(setPrimitiveDataBuffer:))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn setPrimitiveDataBuffer(&self, primitive_data_buffer: MTL4BufferRange);
172
173 /// Defines the stride, in bytes, between each primitive's data in the primitive data buffer ``primitiveDataBuffer`` references.
174 ///
175 /// You are responsible for ensuring the stride is at least ``primitiveDataElementSize`` in size and a multiple of 4 bytes.
176 ///
177 /// This property defaults to `0` bytes, which indicates the stride is equal to ``primitiveDataElementSize``.
178 #[unsafe(method(primitiveDataStride))]
179 #[unsafe(method_family = none)]
180 pub fn primitiveDataStride(&self) -> NSUInteger;
181
182 /// Setter for [`primitiveDataStride`][Self::primitiveDataStride].
183 ///
184 /// # Safety
185 ///
186 /// This might not be bounds-checked.
187 #[unsafe(method(setPrimitiveDataStride:))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn setPrimitiveDataStride(&self, primitive_data_stride: NSUInteger);
190
191 /// Sets the size, in bytes, of the data for each primitive in the primitive data buffer ``primitiveDataBuffer`` references.
192 ///
193 /// This size needs to be at most ``primitiveDataStride`` in size and a multiple of 4 bytes.
194 ///
195 /// This property defaults to 0 bytes.
196 #[unsafe(method(primitiveDataElementSize))]
197 #[unsafe(method_family = none)]
198 pub fn primitiveDataElementSize(&self) -> NSUInteger;
199
200 /// Setter for [`primitiveDataElementSize`][Self::primitiveDataElementSize].
201 ///
202 /// # Safety
203 ///
204 /// This might not be bounds-checked.
205 #[unsafe(method(setPrimitiveDataElementSize:))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn setPrimitiveDataElementSize(&self, primitive_data_element_size: NSUInteger);
208 );
209}
210
211/// Methods declared on superclass `NSObject`.
212impl MTL4AccelerationStructureGeometryDescriptor {
213 extern_methods!(
214 #[unsafe(method(init))]
215 #[unsafe(method_family = init)]
216 pub fn init(this: Allocated<Self>) -> Retained<Self>;
217
218 #[unsafe(method(new))]
219 #[unsafe(method_family = new)]
220 pub fn new() -> Retained<Self>;
221 );
222}
223
224impl DefaultRetained for MTL4AccelerationStructureGeometryDescriptor {
225 #[inline]
226 fn default_retained() -> Retained<Self> {
227 Self::new()
228 }
229}
230
231extern_class!(
232 /// Descriptor for a primitive acceleration structure that directly references geometric shapes, such as triangles and
233 /// bounding boxes.
234 ///
235 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4primitiveaccelerationstructuredescriptor?language=objc)
236 #[unsafe(super(
237 MTL4AccelerationStructureDescriptor,
238 MTLAccelerationStructureDescriptor,
239 NSObject
240 ))]
241 #[derive(Debug, PartialEq, Eq, Hash)]
242 #[cfg(feature = "MTLAccelerationStructure")]
243 pub struct MTL4PrimitiveAccelerationStructureDescriptor;
244);
245
246#[cfg(feature = "MTLAccelerationStructure")]
247extern_conformance!(
248 unsafe impl NSCopying for MTL4PrimitiveAccelerationStructureDescriptor {}
249);
250
251#[cfg(feature = "MTLAccelerationStructure")]
252unsafe impl CopyingHelper for MTL4PrimitiveAccelerationStructureDescriptor {
253 type Result = Self;
254}
255
256#[cfg(feature = "MTLAccelerationStructure")]
257extern_conformance!(
258 unsafe impl NSObjectProtocol for MTL4PrimitiveAccelerationStructureDescriptor {}
259);
260
261#[cfg(feature = "MTLAccelerationStructure")]
262impl MTL4PrimitiveAccelerationStructureDescriptor {
263 extern_methods!(
264 /// Associates the array of geometry descriptors that comprise this primitive acceleration structure.
265 ///
266 /// If you enable keyframe motion by setting property ``motionKeyframeCount`` to a value greater than `1`, then
267 /// all geometry descriptors this array references need to be motion geometry descriptors and have a number of
268 /// primitive buffers equals to ``motionKeyframeCount``.
269 ///
270 /// Example of motion geometry descriptors include: ``MTL4AccelerationStructureMotionTriangleGeometryDescriptor``,
271 /// ``MTL4AccelerationStructureMotionBoundingBoxGeometryDescriptor``, ``MTL4AccelerationStructureMotionCurveGeometryDescriptor``.
272 #[unsafe(method(geometryDescriptors))]
273 #[unsafe(method_family = none)]
274 pub fn geometryDescriptors(
275 &self,
276 ) -> Option<Retained<NSArray<MTL4AccelerationStructureGeometryDescriptor>>>;
277
278 /// Setter for [`geometryDescriptors`][Self::geometryDescriptors].
279 #[unsafe(method(setGeometryDescriptors:))]
280 #[unsafe(method_family = none)]
281 pub fn setGeometryDescriptors(
282 &self,
283 geometry_descriptors: Option<&NSArray<MTL4AccelerationStructureGeometryDescriptor>>,
284 );
285
286 /// Configures the behavior when the ray-tracing system samples the acceleration structure before the motion start time.
287 ///
288 /// Use this property to control the behavior when the ray-tracing system samples the acceleration structure
289 /// at a time prior to the one you set for ``motionStartTime``.
290 ///
291 /// The default value of this property is `MTLMotionBorderModeClamp`.
292 #[unsafe(method(motionStartBorderMode))]
293 #[unsafe(method_family = none)]
294 pub fn motionStartBorderMode(&self) -> MTLMotionBorderMode;
295
296 /// Setter for [`motionStartBorderMode`][Self::motionStartBorderMode].
297 #[unsafe(method(setMotionStartBorderMode:))]
298 #[unsafe(method_family = none)]
299 pub fn setMotionStartBorderMode(&self, motion_start_border_mode: MTLMotionBorderMode);
300
301 /// Configures the motion border mode.
302 ///
303 /// This property controls what happens if Metal samples the acceleration structure after ``motionEndTime``.
304 ///
305 /// Its default value is `MTLMotionBorderModeClamp`.
306 #[unsafe(method(motionEndBorderMode))]
307 #[unsafe(method_family = none)]
308 pub fn motionEndBorderMode(&self) -> MTLMotionBorderMode;
309
310 /// Setter for [`motionEndBorderMode`][Self::motionEndBorderMode].
311 #[unsafe(method(setMotionEndBorderMode:))]
312 #[unsafe(method_family = none)]
313 pub fn setMotionEndBorderMode(&self, motion_end_border_mode: MTLMotionBorderMode);
314
315 /// Configures the motion start time for this geometry.
316 ///
317 /// The default value of this property is `0.0f`.
318 #[unsafe(method(motionStartTime))]
319 #[unsafe(method_family = none)]
320 pub fn motionStartTime(&self) -> c_float;
321
322 /// Setter for [`motionStartTime`][Self::motionStartTime].
323 #[unsafe(method(setMotionStartTime:))]
324 #[unsafe(method_family = none)]
325 pub fn setMotionStartTime(&self, motion_start_time: c_float);
326
327 /// Configures the motion end time for this geometry.
328 ///
329 /// The default value of this property is `1.0f`.
330 #[unsafe(method(motionEndTime))]
331 #[unsafe(method_family = none)]
332 pub fn motionEndTime(&self) -> c_float;
333
334 /// Setter for [`motionEndTime`][Self::motionEndTime].
335 #[unsafe(method(setMotionEndTime:))]
336 #[unsafe(method_family = none)]
337 pub fn setMotionEndTime(&self, motion_end_time: c_float);
338
339 /// Sets the motion keyframe count.
340 ///
341 /// This property's default is `1`, indicating no motion.
342 #[unsafe(method(motionKeyframeCount))]
343 #[unsafe(method_family = none)]
344 pub fn motionKeyframeCount(&self) -> NSUInteger;
345
346 /// Setter for [`motionKeyframeCount`][Self::motionKeyframeCount].
347 ///
348 /// # Safety
349 ///
350 /// This might not be bounds-checked.
351 #[unsafe(method(setMotionKeyframeCount:))]
352 #[unsafe(method_family = none)]
353 pub unsafe fn setMotionKeyframeCount(&self, motion_keyframe_count: NSUInteger);
354 );
355}
356
357/// Methods declared on superclass `NSObject`.
358#[cfg(feature = "MTLAccelerationStructure")]
359impl MTL4PrimitiveAccelerationStructureDescriptor {
360 extern_methods!(
361 #[unsafe(method(init))]
362 #[unsafe(method_family = init)]
363 pub fn init(this: Allocated<Self>) -> Retained<Self>;
364
365 #[unsafe(method(new))]
366 #[unsafe(method_family = new)]
367 pub fn new() -> Retained<Self>;
368 );
369}
370
371#[cfg(feature = "MTLAccelerationStructure")]
372impl DefaultRetained for MTL4PrimitiveAccelerationStructureDescriptor {
373 #[inline]
374 fn default_retained() -> Retained<Self> {
375 Self::new()
376 }
377}
378
379extern_class!(
380 /// Describes triangle geometry suitable for ray tracing.
381 ///
382 /// Use a ``MTLResidencySet`` to mark residency of all buffers this descriptor references when you build this
383 /// acceleration structure.
384 ///
385 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4accelerationstructuretrianglegeometrydescriptor?language=objc)
386 #[unsafe(super(MTL4AccelerationStructureGeometryDescriptor, NSObject))]
387 #[derive(Debug, PartialEq, Eq, Hash)]
388 pub struct MTL4AccelerationStructureTriangleGeometryDescriptor;
389);
390
391extern_conformance!(
392 unsafe impl NSCopying for MTL4AccelerationStructureTriangleGeometryDescriptor {}
393);
394
395unsafe impl CopyingHelper for MTL4AccelerationStructureTriangleGeometryDescriptor {
396 type Result = Self;
397}
398
399extern_conformance!(
400 unsafe impl NSObjectProtocol for MTL4AccelerationStructureTriangleGeometryDescriptor {}
401);
402
403impl MTL4AccelerationStructureTriangleGeometryDescriptor {
404 extern_methods!(
405 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
406 /// Associates a vertex buffer containing triangle vertices.
407 ///
408 /// You are responsible for ensuring that the format of all vertex positions match the ``vertexFormat`` property, and
409 /// that the buffer address for the buffer range is not zero.
410 #[unsafe(method(vertexBuffer))]
411 #[unsafe(method_family = none)]
412 pub fn vertexBuffer(&self) -> MTL4BufferRange;
413
414 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
415 /// Setter for [`vertexBuffer`][Self::vertexBuffer].
416 #[unsafe(method(setVertexBuffer:))]
417 #[unsafe(method_family = none)]
418 pub unsafe fn setVertexBuffer(&self, vertex_buffer: MTL4BufferRange);
419
420 #[cfg(feature = "MTLStageInputOutputDescriptor")]
421 /// Describes the format of the vertices in the vertex buffer.
422 ///
423 /// This property controls the format of the position attribute of the vertices the ``vertexBuffer`` references.
424 ///
425 /// The format defaults to `MTLAttributeFormatFloat3`, corresponding to three packed floating point numbers.
426 #[unsafe(method(vertexFormat))]
427 #[unsafe(method_family = none)]
428 pub fn vertexFormat(&self) -> MTLAttributeFormat;
429
430 #[cfg(feature = "MTLStageInputOutputDescriptor")]
431 /// Setter for [`vertexFormat`][Self::vertexFormat].
432 #[unsafe(method(setVertexFormat:))]
433 #[unsafe(method_family = none)]
434 pub fn setVertexFormat(&self, vertex_format: MTLAttributeFormat);
435
436 /// Sets the stride, in bytes, between vertices in the vertex buffer.
437 ///
438 /// The stride you specify needs to be a multiple of the size of the vertex format you provide in the ``vertexFormat``
439 /// property. Similarly, you are responsible for ensuring this stride matches the vertex format data type's alignment.
440 ///
441 /// Defaults to `0`, which signals the stride matches the size of the ``vertexFormat`` data.
442 #[unsafe(method(vertexStride))]
443 #[unsafe(method_family = none)]
444 pub fn vertexStride(&self) -> NSUInteger;
445
446 /// Setter for [`vertexStride`][Self::vertexStride].
447 ///
448 /// # Safety
449 ///
450 /// This might not be bounds-checked.
451 #[unsafe(method(setVertexStride:))]
452 #[unsafe(method_family = none)]
453 pub unsafe fn setVertexStride(&self, vertex_stride: NSUInteger);
454
455 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
456 /// Sets an optional index buffer containing references to vertices in the `vertexBuffer`.
457 ///
458 /// You can set this property to `0`, the default, to avoid specifying an index buffer.
459 #[unsafe(method(indexBuffer))]
460 #[unsafe(method_family = none)]
461 pub fn indexBuffer(&self) -> MTL4BufferRange;
462
463 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
464 /// Setter for [`indexBuffer`][Self::indexBuffer].
465 ///
466 /// # Safety
467 ///
468 /// This might not be bounds-checked.
469 #[unsafe(method(setIndexBuffer:))]
470 #[unsafe(method_family = none)]
471 pub unsafe fn setIndexBuffer(&self, index_buffer: MTL4BufferRange);
472
473 #[cfg(feature = "MTLArgument")]
474 /// Configures the size of the indices the `indexBuffer` contains, which is typically either 16 or 32-bits for each index.
475 #[unsafe(method(indexType))]
476 #[unsafe(method_family = none)]
477 pub fn indexType(&self) -> MTLIndexType;
478
479 #[cfg(feature = "MTLArgument")]
480 /// Setter for [`indexType`][Self::indexType].
481 #[unsafe(method(setIndexType:))]
482 #[unsafe(method_family = none)]
483 pub fn setIndexType(&self, index_type: MTLIndexType);
484
485 /// Declares the number of triangles in this geometry descriptor.
486 #[unsafe(method(triangleCount))]
487 #[unsafe(method_family = none)]
488 pub fn triangleCount(&self) -> NSUInteger;
489
490 /// Setter for [`triangleCount`][Self::triangleCount].
491 ///
492 /// # Safety
493 ///
494 /// This might not be bounds-checked.
495 #[unsafe(method(setTriangleCount:))]
496 #[unsafe(method_family = none)]
497 pub unsafe fn setTriangleCount(&self, triangle_count: NSUInteger);
498
499 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
500 /// Assigns an optional reference to a buffer containing a `float4x3` transformation matrix.
501 ///
502 /// When the buffer address is non-zero, Metal applies this transform to the vertex data positions when building
503 /// the acceleration structure.
504 ///
505 /// Building an acceleration structure with a descriptor that specifies this property doesn't modify the contents of
506 /// the input `vertexBuffer`.
507 #[unsafe(method(transformationMatrixBuffer))]
508 #[unsafe(method_family = none)]
509 pub fn transformationMatrixBuffer(&self) -> MTL4BufferRange;
510
511 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
512 /// Setter for [`transformationMatrixBuffer`][Self::transformationMatrixBuffer].
513 #[unsafe(method(setTransformationMatrixBuffer:))]
514 #[unsafe(method_family = none)]
515 pub fn setTransformationMatrixBuffer(&self, transformation_matrix_buffer: MTL4BufferRange);
516
517 #[cfg(feature = "MTLAccelerationStructure")]
518 /// Configures the layout for the transformation matrix in the transformation matrix buffer.
519 ///
520 /// You can provide matrices in column-major or row-major form, and this property allows you to control
521 /// how Metal interprets them.
522 ///
523 /// Defaults to `MTLMatrixLayoutColumnMajor`.
524 #[unsafe(method(transformationMatrixLayout))]
525 #[unsafe(method_family = none)]
526 pub fn transformationMatrixLayout(&self) -> MTLMatrixLayout;
527
528 #[cfg(feature = "MTLAccelerationStructure")]
529 /// Setter for [`transformationMatrixLayout`][Self::transformationMatrixLayout].
530 #[unsafe(method(setTransformationMatrixLayout:))]
531 #[unsafe(method_family = none)]
532 pub fn setTransformationMatrixLayout(&self, transformation_matrix_layout: MTLMatrixLayout);
533 );
534}
535
536/// Methods declared on superclass `NSObject`.
537impl MTL4AccelerationStructureTriangleGeometryDescriptor {
538 extern_methods!(
539 #[unsafe(method(init))]
540 #[unsafe(method_family = init)]
541 pub fn init(this: Allocated<Self>) -> Retained<Self>;
542
543 #[unsafe(method(new))]
544 #[unsafe(method_family = new)]
545 pub fn new() -> Retained<Self>;
546 );
547}
548
549impl DefaultRetained for MTL4AccelerationStructureTriangleGeometryDescriptor {
550 #[inline]
551 fn default_retained() -> Retained<Self> {
552 Self::new()
553 }
554}
555
556extern_class!(
557 /// Describes bounding-box geometry suitable for ray tracing.
558 ///
559 /// You use bounding boxes to implement procedural geometry for ray tracing, such as spheres or any other shape
560 /// you define by using intersection functions.
561 ///
562 /// Use a ``MTLResidencySet`` to mark residency of all buffers this descriptor references when you build this
563 /// acceleration structure.
564 ///
565 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4accelerationstructureboundingboxgeometrydescriptor?language=objc)
566 #[unsafe(super(MTL4AccelerationStructureGeometryDescriptor, NSObject))]
567 #[derive(Debug, PartialEq, Eq, Hash)]
568 pub struct MTL4AccelerationStructureBoundingBoxGeometryDescriptor;
569);
570
571extern_conformance!(
572 unsafe impl NSCopying for MTL4AccelerationStructureBoundingBoxGeometryDescriptor {}
573);
574
575unsafe impl CopyingHelper for MTL4AccelerationStructureBoundingBoxGeometryDescriptor {
576 type Result = Self;
577}
578
579extern_conformance!(
580 unsafe impl NSObjectProtocol for MTL4AccelerationStructureBoundingBoxGeometryDescriptor {}
581);
582
583impl MTL4AccelerationStructureBoundingBoxGeometryDescriptor {
584 extern_methods!(
585 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
586 /// References a buffer containing bounding box data in `MTLAxisAlignedBoundingBoxes` format.
587 ///
588 /// You are responsible for ensuring the buffer address of the range is not zero.
589 #[unsafe(method(boundingBoxBuffer))]
590 #[unsafe(method_family = none)]
591 pub fn boundingBoxBuffer(&self) -> MTL4BufferRange;
592
593 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
594 /// Setter for [`boundingBoxBuffer`][Self::boundingBoxBuffer].
595 #[unsafe(method(setBoundingBoxBuffer:))]
596 #[unsafe(method_family = none)]
597 pub fn setBoundingBoxBuffer(&self, bounding_box_buffer: MTL4BufferRange);
598
599 /// Assigns the stride, in bytes, between bounding boxes in the bounding box buffer `boundingBoxBuffer` references.
600 ///
601 /// You are responsible for ensuring this stride is at least 24 bytes and a multiple of 4 bytes.
602 ///
603 /// This property defaults to `24` bytes.
604 #[unsafe(method(boundingBoxStride))]
605 #[unsafe(method_family = none)]
606 pub fn boundingBoxStride(&self) -> NSUInteger;
607
608 /// Setter for [`boundingBoxStride`][Self::boundingBoxStride].
609 ///
610 /// # Safety
611 ///
612 /// This might not be bounds-checked.
613 #[unsafe(method(setBoundingBoxStride:))]
614 #[unsafe(method_family = none)]
615 pub unsafe fn setBoundingBoxStride(&self, bounding_box_stride: NSUInteger);
616
617 /// Describes the number of bounding boxes the `boundingBoxBuffer` contains.
618 #[unsafe(method(boundingBoxCount))]
619 #[unsafe(method_family = none)]
620 pub fn boundingBoxCount(&self) -> NSUInteger;
621
622 /// Setter for [`boundingBoxCount`][Self::boundingBoxCount].
623 ///
624 /// # Safety
625 ///
626 /// This might not be bounds-checked.
627 #[unsafe(method(setBoundingBoxCount:))]
628 #[unsafe(method_family = none)]
629 pub unsafe fn setBoundingBoxCount(&self, bounding_box_count: NSUInteger);
630 );
631}
632
633/// Methods declared on superclass `NSObject`.
634impl MTL4AccelerationStructureBoundingBoxGeometryDescriptor {
635 extern_methods!(
636 #[unsafe(method(init))]
637 #[unsafe(method_family = init)]
638 pub fn init(this: Allocated<Self>) -> Retained<Self>;
639
640 #[unsafe(method(new))]
641 #[unsafe(method_family = new)]
642 pub fn new() -> Retained<Self>;
643 );
644}
645
646impl DefaultRetained for MTL4AccelerationStructureBoundingBoxGeometryDescriptor {
647 #[inline]
648 fn default_retained() -> Retained<Self> {
649 Self::new()
650 }
651}
652
653extern_class!(
654 /// Describes motion triangle geometry, suitable for motion ray tracing.
655 ///
656 /// Use a ``MTLResidencySet`` to mark residency of all buffers this descriptor references when you build this
657 /// acceleration structure.
658 ///
659 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4accelerationstructuremotiontrianglegeometrydescriptor?language=objc)
660 #[unsafe(super(MTL4AccelerationStructureGeometryDescriptor, NSObject))]
661 #[derive(Debug, PartialEq, Eq, Hash)]
662 pub struct MTL4AccelerationStructureMotionTriangleGeometryDescriptor;
663);
664
665extern_conformance!(
666 unsafe impl NSCopying for MTL4AccelerationStructureMotionTriangleGeometryDescriptor {}
667);
668
669unsafe impl CopyingHelper for MTL4AccelerationStructureMotionTriangleGeometryDescriptor {
670 type Result = Self;
671}
672
673extern_conformance!(
674 unsafe impl NSObjectProtocol for MTL4AccelerationStructureMotionTriangleGeometryDescriptor {}
675);
676
677impl MTL4AccelerationStructureMotionTriangleGeometryDescriptor {
678 extern_methods!(
679 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
680 /// Assigns a buffer where each entry contains a reference to a vertex buffer.
681 ///
682 /// This property references a buffer that conceptually represents an array with one entry for each keyframe in the
683 /// motion animation. Each one of these entries consists of a ``MTL4BufferRange`` that, in turn, references a
684 /// vertex buffer containing the vertex data for the keyframe.
685 ///
686 /// You are responsible for ensuring the buffer address is not zero for the top-level buffer, as well as for all
687 /// the vertex buffers it references.
688 #[unsafe(method(vertexBuffers))]
689 #[unsafe(method_family = none)]
690 pub fn vertexBuffers(&self) -> MTL4BufferRange;
691
692 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
693 /// Setter for [`vertexBuffers`][Self::vertexBuffers].
694 #[unsafe(method(setVertexBuffers:))]
695 #[unsafe(method_family = none)]
696 pub fn setVertexBuffers(&self, vertex_buffers: MTL4BufferRange);
697
698 #[cfg(feature = "MTLStageInputOutputDescriptor")]
699 /// Defines the format of the vertices in the vertex buffers.
700 ///
701 /// All keyframes share the same vertex format. Defaults to `MTLAttributeFormatFloat3`, corresponding to three packed
702 /// floating point numbers.
703 #[unsafe(method(vertexFormat))]
704 #[unsafe(method_family = none)]
705 pub fn vertexFormat(&self) -> MTLAttributeFormat;
706
707 #[cfg(feature = "MTLStageInputOutputDescriptor")]
708 /// Setter for [`vertexFormat`][Self::vertexFormat].
709 #[unsafe(method(setVertexFormat:))]
710 #[unsafe(method_family = none)]
711 pub fn setVertexFormat(&self, vertex_format: MTLAttributeFormat);
712
713 /// Sets the stride, in bytes, between vertices in all the vertex buffer.
714 ///
715 /// All keyframes share the same vertex stride. This stride needs to be a multiple of the size of the vertex format you
716 /// provide in the ``vertexFormat`` property.
717 ///
718 /// Similarly, you are responsible for ensuring this stride matches the vertex format data type's alignment.
719 ///
720 /// Defaults to `0`, which signals the stride matches the size of the ``vertexFormat`` data.
721 #[unsafe(method(vertexStride))]
722 #[unsafe(method_family = none)]
723 pub fn vertexStride(&self) -> NSUInteger;
724
725 /// Setter for [`vertexStride`][Self::vertexStride].
726 ///
727 /// # Safety
728 ///
729 /// This might not be bounds-checked.
730 #[unsafe(method(setVertexStride:))]
731 #[unsafe(method_family = none)]
732 pub unsafe fn setVertexStride(&self, vertex_stride: NSUInteger);
733
734 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
735 /// Assigns an optional index buffer containing references to vertices in the vertex buffers you reference through the
736 /// vertex buffers property.
737 ///
738 /// You can set this property to `0`, the default, to avoid specifying an index buffer. All keyframes share the same
739 /// index buffer.
740 #[unsafe(method(indexBuffer))]
741 #[unsafe(method_family = none)]
742 pub fn indexBuffer(&self) -> MTL4BufferRange;
743
744 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
745 /// Setter for [`indexBuffer`][Self::indexBuffer].
746 ///
747 /// # Safety
748 ///
749 /// This might not be bounds-checked.
750 #[unsafe(method(setIndexBuffer:))]
751 #[unsafe(method_family = none)]
752 pub unsafe fn setIndexBuffer(&self, index_buffer: MTL4BufferRange);
753
754 #[cfg(feature = "MTLArgument")]
755 /// Specifies the size of the indices the `indexBuffer` contains, which is typically either 16 or 32-bits for each index.
756 #[unsafe(method(indexType))]
757 #[unsafe(method_family = none)]
758 pub fn indexType(&self) -> MTLIndexType;
759
760 #[cfg(feature = "MTLArgument")]
761 /// Setter for [`indexType`][Self::indexType].
762 #[unsafe(method(setIndexType:))]
763 #[unsafe(method_family = none)]
764 pub fn setIndexType(&self, index_type: MTLIndexType);
765
766 /// Declares the number of triangles in the vertex buffers that the buffer in the vertex buffers property references.
767 ///
768 /// All keyframes share the same triangle count.
769 #[unsafe(method(triangleCount))]
770 #[unsafe(method_family = none)]
771 pub fn triangleCount(&self) -> NSUInteger;
772
773 /// Setter for [`triangleCount`][Self::triangleCount].
774 ///
775 /// # Safety
776 ///
777 /// This might not be bounds-checked.
778 #[unsafe(method(setTriangleCount:))]
779 #[unsafe(method_family = none)]
780 pub unsafe fn setTriangleCount(&self, triangle_count: NSUInteger);
781
782 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
783 /// Assings an optional reference to a buffer containing a `float4x3` transformation matrix.
784 ///
785 /// When the buffer address is non-zero, Metal applies this transform to the vertex data positions when building
786 /// the acceleration structure. All keyframes share the same transformation matrix.
787 ///
788 /// Building an acceleration structure with a descriptor that specifies this property doesn't modify the contents of
789 /// the input `vertexBuffer`.
790 #[unsafe(method(transformationMatrixBuffer))]
791 #[unsafe(method_family = none)]
792 pub fn transformationMatrixBuffer(&self) -> MTL4BufferRange;
793
794 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
795 /// Setter for [`transformationMatrixBuffer`][Self::transformationMatrixBuffer].
796 #[unsafe(method(setTransformationMatrixBuffer:))]
797 #[unsafe(method_family = none)]
798 pub fn setTransformationMatrixBuffer(&self, transformation_matrix_buffer: MTL4BufferRange);
799
800 #[cfg(feature = "MTLAccelerationStructure")]
801 /// Configures the layout for the transformation matrix in the transformation matrix buffer.
802 ///
803 /// You can provide matrices in column-major or row-major form, and this property allows you to control
804 /// how Metal interprets them.
805 ///
806 /// Defaults to `MTLMatrixLayoutColumnMajor`.
807 #[unsafe(method(transformationMatrixLayout))]
808 #[unsafe(method_family = none)]
809 pub fn transformationMatrixLayout(&self) -> MTLMatrixLayout;
810
811 #[cfg(feature = "MTLAccelerationStructure")]
812 /// Setter for [`transformationMatrixLayout`][Self::transformationMatrixLayout].
813 #[unsafe(method(setTransformationMatrixLayout:))]
814 #[unsafe(method_family = none)]
815 pub fn setTransformationMatrixLayout(&self, transformation_matrix_layout: MTLMatrixLayout);
816 );
817}
818
819/// Methods declared on superclass `NSObject`.
820impl MTL4AccelerationStructureMotionTriangleGeometryDescriptor {
821 extern_methods!(
822 #[unsafe(method(init))]
823 #[unsafe(method_family = init)]
824 pub fn init(this: Allocated<Self>) -> Retained<Self>;
825
826 #[unsafe(method(new))]
827 #[unsafe(method_family = new)]
828 pub fn new() -> Retained<Self>;
829 );
830}
831
832impl DefaultRetained for MTL4AccelerationStructureMotionTriangleGeometryDescriptor {
833 #[inline]
834 fn default_retained() -> Retained<Self> {
835 Self::new()
836 }
837}
838
839extern_class!(
840 /// Describes motion bounding box geometry, suitable for motion ray tracing.
841 ///
842 /// You use bounding boxes to implement procedural geometry for ray tracing, such as spheres or any other shape
843 /// you define by using intersection functions.
844 ///
845 /// Use a ``MTLResidencySet`` to mark residency of all buffers this descriptor references when you build this
846 /// acceleration structure.
847 ///
848 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4accelerationstructuremotionboundingboxgeometrydescriptor?language=objc)
849 #[unsafe(super(MTL4AccelerationStructureGeometryDescriptor, NSObject))]
850 #[derive(Debug, PartialEq, Eq, Hash)]
851 pub struct MTL4AccelerationStructureMotionBoundingBoxGeometryDescriptor;
852);
853
854extern_conformance!(
855 unsafe impl NSCopying for MTL4AccelerationStructureMotionBoundingBoxGeometryDescriptor {}
856);
857
858unsafe impl CopyingHelper for MTL4AccelerationStructureMotionBoundingBoxGeometryDescriptor {
859 type Result = Self;
860}
861
862extern_conformance!(
863 unsafe impl NSObjectProtocol for MTL4AccelerationStructureMotionBoundingBoxGeometryDescriptor {}
864);
865
866impl MTL4AccelerationStructureMotionBoundingBoxGeometryDescriptor {
867 extern_methods!(
868 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
869 /// Configures a reference to a buffer where each entry contains a reference to a buffer of bounding boxes.
870 ///
871 /// This property references a buffer that conceptually represents an array with one entry for each keyframe in the
872 /// motion animation. Each one of these entries consists of a ``MTL4BufferRange`` that, in turn, references a
873 /// vertex buffer containing the bounding box data for the keyframe.
874 ///
875 /// You are responsible for ensuring the buffer address is not zero for the top-level buffer, as well as for all
876 /// the vertex buffers it references.
877 #[unsafe(method(boundingBoxBuffers))]
878 #[unsafe(method_family = none)]
879 pub fn boundingBoxBuffers(&self) -> MTL4BufferRange;
880
881 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
882 /// Setter for [`boundingBoxBuffers`][Self::boundingBoxBuffers].
883 #[unsafe(method(setBoundingBoxBuffers:))]
884 #[unsafe(method_family = none)]
885 pub fn setBoundingBoxBuffers(&self, bounding_box_buffers: MTL4BufferRange);
886
887 /// Declares the stride, in bytes, between bounding boxes in the bounding box buffers each entry in `boundingBoxBuffer`
888 /// references.
889 ///
890 /// All keyframes share the same bounding box stride. You are responsible for ensuring this stride is at least 24 bytes
891 /// and a multiple of 4 bytes.
892 ///
893 /// This property defaults to `24` bytes.
894 #[unsafe(method(boundingBoxStride))]
895 #[unsafe(method_family = none)]
896 pub fn boundingBoxStride(&self) -> NSUInteger;
897
898 /// Setter for [`boundingBoxStride`][Self::boundingBoxStride].
899 ///
900 /// # Safety
901 ///
902 /// This might not be bounds-checked.
903 #[unsafe(method(setBoundingBoxStride:))]
904 #[unsafe(method_family = none)]
905 pub unsafe fn setBoundingBoxStride(&self, bounding_box_stride: NSUInteger);
906
907 /// Declares the number of bounding boxes in each buffer that `boundingBoxBuffer` references.
908 ///
909 /// All keyframes share the same bounding box count.
910 #[unsafe(method(boundingBoxCount))]
911 #[unsafe(method_family = none)]
912 pub fn boundingBoxCount(&self) -> NSUInteger;
913
914 /// Setter for [`boundingBoxCount`][Self::boundingBoxCount].
915 ///
916 /// # Safety
917 ///
918 /// This might not be bounds-checked.
919 #[unsafe(method(setBoundingBoxCount:))]
920 #[unsafe(method_family = none)]
921 pub unsafe fn setBoundingBoxCount(&self, bounding_box_count: NSUInteger);
922 );
923}
924
925/// Methods declared on superclass `NSObject`.
926impl MTL4AccelerationStructureMotionBoundingBoxGeometryDescriptor {
927 extern_methods!(
928 #[unsafe(method(init))]
929 #[unsafe(method_family = init)]
930 pub fn init(this: Allocated<Self>) -> Retained<Self>;
931
932 #[unsafe(method(new))]
933 #[unsafe(method_family = new)]
934 pub fn new() -> Retained<Self>;
935 );
936}
937
938impl DefaultRetained for MTL4AccelerationStructureMotionBoundingBoxGeometryDescriptor {
939 #[inline]
940 fn default_retained() -> Retained<Self> {
941 Self::new()
942 }
943}
944
945extern_class!(
946 /// Describes curve geometry suitable for ray tracing.
947 ///
948 /// Use a ``MTLResidencySet`` to mark residency of all buffers this descriptor references when you build this
949 /// acceleration structure.
950 ///
951 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4accelerationstructurecurvegeometrydescriptor?language=objc)
952 #[unsafe(super(MTL4AccelerationStructureGeometryDescriptor, NSObject))]
953 #[derive(Debug, PartialEq, Eq, Hash)]
954 pub struct MTL4AccelerationStructureCurveGeometryDescriptor;
955);
956
957extern_conformance!(
958 unsafe impl NSCopying for MTL4AccelerationStructureCurveGeometryDescriptor {}
959);
960
961unsafe impl CopyingHelper for MTL4AccelerationStructureCurveGeometryDescriptor {
962 type Result = Self;
963}
964
965extern_conformance!(
966 unsafe impl NSObjectProtocol for MTL4AccelerationStructureCurveGeometryDescriptor {}
967);
968
969impl MTL4AccelerationStructureCurveGeometryDescriptor {
970 extern_methods!(
971 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
972 /// References a buffer containing curve control points.
973 ///
974 /// Control points are interpolated according to the basis function you specify in ``curveBasis``.
975 ///
976 /// You are responsible for ensuring each control is in a format matching the control point format ``controlPointFormat``
977 /// specifies, as well as ensuring that the buffer address of the range is not zero.
978 #[unsafe(method(controlPointBuffer))]
979 #[unsafe(method_family = none)]
980 pub fn controlPointBuffer(&self) -> MTL4BufferRange;
981
982 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
983 /// Setter for [`controlPointBuffer`][Self::controlPointBuffer].
984 #[unsafe(method(setControlPointBuffer:))]
985 #[unsafe(method_family = none)]
986 pub fn setControlPointBuffer(&self, control_point_buffer: MTL4BufferRange);
987
988 /// Declares the number of control points in the control point buffer.
989 #[unsafe(method(controlPointCount))]
990 #[unsafe(method_family = none)]
991 pub fn controlPointCount(&self) -> NSUInteger;
992
993 /// Setter for [`controlPointCount`][Self::controlPointCount].
994 ///
995 /// # Safety
996 ///
997 /// This might not be bounds-checked.
998 #[unsafe(method(setControlPointCount:))]
999 #[unsafe(method_family = none)]
1000 pub unsafe fn setControlPointCount(&self, control_point_count: NSUInteger);
1001
1002 /// Sets the stride, in bytes, between control points in the control point buffer the control point buffer references.
1003 ///
1004 /// You are responsible for ensuring this stride is a multiple of the control point format's element size, and
1005 /// at a minimum exactly the control point format's size.
1006 ///
1007 /// This property defaults to `0`, indicating that the control points are tightly-packed.
1008 #[unsafe(method(controlPointStride))]
1009 #[unsafe(method_family = none)]
1010 pub fn controlPointStride(&self) -> NSUInteger;
1011
1012 /// Setter for [`controlPointStride`][Self::controlPointStride].
1013 ///
1014 /// # Safety
1015 ///
1016 /// This might not be bounds-checked.
1017 #[unsafe(method(setControlPointStride:))]
1018 #[unsafe(method_family = none)]
1019 pub unsafe fn setControlPointStride(&self, control_point_stride: NSUInteger);
1020
1021 #[cfg(feature = "MTLStageInputOutputDescriptor")]
1022 /// Declares the format of the control points the control point buffer references.
1023 ///
1024 /// Defaults to `MTLAttributeFormatFloat3`, representing 3 floating point values tightly packed.
1025 #[unsafe(method(controlPointFormat))]
1026 #[unsafe(method_family = none)]
1027 pub fn controlPointFormat(&self) -> MTLAttributeFormat;
1028
1029 #[cfg(feature = "MTLStageInputOutputDescriptor")]
1030 /// Setter for [`controlPointFormat`][Self::controlPointFormat].
1031 #[unsafe(method(setControlPointFormat:))]
1032 #[unsafe(method_family = none)]
1033 pub fn setControlPointFormat(&self, control_point_format: MTLAttributeFormat);
1034
1035 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1036 /// Assigns a reference to a buffer containing the curve radius for each control point.
1037 ///
1038 /// Metal interpolates curve radii according to the basis function you specify via ``curveBasis``.
1039 ///
1040 /// You are responsible for ensuring the type of each radius matches the type property ``radiusFormat`` specifies,
1041 /// that each radius is at least zero, and that the buffer address of the range is not zero.
1042 #[unsafe(method(radiusBuffer))]
1043 #[unsafe(method_family = none)]
1044 pub fn radiusBuffer(&self) -> MTL4BufferRange;
1045
1046 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1047 /// Setter for [`radiusBuffer`][Self::radiusBuffer].
1048 #[unsafe(method(setRadiusBuffer:))]
1049 #[unsafe(method_family = none)]
1050 pub fn setRadiusBuffer(&self, radius_buffer: MTL4BufferRange);
1051
1052 #[cfg(feature = "MTLStageInputOutputDescriptor")]
1053 /// Declares the format of the radii in the radius buffer.
1054 ///
1055 /// Defaults to `MTLAttributeFormatFloat`.
1056 #[unsafe(method(radiusFormat))]
1057 #[unsafe(method_family = none)]
1058 pub fn radiusFormat(&self) -> MTLAttributeFormat;
1059
1060 #[cfg(feature = "MTLStageInputOutputDescriptor")]
1061 /// Setter for [`radiusFormat`][Self::radiusFormat].
1062 #[unsafe(method(setRadiusFormat:))]
1063 #[unsafe(method_family = none)]
1064 pub fn setRadiusFormat(&self, radius_format: MTLAttributeFormat);
1065
1066 /// Configures the stride, in bytes, between radii in the radius buffer.
1067 ///
1068 /// You are responsible for ensuring this property is set to a multiple of the size corresponding to the ``radiusFormat``.
1069 ///
1070 /// This property defaults to `0` bytes, indicating that the radii are tightly packed.
1071 #[unsafe(method(radiusStride))]
1072 #[unsafe(method_family = none)]
1073 pub fn radiusStride(&self) -> NSUInteger;
1074
1075 /// Setter for [`radiusStride`][Self::radiusStride].
1076 ///
1077 /// # Safety
1078 ///
1079 /// This might not be bounds-checked.
1080 #[unsafe(method(setRadiusStride:))]
1081 #[unsafe(method_family = none)]
1082 pub unsafe fn setRadiusStride(&self, radius_stride: NSUInteger);
1083
1084 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1085 /// Assigns an optional index buffer containing references to control points in the control point buffer.
1086 ///
1087 /// Each index represents the first control point of a curve segment. You are responsible for ensuring the buffer
1088 /// address of the range is not zero.
1089 #[unsafe(method(indexBuffer))]
1090 #[unsafe(method_family = none)]
1091 pub fn indexBuffer(&self) -> MTL4BufferRange;
1092
1093 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1094 /// Setter for [`indexBuffer`][Self::indexBuffer].
1095 ///
1096 /// # Safety
1097 ///
1098 /// This might not be bounds-checked.
1099 #[unsafe(method(setIndexBuffer:))]
1100 #[unsafe(method_family = none)]
1101 pub unsafe fn setIndexBuffer(&self, index_buffer: MTL4BufferRange);
1102
1103 #[cfg(feature = "MTLArgument")]
1104 /// Specifies the size of the indices the `indexBuffer` contains, which is typically either 16 or 32-bits for each index.
1105 #[unsafe(method(indexType))]
1106 #[unsafe(method_family = none)]
1107 pub fn indexType(&self) -> MTLIndexType;
1108
1109 #[cfg(feature = "MTLArgument")]
1110 /// Setter for [`indexType`][Self::indexType].
1111 #[unsafe(method(setIndexType:))]
1112 #[unsafe(method_family = none)]
1113 pub fn setIndexType(&self, index_type: MTLIndexType);
1114
1115 /// Declares the number of curve segments.
1116 #[unsafe(method(segmentCount))]
1117 #[unsafe(method_family = none)]
1118 pub fn segmentCount(&self) -> NSUInteger;
1119
1120 /// Setter for [`segmentCount`][Self::segmentCount].
1121 ///
1122 /// # Safety
1123 ///
1124 /// This might not be bounds-checked.
1125 #[unsafe(method(setSegmentCount:))]
1126 #[unsafe(method_family = none)]
1127 pub unsafe fn setSegmentCount(&self, segment_count: NSUInteger);
1128
1129 /// Declares the number of control points per curve segment.
1130 ///
1131 /// Valid values for this property are `2`, `3`, or `4`.
1132 #[unsafe(method(segmentControlPointCount))]
1133 #[unsafe(method_family = none)]
1134 pub fn segmentControlPointCount(&self) -> NSUInteger;
1135
1136 /// Setter for [`segmentControlPointCount`][Self::segmentControlPointCount].
1137 ///
1138 /// # Safety
1139 ///
1140 /// This might not be bounds-checked.
1141 #[unsafe(method(setSegmentControlPointCount:))]
1142 #[unsafe(method_family = none)]
1143 pub unsafe fn setSegmentControlPointCount(&self, segment_control_point_count: NSUInteger);
1144
1145 #[cfg(feature = "MTLAccelerationStructure")]
1146 /// Controls the curve type.
1147 ///
1148 /// Defaults to `MTLCurveTypeRound`.
1149 #[unsafe(method(curveType))]
1150 #[unsafe(method_family = none)]
1151 pub fn curveType(&self) -> MTLCurveType;
1152
1153 #[cfg(feature = "MTLAccelerationStructure")]
1154 /// Setter for [`curveType`][Self::curveType].
1155 #[unsafe(method(setCurveType:))]
1156 #[unsafe(method_family = none)]
1157 pub fn setCurveType(&self, curve_type: MTLCurveType);
1158
1159 #[cfg(feature = "MTLAccelerationStructure")]
1160 /// Controls the curve basis function, determining how Metal interpolates the control points.
1161 ///
1162 /// Defaults to `MTLCurveBasisBSpline`.
1163 #[unsafe(method(curveBasis))]
1164 #[unsafe(method_family = none)]
1165 pub fn curveBasis(&self) -> MTLCurveBasis;
1166
1167 #[cfg(feature = "MTLAccelerationStructure")]
1168 /// Setter for [`curveBasis`][Self::curveBasis].
1169 #[unsafe(method(setCurveBasis:))]
1170 #[unsafe(method_family = none)]
1171 pub fn setCurveBasis(&self, curve_basis: MTLCurveBasis);
1172
1173 #[cfg(feature = "MTLAccelerationStructure")]
1174 /// Sets the type of curve end caps.
1175 ///
1176 /// Defaults to `MTLCurveEndCapsNone`.
1177 #[unsafe(method(curveEndCaps))]
1178 #[unsafe(method_family = none)]
1179 pub fn curveEndCaps(&self) -> MTLCurveEndCaps;
1180
1181 #[cfg(feature = "MTLAccelerationStructure")]
1182 /// Setter for [`curveEndCaps`][Self::curveEndCaps].
1183 #[unsafe(method(setCurveEndCaps:))]
1184 #[unsafe(method_family = none)]
1185 pub fn setCurveEndCaps(&self, curve_end_caps: MTLCurveEndCaps);
1186 );
1187}
1188
1189/// Methods declared on superclass `NSObject`.
1190impl MTL4AccelerationStructureCurveGeometryDescriptor {
1191 extern_methods!(
1192 #[unsafe(method(init))]
1193 #[unsafe(method_family = init)]
1194 pub fn init(this: Allocated<Self>) -> Retained<Self>;
1195
1196 #[unsafe(method(new))]
1197 #[unsafe(method_family = new)]
1198 pub fn new() -> Retained<Self>;
1199 );
1200}
1201
1202impl DefaultRetained for MTL4AccelerationStructureCurveGeometryDescriptor {
1203 #[inline]
1204 fn default_retained() -> Retained<Self> {
1205 Self::new()
1206 }
1207}
1208
1209extern_class!(
1210 /// Describes motion curve geometry, suitable for motion ray tracing.
1211 ///
1212 /// Use a ``MTLResidencySet`` to mark residency of all buffers this descriptor references when you build this
1213 /// acceleration structure.
1214 ///
1215 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4accelerationstructuremotioncurvegeometrydescriptor?language=objc)
1216 #[unsafe(super(MTL4AccelerationStructureGeometryDescriptor, NSObject))]
1217 #[derive(Debug, PartialEq, Eq, Hash)]
1218 pub struct MTL4AccelerationStructureMotionCurveGeometryDescriptor;
1219);
1220
1221extern_conformance!(
1222 unsafe impl NSCopying for MTL4AccelerationStructureMotionCurveGeometryDescriptor {}
1223);
1224
1225unsafe impl CopyingHelper for MTL4AccelerationStructureMotionCurveGeometryDescriptor {
1226 type Result = Self;
1227}
1228
1229extern_conformance!(
1230 unsafe impl NSObjectProtocol for MTL4AccelerationStructureMotionCurveGeometryDescriptor {}
1231);
1232
1233impl MTL4AccelerationStructureMotionCurveGeometryDescriptor {
1234 extern_methods!(
1235 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1236 /// Assigns a reference to a buffer where each entry contains a reference to a buffer of control points.
1237 ///
1238 /// This property references a buffer that conceptually represents an array with one entry for each keyframe in the
1239 /// motion animation. Each one of these entries consists of a ``MTL4BufferRange`` that, in turn, references a
1240 /// buffer containing the control points corresponding to the keyframe.
1241 ///
1242 /// You are responsible for ensuring the buffer address is not zero for the top-level buffer, as well as for all
1243 /// the vertex buffers it references.
1244 #[unsafe(method(controlPointBuffers))]
1245 #[unsafe(method_family = none)]
1246 pub fn controlPointBuffers(&self) -> MTL4BufferRange;
1247
1248 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1249 /// Setter for [`controlPointBuffers`][Self::controlPointBuffers].
1250 #[unsafe(method(setControlPointBuffers:))]
1251 #[unsafe(method_family = none)]
1252 pub fn setControlPointBuffers(&self, control_point_buffers: MTL4BufferRange);
1253
1254 /// Specifies the number of control points in the buffers the control point buffers reference.
1255 ///
1256 /// All keyframes have the same number of control points.
1257 #[unsafe(method(controlPointCount))]
1258 #[unsafe(method_family = none)]
1259 pub fn controlPointCount(&self) -> NSUInteger;
1260
1261 /// Setter for [`controlPointCount`][Self::controlPointCount].
1262 ///
1263 /// # Safety
1264 ///
1265 /// This might not be bounds-checked.
1266 #[unsafe(method(setControlPointCount:))]
1267 #[unsafe(method_family = none)]
1268 pub unsafe fn setControlPointCount(&self, control_point_count: NSUInteger);
1269
1270 /// Sets the stride, in bytes, between control points in the control point buffer.
1271 ///
1272 /// All keyframes share the same control point stride.
1273 ///
1274 /// You are responsible for ensuring this stride is a multiple of the control point format's element size, and
1275 /// at a minimum exactly the control point format's size.
1276 ///
1277 /// This property defaults to `0`, indicating that the control points are tightly-packed.
1278 #[unsafe(method(controlPointStride))]
1279 #[unsafe(method_family = none)]
1280 pub fn controlPointStride(&self) -> NSUInteger;
1281
1282 /// Setter for [`controlPointStride`][Self::controlPointStride].
1283 ///
1284 /// # Safety
1285 ///
1286 /// This might not be bounds-checked.
1287 #[unsafe(method(setControlPointStride:))]
1288 #[unsafe(method_family = none)]
1289 pub unsafe fn setControlPointStride(&self, control_point_stride: NSUInteger);
1290
1291 #[cfg(feature = "MTLStageInputOutputDescriptor")]
1292 /// Declares the format of the control points in the buffers that the control point buffers reference.
1293 ///
1294 /// All keyframes share the same control point format. Defaults to `MTLAttributeFormatFloat3`, representing 3 floating
1295 /// point values tightly packed.
1296 #[unsafe(method(controlPointFormat))]
1297 #[unsafe(method_family = none)]
1298 pub fn controlPointFormat(&self) -> MTLAttributeFormat;
1299
1300 #[cfg(feature = "MTLStageInputOutputDescriptor")]
1301 /// Setter for [`controlPointFormat`][Self::controlPointFormat].
1302 #[unsafe(method(setControlPointFormat:))]
1303 #[unsafe(method_family = none)]
1304 pub fn setControlPointFormat(&self, control_point_format: MTLAttributeFormat);
1305
1306 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1307 /// Assigns a reference to a buffer containing, in turn, references to curve radii buffers.
1308 ///
1309 /// This property references a buffer that conceptually represents an array with one entry for each keyframe in the
1310 /// motion animation. Each one of these entries consists of a ``MTL4BufferRange`` that, in turn, references a
1311 /// buffer containing the radii corresponding to the keyframe.
1312 ///
1313 /// Metal interpolates curve radii according to the basis function you specify via ``curveBasis``.
1314 ///
1315 /// You are responsible for ensuring the type of each radius matches the type property ``radiusFormat`` specifies,
1316 /// that each radius is at least zero, and that the buffer address of the top-level buffer, as well as of buffer
1317 /// it references, is not zero.
1318 #[unsafe(method(radiusBuffers))]
1319 #[unsafe(method_family = none)]
1320 pub fn radiusBuffers(&self) -> MTL4BufferRange;
1321
1322 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1323 /// Setter for [`radiusBuffers`][Self::radiusBuffers].
1324 #[unsafe(method(setRadiusBuffers:))]
1325 #[unsafe(method_family = none)]
1326 pub fn setRadiusBuffers(&self, radius_buffers: MTL4BufferRange);
1327
1328 #[cfg(feature = "MTLStageInputOutputDescriptor")]
1329 /// Sets the format of the radii in the radius buffer.
1330 ///
1331 /// Defaults to `MTLAttributeFormatFloat`. All keyframes share the same radius format.
1332 #[unsafe(method(radiusFormat))]
1333 #[unsafe(method_family = none)]
1334 pub fn radiusFormat(&self) -> MTLAttributeFormat;
1335
1336 #[cfg(feature = "MTLStageInputOutputDescriptor")]
1337 /// Setter for [`radiusFormat`][Self::radiusFormat].
1338 #[unsafe(method(setRadiusFormat:))]
1339 #[unsafe(method_family = none)]
1340 pub fn setRadiusFormat(&self, radius_format: MTLAttributeFormat);
1341
1342 /// Sets the stride, in bytes, between radii in the radius buffer.
1343 ///
1344 /// You are responsible for ensuring this property is set to a multiple of the size corresponding to the ``radiusFormat``.
1345 /// All keyframes share the same radius stride.
1346 ///
1347 /// This property defaults to `0` bytes, indicating that the radii are tightly packed.
1348 #[unsafe(method(radiusStride))]
1349 #[unsafe(method_family = none)]
1350 pub fn radiusStride(&self) -> NSUInteger;
1351
1352 /// Setter for [`radiusStride`][Self::radiusStride].
1353 ///
1354 /// # Safety
1355 ///
1356 /// This might not be bounds-checked.
1357 #[unsafe(method(setRadiusStride:))]
1358 #[unsafe(method_family = none)]
1359 pub unsafe fn setRadiusStride(&self, radius_stride: NSUInteger);
1360
1361 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1362 /// Assigns an optional index buffer containing references to control points in the control point buffers.
1363 ///
1364 /// All keyframes share the same index buffer, with each index representing the first control point of a curve segment.
1365 ///
1366 /// You are responsible for ensuring the buffer address of the range is not zero.
1367 #[unsafe(method(indexBuffer))]
1368 #[unsafe(method_family = none)]
1369 pub fn indexBuffer(&self) -> MTL4BufferRange;
1370
1371 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1372 /// Setter for [`indexBuffer`][Self::indexBuffer].
1373 ///
1374 /// # Safety
1375 ///
1376 /// This might not be bounds-checked.
1377 #[unsafe(method(setIndexBuffer:))]
1378 #[unsafe(method_family = none)]
1379 pub unsafe fn setIndexBuffer(&self, index_buffer: MTL4BufferRange);
1380
1381 #[cfg(feature = "MTLArgument")]
1382 /// Configures the size of the indices the `indexBuffer` contains, which is typically either 16 or 32-bits for each index.
1383 #[unsafe(method(indexType))]
1384 #[unsafe(method_family = none)]
1385 pub fn indexType(&self) -> MTLIndexType;
1386
1387 #[cfg(feature = "MTLArgument")]
1388 /// Setter for [`indexType`][Self::indexType].
1389 #[unsafe(method(setIndexType:))]
1390 #[unsafe(method_family = none)]
1391 pub fn setIndexType(&self, index_type: MTLIndexType);
1392
1393 /// Declares the number of curve segments.
1394 ///
1395 /// All keyframes have the same number of curve segments.
1396 #[unsafe(method(segmentCount))]
1397 #[unsafe(method_family = none)]
1398 pub fn segmentCount(&self) -> NSUInteger;
1399
1400 /// Setter for [`segmentCount`][Self::segmentCount].
1401 ///
1402 /// # Safety
1403 ///
1404 /// This might not be bounds-checked.
1405 #[unsafe(method(setSegmentCount:))]
1406 #[unsafe(method_family = none)]
1407 pub unsafe fn setSegmentCount(&self, segment_count: NSUInteger);
1408
1409 /// Controls the number of control points per curve segment.
1410 ///
1411 /// Valid values for this property are `2`, `3`, or `4`. All keyframes have the same number of control points per curve segment.
1412 #[unsafe(method(segmentControlPointCount))]
1413 #[unsafe(method_family = none)]
1414 pub fn segmentControlPointCount(&self) -> NSUInteger;
1415
1416 /// Setter for [`segmentControlPointCount`][Self::segmentControlPointCount].
1417 ///
1418 /// # Safety
1419 ///
1420 /// This might not be bounds-checked.
1421 #[unsafe(method(setSegmentControlPointCount:))]
1422 #[unsafe(method_family = none)]
1423 pub unsafe fn setSegmentControlPointCount(&self, segment_control_point_count: NSUInteger);
1424
1425 #[cfg(feature = "MTLAccelerationStructure")]
1426 /// Controls the curve type.
1427 ///
1428 /// Defaults to `MTLCurveTypeRound`. All keyframes share the same curve type.
1429 #[unsafe(method(curveType))]
1430 #[unsafe(method_family = none)]
1431 pub fn curveType(&self) -> MTLCurveType;
1432
1433 #[cfg(feature = "MTLAccelerationStructure")]
1434 /// Setter for [`curveType`][Self::curveType].
1435 #[unsafe(method(setCurveType:))]
1436 #[unsafe(method_family = none)]
1437 pub fn setCurveType(&self, curve_type: MTLCurveType);
1438
1439 #[cfg(feature = "MTLAccelerationStructure")]
1440 /// Sets the curve basis function, determining how Metal interpolates the control points.
1441 ///
1442 /// Defaults to `MTLCurveBasisBSpline`. All keyframes share the same curve basis function.
1443 #[unsafe(method(curveBasis))]
1444 #[unsafe(method_family = none)]
1445 pub fn curveBasis(&self) -> MTLCurveBasis;
1446
1447 #[cfg(feature = "MTLAccelerationStructure")]
1448 /// Setter for [`curveBasis`][Self::curveBasis].
1449 #[unsafe(method(setCurveBasis:))]
1450 #[unsafe(method_family = none)]
1451 pub fn setCurveBasis(&self, curve_basis: MTLCurveBasis);
1452
1453 #[cfg(feature = "MTLAccelerationStructure")]
1454 /// Configures the type of curve end caps.
1455 ///
1456 /// Defaults to `MTLCurveEndCapsNone`. All keyframes share the same end cap type.
1457 #[unsafe(method(curveEndCaps))]
1458 #[unsafe(method_family = none)]
1459 pub fn curveEndCaps(&self) -> MTLCurveEndCaps;
1460
1461 #[cfg(feature = "MTLAccelerationStructure")]
1462 /// Setter for [`curveEndCaps`][Self::curveEndCaps].
1463 #[unsafe(method(setCurveEndCaps:))]
1464 #[unsafe(method_family = none)]
1465 pub fn setCurveEndCaps(&self, curve_end_caps: MTLCurveEndCaps);
1466 );
1467}
1468
1469/// Methods declared on superclass `NSObject`.
1470impl MTL4AccelerationStructureMotionCurveGeometryDescriptor {
1471 extern_methods!(
1472 #[unsafe(method(init))]
1473 #[unsafe(method_family = init)]
1474 pub fn init(this: Allocated<Self>) -> Retained<Self>;
1475
1476 #[unsafe(method(new))]
1477 #[unsafe(method_family = new)]
1478 pub fn new() -> Retained<Self>;
1479 );
1480}
1481
1482impl DefaultRetained for MTL4AccelerationStructureMotionCurveGeometryDescriptor {
1483 #[inline]
1484 fn default_retained() -> Retained<Self> {
1485 Self::new()
1486 }
1487}
1488
1489extern_class!(
1490 /// Descriptor for an instance acceleration structure.
1491 ///
1492 /// An instance acceleration structure references other acceleration structures, and provides the ability to
1493 /// "instantiate" them multiple times, each one with potentially a different transformation matrix.
1494 ///
1495 /// You specify the properties of the instances in the acceleration structure this descriptor builds by providing a
1496 /// buffer of `structs` via its ``instanceDescriptorBuffer`` property.
1497 ///
1498 /// Use a ``MTLResidencySet`` to mark residency of all buffers and acceleration structures this descriptor references
1499 /// when you build this acceleration structure.
1500 ///
1501 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4instanceaccelerationstructuredescriptor?language=objc)
1502 #[unsafe(super(
1503 MTL4AccelerationStructureDescriptor,
1504 MTLAccelerationStructureDescriptor,
1505 NSObject
1506 ))]
1507 #[derive(Debug, PartialEq, Eq, Hash)]
1508 #[cfg(feature = "MTLAccelerationStructure")]
1509 pub struct MTL4InstanceAccelerationStructureDescriptor;
1510);
1511
1512#[cfg(feature = "MTLAccelerationStructure")]
1513extern_conformance!(
1514 unsafe impl NSCopying for MTL4InstanceAccelerationStructureDescriptor {}
1515);
1516
1517#[cfg(feature = "MTLAccelerationStructure")]
1518unsafe impl CopyingHelper for MTL4InstanceAccelerationStructureDescriptor {
1519 type Result = Self;
1520}
1521
1522#[cfg(feature = "MTLAccelerationStructure")]
1523extern_conformance!(
1524 unsafe impl NSObjectProtocol for MTL4InstanceAccelerationStructureDescriptor {}
1525);
1526
1527#[cfg(feature = "MTLAccelerationStructure")]
1528impl MTL4InstanceAccelerationStructureDescriptor {
1529 extern_methods!(
1530 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1531 /// Assigns a reference to a buffer containing instance descriptors for acceleration structures to reference.
1532 ///
1533 /// This buffer conceptually represents an array of instance data. The specific format for the structs that comprise
1534 /// each entry depends on the value of the ``instanceDescriptorType`` property.
1535 ///
1536 /// You are responsible for ensuring the buffer address the range contains is not zero.
1537 #[unsafe(method(instanceDescriptorBuffer))]
1538 #[unsafe(method_family = none)]
1539 pub fn instanceDescriptorBuffer(&self) -> MTL4BufferRange;
1540
1541 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1542 /// Setter for [`instanceDescriptorBuffer`][Self::instanceDescriptorBuffer].
1543 #[unsafe(method(setInstanceDescriptorBuffer:))]
1544 #[unsafe(method_family = none)]
1545 pub unsafe fn setInstanceDescriptorBuffer(
1546 &self,
1547 instance_descriptor_buffer: MTL4BufferRange,
1548 );
1549
1550 /// Sets the stride, in bytes, between instance descriptors the instance descriptor buffer references.
1551 ///
1552 /// You are responsible for ensuring this stride is at least the size of the structure type corresponding to the instance
1553 /// descriptor type and a multiple of 4 bytes.
1554 ///
1555 /// Defaults to `0`, indicating the instance descriptors are tightly packed.
1556 #[unsafe(method(instanceDescriptorStride))]
1557 #[unsafe(method_family = none)]
1558 pub fn instanceDescriptorStride(&self) -> NSUInteger;
1559
1560 /// Setter for [`instanceDescriptorStride`][Self::instanceDescriptorStride].
1561 ///
1562 /// # Safety
1563 ///
1564 /// This might not be bounds-checked.
1565 #[unsafe(method(setInstanceDescriptorStride:))]
1566 #[unsafe(method_family = none)]
1567 pub unsafe fn setInstanceDescriptorStride(&self, instance_descriptor_stride: NSUInteger);
1568
1569 /// Controls the number of instance descriptors in the instance descriptor buffer references.
1570 #[unsafe(method(instanceCount))]
1571 #[unsafe(method_family = none)]
1572 pub fn instanceCount(&self) -> NSUInteger;
1573
1574 /// Setter for [`instanceCount`][Self::instanceCount].
1575 ///
1576 /// # Safety
1577 ///
1578 /// This might not be bounds-checked.
1579 #[unsafe(method(setInstanceCount:))]
1580 #[unsafe(method_family = none)]
1581 pub unsafe fn setInstanceCount(&self, instance_count: NSUInteger);
1582
1583 /// Sets the type of instance descriptor that the instance descriptor buffer references.
1584 ///
1585 /// This value determines the layout Metal expects for the structs the instance descriptor buffer contains.
1586 ///
1587 /// Defaults to `MTLAccelerationStructureInstanceDescriptorTypeIndirect`. Valid values for this property are
1588 /// `MTLAccelerationStructureInstanceDescriptorTypeIndirect` or `MTLAccelerationStructureInstanceDescriptorTypeIndirectMotion`.
1589 #[unsafe(method(instanceDescriptorType))]
1590 #[unsafe(method_family = none)]
1591 pub fn instanceDescriptorType(&self) -> MTLAccelerationStructureInstanceDescriptorType;
1592
1593 /// Setter for [`instanceDescriptorType`][Self::instanceDescriptorType].
1594 #[unsafe(method(setInstanceDescriptorType:))]
1595 #[unsafe(method_family = none)]
1596 pub fn setInstanceDescriptorType(
1597 &self,
1598 instance_descriptor_type: MTLAccelerationStructureInstanceDescriptorType,
1599 );
1600
1601 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1602 /// A buffer containing transformation information for instance motion keyframes, formatted according
1603 /// to the motion transform type.
1604 ///
1605 /// Each instance can have a different number of keyframes that you configure via individual instance
1606 /// descriptors.
1607 ///
1608 /// You are responsible for ensuring the buffer address the range references is not zero when using motion instance descriptors.
1609 #[unsafe(method(motionTransformBuffer))]
1610 #[unsafe(method_family = none)]
1611 pub fn motionTransformBuffer(&self) -> MTL4BufferRange;
1612
1613 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1614 /// Setter for [`motionTransformBuffer`][Self::motionTransformBuffer].
1615 #[unsafe(method(setMotionTransformBuffer:))]
1616 #[unsafe(method_family = none)]
1617 pub fn setMotionTransformBuffer(&self, motion_transform_buffer: MTL4BufferRange);
1618
1619 /// Controls the total number of motion transforms in the motion transform buffer.
1620 #[unsafe(method(motionTransformCount))]
1621 #[unsafe(method_family = none)]
1622 pub fn motionTransformCount(&self) -> NSUInteger;
1623
1624 /// Setter for [`motionTransformCount`][Self::motionTransformCount].
1625 ///
1626 /// # Safety
1627 ///
1628 /// This might not be bounds-checked.
1629 #[unsafe(method(setMotionTransformCount:))]
1630 #[unsafe(method_family = none)]
1631 pub unsafe fn setMotionTransformCount(&self, motion_transform_count: NSUInteger);
1632
1633 /// Specifies the layout for the transformation matrices in the instance descriptor buffer and the motion transformation matrix buffer.
1634 ///
1635 /// Metal interprets the value of this property as the layout for the buffers that both ``instanceDescriptorBuffer`` and
1636 /// ``motionTransformBuffer`` reference.
1637 ///
1638 /// Defaults to `MTLMatrixLayoutColumnMajor`.
1639 #[unsafe(method(instanceTransformationMatrixLayout))]
1640 #[unsafe(method_family = none)]
1641 pub fn instanceTransformationMatrixLayout(&self) -> MTLMatrixLayout;
1642
1643 /// Setter for [`instanceTransformationMatrixLayout`][Self::instanceTransformationMatrixLayout].
1644 #[unsafe(method(setInstanceTransformationMatrixLayout:))]
1645 #[unsafe(method_family = none)]
1646 pub fn setInstanceTransformationMatrixLayout(
1647 &self,
1648 instance_transformation_matrix_layout: MTLMatrixLayout,
1649 );
1650
1651 /// Controls the type of motion transforms, either as a matrix or individual components.
1652 ///
1653 /// Defaults to `MTLTransformTypePackedFloat4x3`. Using a `MTLTransformTypeComponent` allows you to represent the
1654 /// rotation by a quaternion (instead as of part of the matrix), allowing for correct motion interpolation.
1655 #[unsafe(method(motionTransformType))]
1656 #[unsafe(method_family = none)]
1657 pub fn motionTransformType(&self) -> MTLTransformType;
1658
1659 /// Setter for [`motionTransformType`][Self::motionTransformType].
1660 #[unsafe(method(setMotionTransformType:))]
1661 #[unsafe(method_family = none)]
1662 pub fn setMotionTransformType(&self, motion_transform_type: MTLTransformType);
1663
1664 /// Specify the stride for motion transform.
1665 ///
1666 /// Defaults to `0`, indicating that transforms are tightly packed according to the motion transform type.
1667 #[unsafe(method(motionTransformStride))]
1668 #[unsafe(method_family = none)]
1669 pub fn motionTransformStride(&self) -> NSUInteger;
1670
1671 /// Setter for [`motionTransformStride`][Self::motionTransformStride].
1672 ///
1673 /// # Safety
1674 ///
1675 /// This might not be bounds-checked.
1676 #[unsafe(method(setMotionTransformStride:))]
1677 #[unsafe(method_family = none)]
1678 pub unsafe fn setMotionTransformStride(&self, motion_transform_stride: NSUInteger);
1679 );
1680}
1681
1682/// Methods declared on superclass `NSObject`.
1683#[cfg(feature = "MTLAccelerationStructure")]
1684impl MTL4InstanceAccelerationStructureDescriptor {
1685 extern_methods!(
1686 #[unsafe(method(init))]
1687 #[unsafe(method_family = init)]
1688 pub fn init(this: Allocated<Self>) -> Retained<Self>;
1689
1690 #[unsafe(method(new))]
1691 #[unsafe(method_family = new)]
1692 pub fn new() -> Retained<Self>;
1693 );
1694}
1695
1696#[cfg(feature = "MTLAccelerationStructure")]
1697impl DefaultRetained for MTL4InstanceAccelerationStructureDescriptor {
1698 #[inline]
1699 fn default_retained() -> Retained<Self> {
1700 Self::new()
1701 }
1702}
1703
1704extern_class!(
1705 /// Descriptor for an "indirect" instance acceleration structure that allows providing the instance count and
1706 /// motion transform count indirectly, through buffer references.
1707 ///
1708 /// An instance acceleration structure references other acceleration structures, and provides the ability to
1709 /// "instantiate" them multiple times, each one with potentially a different transformation matrix.
1710 ///
1711 /// You specify the properties of the instances in the acceleration structure this descriptor builds by providing a
1712 /// buffer of `structs` via its ``instanceDescriptorBuffer`` property.
1713 ///
1714 /// Compared to ``MTL4InstanceAccelerationStructureDescriptor``, this descriptor allows you to provide the number
1715 /// of instances it references indirectly through a buffer reference, as well as the number of motion transforms.
1716 ///
1717 /// This enables you to determine these counts indirectly in the GPU timeline via a compute pipeline.
1718 /// Metal needs only to know the maximum possible number of instances and motion transforms to support,
1719 /// which you specify via the ``maxInstanceCount`` and ``maxMotionTransformCount`` properties.
1720 ///
1721 /// Use a ``MTLResidencySet`` to mark residency of all buffers and acceleration structures this descriptor references
1722 /// when you build this acceleration structure.
1723 ///
1724 /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4indirectinstanceaccelerationstructuredescriptor?language=objc)
1725 #[unsafe(super(
1726 MTL4AccelerationStructureDescriptor,
1727 MTLAccelerationStructureDescriptor,
1728 NSObject
1729 ))]
1730 #[derive(Debug, PartialEq, Eq, Hash)]
1731 #[cfg(feature = "MTLAccelerationStructure")]
1732 pub struct MTL4IndirectInstanceAccelerationStructureDescriptor;
1733);
1734
1735#[cfg(feature = "MTLAccelerationStructure")]
1736extern_conformance!(
1737 unsafe impl NSCopying for MTL4IndirectInstanceAccelerationStructureDescriptor {}
1738);
1739
1740#[cfg(feature = "MTLAccelerationStructure")]
1741unsafe impl CopyingHelper for MTL4IndirectInstanceAccelerationStructureDescriptor {
1742 type Result = Self;
1743}
1744
1745#[cfg(feature = "MTLAccelerationStructure")]
1746extern_conformance!(
1747 unsafe impl NSObjectProtocol for MTL4IndirectInstanceAccelerationStructureDescriptor {}
1748);
1749
1750#[cfg(feature = "MTLAccelerationStructure")]
1751impl MTL4IndirectInstanceAccelerationStructureDescriptor {
1752 extern_methods!(
1753 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1754 /// Assigns a reference to a buffer containing instance descriptors for acceleration structures to reference.
1755 ///
1756 /// This buffer conceptually represents an array of instance data. The specific format for the structs that comprise
1757 /// each entry depends on the value of the ``instanceDescriptorType`` property.
1758 ///
1759 /// You are responsible for ensuring the buffer address the range contains is not zero.
1760 #[unsafe(method(instanceDescriptorBuffer))]
1761 #[unsafe(method_family = none)]
1762 pub fn instanceDescriptorBuffer(&self) -> MTL4BufferRange;
1763
1764 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1765 /// Setter for [`instanceDescriptorBuffer`][Self::instanceDescriptorBuffer].
1766 #[unsafe(method(setInstanceDescriptorBuffer:))]
1767 #[unsafe(method_family = none)]
1768 pub unsafe fn setInstanceDescriptorBuffer(
1769 &self,
1770 instance_descriptor_buffer: MTL4BufferRange,
1771 );
1772
1773 /// Sets the stride, in bytes, between instance descriptors in the instance descriptor buffer.
1774 ///
1775 /// You are responsible for ensuring this stride is at least the size of the structure type corresponding to the instance
1776 /// descriptor type and a multiple of 4 bytes.
1777 ///
1778 /// Defaults to `0`, indicating the instance descriptors are tightly packed.
1779 #[unsafe(method(instanceDescriptorStride))]
1780 #[unsafe(method_family = none)]
1781 pub fn instanceDescriptorStride(&self) -> NSUInteger;
1782
1783 /// Setter for [`instanceDescriptorStride`][Self::instanceDescriptorStride].
1784 ///
1785 /// # Safety
1786 ///
1787 /// This might not be bounds-checked.
1788 #[unsafe(method(setInstanceDescriptorStride:))]
1789 #[unsafe(method_family = none)]
1790 pub unsafe fn setInstanceDescriptorStride(&self, instance_descriptor_stride: NSUInteger);
1791
1792 /// Controls the maximum number of instance descriptors the instance descriptor buffer can reference.
1793 ///
1794 /// You are responsible for ensuring that the final number of instances at build time, which you provide indirectly
1795 /// via a buffer reference in ``instanceCountBuffer``, is less than or equal to this number.
1796 #[unsafe(method(maxInstanceCount))]
1797 #[unsafe(method_family = none)]
1798 pub fn maxInstanceCount(&self) -> NSUInteger;
1799
1800 /// Setter for [`maxInstanceCount`][Self::maxInstanceCount].
1801 ///
1802 /// # Safety
1803 ///
1804 /// This might not be bounds-checked.
1805 #[unsafe(method(setMaxInstanceCount:))]
1806 #[unsafe(method_family = none)]
1807 pub unsafe fn setMaxInstanceCount(&self, max_instance_count: NSUInteger);
1808
1809 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1810 /// Provides a reference to a buffer containing the number of instances in the instance descriptor buffer, formatted as a
1811 /// 32-bit unsigned integer.
1812 ///
1813 /// You are responsible for ensuring that the final number of instances at build time, which you provide indirectly
1814 /// via this buffer reference , is less than or equal to the value of property ``maxInstanceCount``.
1815 #[unsafe(method(instanceCountBuffer))]
1816 #[unsafe(method_family = none)]
1817 pub fn instanceCountBuffer(&self) -> MTL4BufferRange;
1818
1819 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1820 /// Setter for [`instanceCountBuffer`][Self::instanceCountBuffer].
1821 ///
1822 /// # Safety
1823 ///
1824 /// This might not be bounds-checked.
1825 #[unsafe(method(setInstanceCountBuffer:))]
1826 #[unsafe(method_family = none)]
1827 pub unsafe fn setInstanceCountBuffer(&self, instance_count_buffer: MTL4BufferRange);
1828
1829 /// Controls the type of instance descriptor that the instance descriptor buffer references.
1830 ///
1831 /// This value determines the layout Metal expects for the structs the instance descriptor buffer contains.
1832 ///
1833 /// Defaults to `MTLAccelerationStructureInstanceDescriptorTypeIndirect`. Valid values for this property are
1834 /// `MTLAccelerationStructureInstanceDescriptorTypeIndirect` or `MTLAccelerationStructureInstanceDescriptorTypeIndirectMotion`.
1835 #[unsafe(method(instanceDescriptorType))]
1836 #[unsafe(method_family = none)]
1837 pub fn instanceDescriptorType(&self) -> MTLAccelerationStructureInstanceDescriptorType;
1838
1839 /// Setter for [`instanceDescriptorType`][Self::instanceDescriptorType].
1840 #[unsafe(method(setInstanceDescriptorType:))]
1841 #[unsafe(method_family = none)]
1842 pub fn setInstanceDescriptorType(
1843 &self,
1844 instance_descriptor_type: MTLAccelerationStructureInstanceDescriptorType,
1845 );
1846
1847 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1848 /// A buffer containing transformation information for instance motion keyframes, formatted according
1849 /// to the motion transform type.
1850 ///
1851 /// Each instance can have a different number of keyframes that you configure via individual instance
1852 /// descriptors.
1853 ///
1854 /// You are responsible for ensuring the buffer address the range references is not zero when using motion instance descriptors.
1855 #[unsafe(method(motionTransformBuffer))]
1856 #[unsafe(method_family = none)]
1857 pub fn motionTransformBuffer(&self) -> MTL4BufferRange;
1858
1859 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1860 /// Setter for [`motionTransformBuffer`][Self::motionTransformBuffer].
1861 #[unsafe(method(setMotionTransformBuffer:))]
1862 #[unsafe(method_family = none)]
1863 pub fn setMotionTransformBuffer(&self, motion_transform_buffer: MTL4BufferRange);
1864
1865 /// Controls the maximum number of motion transforms in the motion transform buffer.
1866 ///
1867 /// You are responsible for ensuring that final number of motion transforms at build time that the buffer
1868 /// ``motionTransformCountBuffer`` references is less than or equal to this number.
1869 #[unsafe(method(maxMotionTransformCount))]
1870 #[unsafe(method_family = none)]
1871 pub fn maxMotionTransformCount(&self) -> NSUInteger;
1872
1873 /// Setter for [`maxMotionTransformCount`][Self::maxMotionTransformCount].
1874 ///
1875 /// # Safety
1876 ///
1877 /// This might not be bounds-checked.
1878 #[unsafe(method(setMaxMotionTransformCount:))]
1879 #[unsafe(method_family = none)]
1880 pub unsafe fn setMaxMotionTransformCount(&self, max_motion_transform_count: NSUInteger);
1881
1882 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1883 /// Associates a buffer reference containing the number of motion transforms in the motion transform buffer, formatted as a
1884 /// 32-bit unsigned integer.
1885 ///
1886 /// You are responsible for ensuring that the final number of motion transforms at build time in the buffer this property
1887 /// references is less than or equal to the value of property ``maxMotionTransformCount``.
1888 #[unsafe(method(motionTransformCountBuffer))]
1889 #[unsafe(method_family = none)]
1890 pub fn motionTransformCountBuffer(&self) -> MTL4BufferRange;
1891
1892 #[cfg(all(feature = "MTL4BufferRange", feature = "MTLGPUAddress"))]
1893 /// Setter for [`motionTransformCountBuffer`][Self::motionTransformCountBuffer].
1894 ///
1895 /// # Safety
1896 ///
1897 /// This might not be bounds-checked.
1898 #[unsafe(method(setMotionTransformCountBuffer:))]
1899 #[unsafe(method_family = none)]
1900 pub unsafe fn setMotionTransformCountBuffer(
1901 &self,
1902 motion_transform_count_buffer: MTL4BufferRange,
1903 );
1904
1905 /// Specifies the layout for the transformation matrices in the instance descriptor buffer and the motion transformation matrix buffer.
1906 ///
1907 /// Metal interprets the value of this property as the layout for the buffers that both ``instanceDescriptorBuffer`` and
1908 /// ``motionTransformBuffer`` reference.
1909 ///
1910 /// Defaults to `MTLMatrixLayoutColumnMajor`.
1911 #[unsafe(method(instanceTransformationMatrixLayout))]
1912 #[unsafe(method_family = none)]
1913 pub fn instanceTransformationMatrixLayout(&self) -> MTLMatrixLayout;
1914
1915 /// Setter for [`instanceTransformationMatrixLayout`][Self::instanceTransformationMatrixLayout].
1916 #[unsafe(method(setInstanceTransformationMatrixLayout:))]
1917 #[unsafe(method_family = none)]
1918 pub fn setInstanceTransformationMatrixLayout(
1919 &self,
1920 instance_transformation_matrix_layout: MTLMatrixLayout,
1921 );
1922
1923 /// Sets the type of motion transforms, either as a matrix or individual components.
1924 ///
1925 /// Defaults to `MTLTransformTypePackedFloat4x3`. Using a `MTLTransformTypeComponent` allows you to represent the
1926 /// rotation by a quaternion (instead as of part of the matrix), allowing for correct motion interpolation.
1927 #[unsafe(method(motionTransformType))]
1928 #[unsafe(method_family = none)]
1929 pub fn motionTransformType(&self) -> MTLTransformType;
1930
1931 /// Setter for [`motionTransformType`][Self::motionTransformType].
1932 #[unsafe(method(setMotionTransformType:))]
1933 #[unsafe(method_family = none)]
1934 pub fn setMotionTransformType(&self, motion_transform_type: MTLTransformType);
1935
1936 /// Sets the stride for motion transform.
1937 ///
1938 /// Defaults to `0`, indicating that transforms are tightly packed according to the motion transform type.
1939 #[unsafe(method(motionTransformStride))]
1940 #[unsafe(method_family = none)]
1941 pub fn motionTransformStride(&self) -> NSUInteger;
1942
1943 /// Setter for [`motionTransformStride`][Self::motionTransformStride].
1944 ///
1945 /// # Safety
1946 ///
1947 /// This might not be bounds-checked.
1948 #[unsafe(method(setMotionTransformStride:))]
1949 #[unsafe(method_family = none)]
1950 pub unsafe fn setMotionTransformStride(&self, motion_transform_stride: NSUInteger);
1951 );
1952}
1953
1954/// Methods declared on superclass `NSObject`.
1955#[cfg(feature = "MTLAccelerationStructure")]
1956impl MTL4IndirectInstanceAccelerationStructureDescriptor {
1957 extern_methods!(
1958 #[unsafe(method(init))]
1959 #[unsafe(method_family = init)]
1960 pub fn init(this: Allocated<Self>) -> Retained<Self>;
1961
1962 #[unsafe(method(new))]
1963 #[unsafe(method_family = new)]
1964 pub fn new() -> Retained<Self>;
1965 );
1966}
1967
1968#[cfg(feature = "MTLAccelerationStructure")]
1969impl DefaultRetained for MTL4IndirectInstanceAccelerationStructureDescriptor {
1970 #[inline]
1971 fn default_retained() -> Retained<Self> {
1972 Self::new()
1973 }
1974}