objc2_metal_performance_shaders/generated/MPSMatrix/
MPSMatrixRandom.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7use objc2_metal::*;
8
9use crate::*;
10
11#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct MPSMatrixRandomDistribution(pub NSUInteger);
16bitflags::bitflags! {
17 impl MPSMatrixRandomDistribution: NSUInteger {
18 #[doc(alias = "MPSMatrixRandomDistributionDefault")]
19 const Default = 1;
20 #[doc(alias = "MPSMatrixRandomDistributionUniform")]
21 const Uniform = 2;
22 #[doc(alias = "MPSMatrixRandomDistributionNormal")]
23 const Normal = 3;
24 }
25}
26
27unsafe impl Encode for MPSMatrixRandomDistribution {
28 const ENCODING: Encoding = NSUInteger::ENCODING;
29}
30
31unsafe impl RefEncode for MPSMatrixRandomDistribution {
32 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35extern_class!(
36 #[unsafe(super(NSObject))]
42 #[derive(Debug, PartialEq, Eq, Hash)]
43 pub struct MPSMatrixRandomDistributionDescriptor;
44);
45
46extern_conformance!(
47 unsafe impl NSCopying for MPSMatrixRandomDistributionDescriptor {}
48);
49
50unsafe impl CopyingHelper for MPSMatrixRandomDistributionDescriptor {
51 type Result = Self;
52}
53
54extern_conformance!(
55 unsafe impl NSObjectProtocol for MPSMatrixRandomDistributionDescriptor {}
56);
57
58impl MPSMatrixRandomDistributionDescriptor {
59 extern_methods!(
60 #[unsafe(method(distributionType))]
62 #[unsafe(method_family = none)]
63 pub unsafe fn distributionType(&self) -> MPSMatrixRandomDistribution;
64
65 #[unsafe(method(setDistributionType:))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn setDistributionType(&self, distribution_type: MPSMatrixRandomDistribution);
69
70 #[unsafe(method(minimum))]
72 #[unsafe(method_family = none)]
73 pub unsafe fn minimum(&self) -> c_float;
74
75 #[unsafe(method(setMinimum:))]
77 #[unsafe(method_family = none)]
78 pub unsafe fn setMinimum(&self, minimum: c_float);
79
80 #[unsafe(method(maximum))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn maximum(&self) -> c_float;
84
85 #[unsafe(method(setMaximum:))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn setMaximum(&self, maximum: c_float);
89
90 #[unsafe(method(mean))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn mean(&self) -> c_float;
94
95 #[unsafe(method(setMean:))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn setMean(&self, mean: c_float);
99
100 #[unsafe(method(standardDeviation))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn standardDeviation(&self) -> c_float;
104
105 #[unsafe(method(setStandardDeviation:))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn setStandardDeviation(&self, standard_deviation: c_float);
109
110 #[unsafe(method(uniformDistributionDescriptorWithMinimum:maximum:))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn uniformDistributionDescriptorWithMinimum_maximum(
121 minimum: c_float,
122 maximum: c_float,
123 ) -> Retained<MPSMatrixRandomDistributionDescriptor>;
124
125 #[unsafe(method(normalDistributionDescriptorWithMean:standardDeviation:))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn normalDistributionDescriptorWithMean_standardDeviation(
135 mean: c_float,
136 standard_deviation: c_float,
137 ) -> Retained<MPSMatrixRandomDistributionDescriptor>;
138
139 #[unsafe(method(normalDistributionDescriptorWithMean:standardDeviation:minimum:maximum:))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn normalDistributionDescriptorWithMean_standardDeviation_minimum_maximum(
153 mean: c_float,
154 standard_deviation: c_float,
155 minimum: c_float,
156 maximum: c_float,
157 ) -> Retained<MPSMatrixRandomDistributionDescriptor>;
158
159 #[unsafe(method(defaultDistributionDescriptor))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn defaultDistributionDescriptor(
165 ) -> Retained<MPSMatrixRandomDistributionDescriptor>;
166 );
167}
168
169impl MPSMatrixRandomDistributionDescriptor {
171 extern_methods!(
172 #[unsafe(method(init))]
173 #[unsafe(method_family = init)]
174 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
175
176 #[unsafe(method(new))]
177 #[unsafe(method_family = new)]
178 pub unsafe fn new() -> Retained<Self>;
179 );
180}
181
182extern_class!(
183 #[unsafe(super(MPSKernel, NSObject))]
187 #[derive(Debug, PartialEq, Eq, Hash)]
188 #[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
189 pub struct MPSMatrixRandom;
190);
191
192#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
193extern_conformance!(
194 unsafe impl NSCoding for MPSMatrixRandom {}
195);
196
197#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
198extern_conformance!(
199 unsafe impl NSCopying for MPSMatrixRandom {}
200);
201
202#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
203unsafe impl CopyingHelper for MPSMatrixRandom {
204 type Result = Self;
205}
206
207#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
208extern_conformance!(
209 unsafe impl NSObjectProtocol for MPSMatrixRandom {}
210);
211
212#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
213extern_conformance!(
214 unsafe impl NSSecureCoding for MPSMatrixRandom {}
215);
216
217#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
218impl MPSMatrixRandom {
219 extern_methods!(
220 #[cfg(feature = "MPSCoreTypes")]
221 #[unsafe(method(destinationDataType))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn destinationDataType(&self) -> MPSDataType;
230
231 #[unsafe(method(distributionType))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn distributionType(&self) -> MPSMatrixRandomDistribution;
237
238 #[unsafe(method(batchStart))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn batchStart(&self) -> NSUInteger;
242
243 #[unsafe(method(setBatchStart:))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn setBatchStart(&self, batch_start: NSUInteger);
247
248 #[unsafe(method(batchSize))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn batchSize(&self) -> NSUInteger;
252
253 #[unsafe(method(setBatchSize:))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn setBatchSize(&self, batch_size: NSUInteger);
257
258 #[unsafe(method(initWithDevice:))]
259 #[unsafe(method_family = init)]
260 pub unsafe fn initWithDevice(
261 this: Allocated<Self>,
262 device: &ProtocolObject<dyn MTLDevice>,
263 ) -> Retained<Self>;
264
265 #[unsafe(method(encodeToCommandBuffer:destinationVector:))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn encodeToCommandBuffer_destinationVector(
273 &self,
274 command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
275 destination_vector: &MPSVector,
276 );
277
278 #[unsafe(method(encodeToCommandBuffer:destinationMatrix:))]
284 #[unsafe(method_family = none)]
285 pub unsafe fn encodeToCommandBuffer_destinationMatrix(
286 &self,
287 command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
288 destination_matrix: &MPSMatrix,
289 );
290 );
291}
292
293#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
295impl MPSMatrixRandom {
296 extern_methods!(
297 #[unsafe(method(initWithCoder:))]
310 #[unsafe(method_family = init)]
311 pub unsafe fn initWithCoder(
312 this: Allocated<Self>,
313 a_decoder: &NSCoder,
314 ) -> Option<Retained<Self>>;
315
316 #[unsafe(method(initWithCoder:device:))]
334 #[unsafe(method_family = init)]
335 pub unsafe fn initWithCoder_device(
336 this: Allocated<Self>,
337 a_decoder: &NSCoder,
338 device: &ProtocolObject<dyn MTLDevice>,
339 ) -> Option<Retained<Self>>;
340 );
341}
342
343#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
345impl MPSMatrixRandom {
346 extern_methods!(
347 #[unsafe(method(init))]
348 #[unsafe(method_family = init)]
349 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
350
351 #[unsafe(method(new))]
352 #[unsafe(method_family = new)]
353 pub unsafe fn new() -> Retained<Self>;
354 );
355}
356
357extern_class!(
358 #[unsafe(super(MPSMatrixRandom, MPSKernel, NSObject))]
365 #[derive(Debug, PartialEq, Eq, Hash)]
366 #[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
367 pub struct MPSMatrixRandomMTGP32;
368);
369
370#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
371extern_conformance!(
372 unsafe impl NSCoding for MPSMatrixRandomMTGP32 {}
373);
374
375#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
376extern_conformance!(
377 unsafe impl NSCopying for MPSMatrixRandomMTGP32 {}
378);
379
380#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
381unsafe impl CopyingHelper for MPSMatrixRandomMTGP32 {
382 type Result = Self;
383}
384
385#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
386extern_conformance!(
387 unsafe impl NSObjectProtocol for MPSMatrixRandomMTGP32 {}
388);
389
390#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
391extern_conformance!(
392 unsafe impl NSSecureCoding for MPSMatrixRandomMTGP32 {}
393);
394
395#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
396impl MPSMatrixRandomMTGP32 {
397 extern_methods!(
398 #[unsafe(method(initWithDevice:))]
403 #[unsafe(method_family = init)]
404 pub unsafe fn initWithDevice(
405 this: Allocated<Self>,
406 device: &ProtocolObject<dyn MTLDevice>,
407 ) -> Retained<Self>;
408
409 #[cfg(feature = "MPSCoreTypes")]
410 #[unsafe(method(initWithDevice:destinationDataType:seed:distributionDescriptor:))]
420 #[unsafe(method_family = init)]
421 pub unsafe fn initWithDevice_destinationDataType_seed_distributionDescriptor(
422 this: Allocated<Self>,
423 device: &ProtocolObject<dyn MTLDevice>,
424 destination_data_type: MPSDataType,
425 seed: NSUInteger,
426 distribution_descriptor: &MPSMatrixRandomDistributionDescriptor,
427 ) -> Retained<Self>;
428
429 #[unsafe(method(synchronizeStateOnCommandBuffer:))]
433 #[unsafe(method_family = none)]
434 pub unsafe fn synchronizeStateOnCommandBuffer(
435 &self,
436 command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
437 );
438
439 #[cfg(feature = "MPSCoreTypes")]
440 #[unsafe(method(initWithDevice:destinationDataType:seed:))]
448 #[unsafe(method_family = init)]
449 pub unsafe fn initWithDevice_destinationDataType_seed(
450 this: Allocated<Self>,
451 device: &ProtocolObject<dyn MTLDevice>,
452 destination_data_type: MPSDataType,
453 seed: NSUInteger,
454 ) -> Retained<Self>;
455
456 #[unsafe(method(initWithCoder:device:))]
460 #[unsafe(method_family = init)]
461 pub unsafe fn initWithCoder_device(
462 this: Allocated<Self>,
463 a_decoder: &NSCoder,
464 device: &ProtocolObject<dyn MTLDevice>,
465 ) -> Option<Retained<Self>>;
466 );
467}
468
469#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
471impl MPSMatrixRandomMTGP32 {
472 extern_methods!(
473 #[unsafe(method(initWithCoder:))]
486 #[unsafe(method_family = init)]
487 pub unsafe fn initWithCoder(
488 this: Allocated<Self>,
489 a_decoder: &NSCoder,
490 ) -> Option<Retained<Self>>;
491 );
492}
493
494#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
496impl MPSMatrixRandomMTGP32 {
497 extern_methods!(
498 #[unsafe(method(init))]
499 #[unsafe(method_family = init)]
500 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
501
502 #[unsafe(method(new))]
503 #[unsafe(method_family = new)]
504 pub unsafe fn new() -> Retained<Self>;
505 );
506}
507
508extern_class!(
509 #[unsafe(super(MPSMatrixRandom, MPSKernel, NSObject))]
515 #[derive(Debug, PartialEq, Eq, Hash)]
516 #[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
517 pub struct MPSMatrixRandomPhilox;
518);
519
520#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
521extern_conformance!(
522 unsafe impl NSCoding for MPSMatrixRandomPhilox {}
523);
524
525#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
526extern_conformance!(
527 unsafe impl NSCopying for MPSMatrixRandomPhilox {}
528);
529
530#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
531unsafe impl CopyingHelper for MPSMatrixRandomPhilox {
532 type Result = Self;
533}
534
535#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
536extern_conformance!(
537 unsafe impl NSObjectProtocol for MPSMatrixRandomPhilox {}
538);
539
540#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
541extern_conformance!(
542 unsafe impl NSSecureCoding for MPSMatrixRandomPhilox {}
543);
544
545#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
546impl MPSMatrixRandomPhilox {
547 extern_methods!(
548 #[unsafe(method(initWithDevice:))]
553 #[unsafe(method_family = init)]
554 pub unsafe fn initWithDevice(
555 this: Allocated<Self>,
556 device: &ProtocolObject<dyn MTLDevice>,
557 ) -> Retained<Self>;
558
559 #[cfg(feature = "MPSCoreTypes")]
560 #[unsafe(method(initWithDevice:destinationDataType:seed:distributionDescriptor:))]
570 #[unsafe(method_family = init)]
571 pub unsafe fn initWithDevice_destinationDataType_seed_distributionDescriptor(
572 this: Allocated<Self>,
573 device: &ProtocolObject<dyn MTLDevice>,
574 destination_data_type: MPSDataType,
575 seed: NSUInteger,
576 distribution_descriptor: &MPSMatrixRandomDistributionDescriptor,
577 ) -> Retained<Self>;
578
579 #[cfg(feature = "MPSCoreTypes")]
580 #[unsafe(method(initWithDevice:destinationDataType:seed:))]
588 #[unsafe(method_family = init)]
589 pub unsafe fn initWithDevice_destinationDataType_seed(
590 this: Allocated<Self>,
591 device: &ProtocolObject<dyn MTLDevice>,
592 destination_data_type: MPSDataType,
593 seed: NSUInteger,
594 ) -> Retained<Self>;
595
596 #[unsafe(method(initWithCoder:device:))]
600 #[unsafe(method_family = init)]
601 pub unsafe fn initWithCoder_device(
602 this: Allocated<Self>,
603 a_decoder: &NSCoder,
604 device: &ProtocolObject<dyn MTLDevice>,
605 ) -> Option<Retained<Self>>;
606 );
607}
608
609#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
611impl MPSMatrixRandomPhilox {
612 extern_methods!(
613 #[unsafe(method(initWithCoder:))]
626 #[unsafe(method_family = init)]
627 pub unsafe fn initWithCoder(
628 this: Allocated<Self>,
629 a_decoder: &NSCoder,
630 ) -> Option<Retained<Self>>;
631 );
632}
633
634#[cfg(all(feature = "MPSCore", feature = "MPSKernel"))]
636impl MPSMatrixRandomPhilox {
637 extern_methods!(
638 #[unsafe(method(init))]
639 #[unsafe(method_family = init)]
640 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
641
642 #[unsafe(method(new))]
643 #[unsafe(method_family = new)]
644 pub unsafe fn new() -> Retained<Self>;
645 );
646}