1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlblendfactor?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLBlendFactor(pub NSUInteger);
impl MTLBlendFactor {
#[doc(alias = "MTLBlendFactorZero")]
pub const Zero: Self = Self(0);
#[doc(alias = "MTLBlendFactorOne")]
pub const One: Self = Self(1);
#[doc(alias = "MTLBlendFactorSourceColor")]
pub const SourceColor: Self = Self(2);
#[doc(alias = "MTLBlendFactorOneMinusSourceColor")]
pub const OneMinusSourceColor: Self = Self(3);
#[doc(alias = "MTLBlendFactorSourceAlpha")]
pub const SourceAlpha: Self = Self(4);
#[doc(alias = "MTLBlendFactorOneMinusSourceAlpha")]
pub const OneMinusSourceAlpha: Self = Self(5);
#[doc(alias = "MTLBlendFactorDestinationColor")]
pub const DestinationColor: Self = Self(6);
#[doc(alias = "MTLBlendFactorOneMinusDestinationColor")]
pub const OneMinusDestinationColor: Self = Self(7);
#[doc(alias = "MTLBlendFactorDestinationAlpha")]
pub const DestinationAlpha: Self = Self(8);
#[doc(alias = "MTLBlendFactorOneMinusDestinationAlpha")]
pub const OneMinusDestinationAlpha: Self = Self(9);
#[doc(alias = "MTLBlendFactorSourceAlphaSaturated")]
pub const SourceAlphaSaturated: Self = Self(10);
#[doc(alias = "MTLBlendFactorBlendColor")]
pub const BlendColor: Self = Self(11);
#[doc(alias = "MTLBlendFactorOneMinusBlendColor")]
pub const OneMinusBlendColor: Self = Self(12);
#[doc(alias = "MTLBlendFactorBlendAlpha")]
pub const BlendAlpha: Self = Self(13);
#[doc(alias = "MTLBlendFactorOneMinusBlendAlpha")]
pub const OneMinusBlendAlpha: Self = Self(14);
#[doc(alias = "MTLBlendFactorSource1Color")]
pub const Source1Color: Self = Self(15);
#[doc(alias = "MTLBlendFactorOneMinusSource1Color")]
pub const OneMinusSource1Color: Self = Self(16);
#[doc(alias = "MTLBlendFactorSource1Alpha")]
pub const Source1Alpha: Self = Self(17);
#[doc(alias = "MTLBlendFactorOneMinusSource1Alpha")]
pub const OneMinusSource1Alpha: Self = Self(18);
/// Defers assigning the blend factor.
///
/// Until you specialize this value in the pipeline state, it:
/// * behaves as `MTLBlendFactorOne` for `sourceRGBBlendFactor` and `sourceAlphaBlendFactor`
/// * behaves as `MTLBlendFactorZero` for `destinationRGBBlendFactor` and `destinationAlphaBlendFactor`
#[doc(alias = "MTLBlendFactorUnspecialized")]
pub const Unspecialized: Self = Self(19);
}
unsafe impl Encode for MTLBlendFactor {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLBlendFactor {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlblendoperation?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLBlendOperation(pub NSUInteger);
impl MTLBlendOperation {
#[doc(alias = "MTLBlendOperationAdd")]
pub const Add: Self = Self(0);
#[doc(alias = "MTLBlendOperationSubtract")]
pub const Subtract: Self = Self(1);
#[doc(alias = "MTLBlendOperationReverseSubtract")]
pub const ReverseSubtract: Self = Self(2);
#[doc(alias = "MTLBlendOperationMin")]
pub const Min: Self = Self(3);
#[doc(alias = "MTLBlendOperationMax")]
pub const Max: Self = Self(4);
/// Defers assigning the blend operation.
#[doc(alias = "MTLBlendOperationUnspecialized")]
pub const Unspecialized: Self = Self(5);
}
unsafe impl Encode for MTLBlendOperation {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLBlendOperation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlcolorwritemask?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLColorWriteMask(pub NSUInteger);
bitflags::bitflags! {
impl MTLColorWriteMask: NSUInteger {
#[doc(alias = "MTLColorWriteMaskNone")]
const None = 0;
#[doc(alias = "MTLColorWriteMaskRed")]
const Red = 0x1<<3;
#[doc(alias = "MTLColorWriteMaskGreen")]
const Green = 0x1<<2;
#[doc(alias = "MTLColorWriteMaskBlue")]
const Blue = 0x1<<1;
#[doc(alias = "MTLColorWriteMaskAlpha")]
const Alpha = 0x1<<0;
#[doc(alias = "MTLColorWriteMaskAll")]
const All = 0xf;
/// Defers assigning the color write mask.
///
/// Until you specialize this value in the pipeline state, it behaves as `MTLColorWriteMaskAll`.
#[doc(alias = "MTLColorWriteMaskUnspecialized")]
const Unspecialized = 0x10;
}
}
unsafe impl Encode for MTLColorWriteMask {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLColorWriteMask {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlprimitivetopologyclass?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLPrimitiveTopologyClass(pub NSUInteger);
impl MTLPrimitiveTopologyClass {
#[doc(alias = "MTLPrimitiveTopologyClassUnspecified")]
pub const Unspecified: Self = Self(0);
#[doc(alias = "MTLPrimitiveTopologyClassPoint")]
pub const Point: Self = Self(1);
#[doc(alias = "MTLPrimitiveTopologyClassLine")]
pub const Line: Self = Self(2);
#[doc(alias = "MTLPrimitiveTopologyClassTriangle")]
pub const Triangle: Self = Self(3);
}
unsafe impl Encode for MTLPrimitiveTopologyClass {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLPrimitiveTopologyClass {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtltessellationpartitionmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLTessellationPartitionMode(pub NSUInteger);
impl MTLTessellationPartitionMode {
#[doc(alias = "MTLTessellationPartitionModePow2")]
pub const Pow2: Self = Self(0);
#[doc(alias = "MTLTessellationPartitionModeInteger")]
pub const Integer: Self = Self(1);
#[doc(alias = "MTLTessellationPartitionModeFractionalOdd")]
pub const FractionalOdd: Self = Self(2);
#[doc(alias = "MTLTessellationPartitionModeFractionalEven")]
pub const FractionalEven: Self = Self(3);
}
unsafe impl Encode for MTLTessellationPartitionMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLTessellationPartitionMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtltessellationfactorstepfunction?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLTessellationFactorStepFunction(pub NSUInteger);
impl MTLTessellationFactorStepFunction {
#[doc(alias = "MTLTessellationFactorStepFunctionConstant")]
pub const Constant: Self = Self(0);
#[doc(alias = "MTLTessellationFactorStepFunctionPerPatch")]
pub const PerPatch: Self = Self(1);
#[doc(alias = "MTLTessellationFactorStepFunctionPerInstance")]
pub const PerInstance: Self = Self(2);
#[doc(alias = "MTLTessellationFactorStepFunctionPerPatchAndPerInstance")]
pub const PerPatchAndPerInstance: Self = Self(3);
}
unsafe impl Encode for MTLTessellationFactorStepFunction {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLTessellationFactorStepFunction {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtltessellationfactorformat?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLTessellationFactorFormat(pub NSUInteger);
impl MTLTessellationFactorFormat {
#[doc(alias = "MTLTessellationFactorFormatHalf")]
pub const Half: Self = Self(0);
}
unsafe impl Encode for MTLTessellationFactorFormat {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLTessellationFactorFormat {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtltessellationcontrolpointindextype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLTessellationControlPointIndexType(pub NSUInteger);
impl MTLTessellationControlPointIndexType {
#[doc(alias = "MTLTessellationControlPointIndexTypeNone")]
pub const None: Self = Self(0);
#[doc(alias = "MTLTessellationControlPointIndexTypeUInt16")]
pub const UInt16: Self = Self(1);
#[doc(alias = "MTLTessellationControlPointIndexTypeUInt32")]
pub const UInt32: Self = Self(2);
}
unsafe impl Encode for MTLTessellationControlPointIndexType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MTLTessellationControlPointIndexType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlrenderpipelinecolorattachmentdescriptor?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRenderPipelineColorAttachmentDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MTLRenderPipelineColorAttachmentDescriptor {}
);
unsafe impl CopyingHelper for MTLRenderPipelineColorAttachmentDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLRenderPipelineColorAttachmentDescriptor {}
);
impl MTLRenderPipelineColorAttachmentDescriptor {
extern_methods!(
#[cfg(feature = "MTLPixelFormat")]
/// Pixel format. Defaults to MTLPixelFormatInvalid
#[unsafe(method(pixelFormat))]
#[unsafe(method_family = none)]
pub fn pixelFormat(&self) -> MTLPixelFormat;
#[cfg(feature = "MTLPixelFormat")]
/// Setter for [`pixelFormat`][Self::pixelFormat].
#[unsafe(method(setPixelFormat:))]
#[unsafe(method_family = none)]
pub fn setPixelFormat(&self, pixel_format: MTLPixelFormat);
/// Enable blending. Defaults to NO.
#[unsafe(method(isBlendingEnabled))]
#[unsafe(method_family = none)]
pub fn isBlendingEnabled(&self) -> bool;
/// Setter for [`isBlendingEnabled`][Self::isBlendingEnabled].
#[unsafe(method(setBlendingEnabled:))]
#[unsafe(method_family = none)]
pub fn setBlendingEnabled(&self, blending_enabled: bool);
/// Defaults to MTLBlendFactorOne
#[unsafe(method(sourceRGBBlendFactor))]
#[unsafe(method_family = none)]
pub fn sourceRGBBlendFactor(&self) -> MTLBlendFactor;
/// Setter for [`sourceRGBBlendFactor`][Self::sourceRGBBlendFactor].
#[unsafe(method(setSourceRGBBlendFactor:))]
#[unsafe(method_family = none)]
pub fn setSourceRGBBlendFactor(&self, source_rgb_blend_factor: MTLBlendFactor);
/// Defaults to MTLBlendFactorZero
#[unsafe(method(destinationRGBBlendFactor))]
#[unsafe(method_family = none)]
pub fn destinationRGBBlendFactor(&self) -> MTLBlendFactor;
/// Setter for [`destinationRGBBlendFactor`][Self::destinationRGBBlendFactor].
#[unsafe(method(setDestinationRGBBlendFactor:))]
#[unsafe(method_family = none)]
pub fn setDestinationRGBBlendFactor(&self, destination_rgb_blend_factor: MTLBlendFactor);
/// Defaults to MTLBlendOperationAdd
#[unsafe(method(rgbBlendOperation))]
#[unsafe(method_family = none)]
pub fn rgbBlendOperation(&self) -> MTLBlendOperation;
/// Setter for [`rgbBlendOperation`][Self::rgbBlendOperation].
#[unsafe(method(setRgbBlendOperation:))]
#[unsafe(method_family = none)]
pub fn setRgbBlendOperation(&self, rgb_blend_operation: MTLBlendOperation);
/// Defaults to MTLBlendFactorOne
#[unsafe(method(sourceAlphaBlendFactor))]
#[unsafe(method_family = none)]
pub fn sourceAlphaBlendFactor(&self) -> MTLBlendFactor;
/// Setter for [`sourceAlphaBlendFactor`][Self::sourceAlphaBlendFactor].
#[unsafe(method(setSourceAlphaBlendFactor:))]
#[unsafe(method_family = none)]
pub fn setSourceAlphaBlendFactor(&self, source_alpha_blend_factor: MTLBlendFactor);
/// Defaults to MTLBlendFactorZero
#[unsafe(method(destinationAlphaBlendFactor))]
#[unsafe(method_family = none)]
pub fn destinationAlphaBlendFactor(&self) -> MTLBlendFactor;
/// Setter for [`destinationAlphaBlendFactor`][Self::destinationAlphaBlendFactor].
#[unsafe(method(setDestinationAlphaBlendFactor:))]
#[unsafe(method_family = none)]
pub fn setDestinationAlphaBlendFactor(
&self,
destination_alpha_blend_factor: MTLBlendFactor,
);
/// Defaults to MTLBlendOperationAdd
#[unsafe(method(alphaBlendOperation))]
#[unsafe(method_family = none)]
pub fn alphaBlendOperation(&self) -> MTLBlendOperation;
/// Setter for [`alphaBlendOperation`][Self::alphaBlendOperation].
#[unsafe(method(setAlphaBlendOperation:))]
#[unsafe(method_family = none)]
pub fn setAlphaBlendOperation(&self, alpha_blend_operation: MTLBlendOperation);
/// Defaults to MTLColorWriteMaskAll
#[unsafe(method(writeMask))]
#[unsafe(method_family = none)]
pub fn writeMask(&self) -> MTLColorWriteMask;
/// Setter for [`writeMask`][Self::writeMask].
#[unsafe(method(setWriteMask:))]
#[unsafe(method_family = none)]
pub fn setWriteMask(&self, write_mask: MTLColorWriteMask);
);
}
/// Methods declared on superclass `NSObject`.
impl MTLRenderPipelineColorAttachmentDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLRenderPipelineColorAttachmentDescriptor {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
/// Allows you to easily specify color attachment remapping from logical to physical indices.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtllogicaltophysicalcolorattachmentmap?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLLogicalToPhysicalColorAttachmentMap;
);
extern_conformance!(
unsafe impl NSCopying for MTLLogicalToPhysicalColorAttachmentMap {}
);
unsafe impl CopyingHelper for MTLLogicalToPhysicalColorAttachmentMap {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLLogicalToPhysicalColorAttachmentMap {}
);
impl MTLLogicalToPhysicalColorAttachmentMap {
extern_methods!(
/// Maps a physical color attachment index to a logical index.
///
/// - Parameters:
/// - physicalIndex: index of the color attachment's physical mapping.
/// - logicalIndex: index of the color attachment's logical mapping.
///
/// # Safety
///
/// - `physicalIndex` might not be bounds-checked.
/// - `logicalIndex` might not be bounds-checked.
#[unsafe(method(setPhysicalIndex:forLogicalIndex:))]
#[unsafe(method_family = none)]
pub unsafe fn setPhysicalIndex_forLogicalIndex(
&self,
physical_index: NSUInteger,
logical_index: NSUInteger,
);
/// Queries the physical color attachment index corresponding to a logical index.
///
/// # Safety
///
/// `logicalIndex` might not be bounds-checked.
#[unsafe(method(getPhysicalIndexForLogicalIndex:))]
#[unsafe(method_family = none)]
pub unsafe fn getPhysicalIndexForLogicalIndex(
&self,
logical_index: NSUInteger,
) -> NSUInteger;
#[unsafe(method(reset))]
#[unsafe(method_family = none)]
pub fn reset(&self);
);
}
/// Methods declared on superclass `NSObject`.
impl MTLLogicalToPhysicalColorAttachmentMap {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLLogicalToPhysicalColorAttachmentMap {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlrenderpipelinereflection?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRenderPipelineReflection;
);
unsafe impl Send for MTLRenderPipelineReflection {}
unsafe impl Sync for MTLRenderPipelineReflection {}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLRenderPipelineReflection {}
);
impl MTLRenderPipelineReflection {
extern_methods!(
#[cfg(feature = "MTLArgument")]
#[unsafe(method(vertexBindings))]
#[unsafe(method_family = none)]
pub fn vertexBindings(&self) -> Retained<NSArray<ProtocolObject<dyn MTLBinding>>>;
#[cfg(feature = "MTLArgument")]
#[unsafe(method(fragmentBindings))]
#[unsafe(method_family = none)]
pub fn fragmentBindings(&self) -> Retained<NSArray<ProtocolObject<dyn MTLBinding>>>;
#[cfg(feature = "MTLArgument")]
#[unsafe(method(tileBindings))]
#[unsafe(method_family = none)]
pub fn tileBindings(&self) -> Retained<NSArray<ProtocolObject<dyn MTLBinding>>>;
#[cfg(feature = "MTLArgument")]
#[unsafe(method(objectBindings))]
#[unsafe(method_family = none)]
pub fn objectBindings(&self) -> Retained<NSArray<ProtocolObject<dyn MTLBinding>>>;
#[cfg(feature = "MTLArgument")]
#[unsafe(method(meshBindings))]
#[unsafe(method_family = none)]
pub fn meshBindings(&self) -> Retained<NSArray<ProtocolObject<dyn MTLBinding>>>;
#[cfg(feature = "MTLArgument")]
#[deprecated]
#[unsafe(method(vertexArguments))]
#[unsafe(method_family = none)]
pub fn vertexArguments(&self) -> Option<Retained<NSArray<MTLArgument>>>;
#[cfg(feature = "MTLArgument")]
#[deprecated]
#[unsafe(method(fragmentArguments))]
#[unsafe(method_family = none)]
pub fn fragmentArguments(&self) -> Option<Retained<NSArray<MTLArgument>>>;
#[cfg(feature = "MTLArgument")]
#[deprecated]
#[unsafe(method(tileArguments))]
#[unsafe(method_family = none)]
pub fn tileArguments(&self) -> Option<Retained<NSArray<MTLArgument>>>;
);
}
/// Methods declared on superclass `NSObject`.
impl MTLRenderPipelineReflection {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLRenderPipelineReflection {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlrenderpipelinedescriptor?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRenderPipelineDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MTLRenderPipelineDescriptor {}
);
unsafe impl CopyingHelper for MTLRenderPipelineDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLRenderPipelineDescriptor {}
);
impl MTLRenderPipelineDescriptor {
extern_methods!(
#[unsafe(method(label))]
#[unsafe(method_family = none)]
pub fn label(&self) -> Option<Retained<NSString>>;
/// Setter for [`label`][Self::label].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setLabel:))]
#[unsafe(method_family = none)]
pub fn setLabel(&self, label: Option<&NSString>);
#[cfg(feature = "MTLLibrary")]
#[unsafe(method(vertexFunction))]
#[unsafe(method_family = none)]
pub fn vertexFunction(&self) -> Option<Retained<ProtocolObject<dyn MTLFunction>>>;
#[cfg(feature = "MTLLibrary")]
/// Setter for [`vertexFunction`][Self::vertexFunction].
#[unsafe(method(setVertexFunction:))]
#[unsafe(method_family = none)]
pub fn setVertexFunction(&self, vertex_function: Option<&ProtocolObject<dyn MTLFunction>>);
#[cfg(feature = "MTLLibrary")]
#[unsafe(method(fragmentFunction))]
#[unsafe(method_family = none)]
pub fn fragmentFunction(&self) -> Option<Retained<ProtocolObject<dyn MTLFunction>>>;
#[cfg(feature = "MTLLibrary")]
/// Setter for [`fragmentFunction`][Self::fragmentFunction].
#[unsafe(method(setFragmentFunction:))]
#[unsafe(method_family = none)]
pub fn setFragmentFunction(
&self,
fragment_function: Option<&ProtocolObject<dyn MTLFunction>>,
);
#[cfg(feature = "MTLVertexDescriptor")]
#[unsafe(method(vertexDescriptor))]
#[unsafe(method_family = none)]
pub fn vertexDescriptor(&self) -> Option<Retained<MTLVertexDescriptor>>;
#[cfg(feature = "MTLVertexDescriptor")]
/// Setter for [`vertexDescriptor`][Self::vertexDescriptor].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setVertexDescriptor:))]
#[unsafe(method_family = none)]
pub fn setVertexDescriptor(&self, vertex_descriptor: Option<&MTLVertexDescriptor>);
#[deprecated]
#[unsafe(method(sampleCount))]
#[unsafe(method_family = none)]
pub fn sampleCount(&self) -> NSUInteger;
/// Setter for [`sampleCount`][Self::sampleCount].
#[deprecated]
#[unsafe(method(setSampleCount:))]
#[unsafe(method_family = none)]
pub fn setSampleCount(&self, sample_count: NSUInteger);
#[unsafe(method(rasterSampleCount))]
#[unsafe(method_family = none)]
pub fn rasterSampleCount(&self) -> NSUInteger;
/// Setter for [`rasterSampleCount`][Self::rasterSampleCount].
#[unsafe(method(setRasterSampleCount:))]
#[unsafe(method_family = none)]
pub fn setRasterSampleCount(&self, raster_sample_count: NSUInteger);
#[unsafe(method(isAlphaToCoverageEnabled))]
#[unsafe(method_family = none)]
pub fn isAlphaToCoverageEnabled(&self) -> bool;
/// Setter for [`isAlphaToCoverageEnabled`][Self::isAlphaToCoverageEnabled].
#[unsafe(method(setAlphaToCoverageEnabled:))]
#[unsafe(method_family = none)]
pub fn setAlphaToCoverageEnabled(&self, alpha_to_coverage_enabled: bool);
#[unsafe(method(isAlphaToOneEnabled))]
#[unsafe(method_family = none)]
pub fn isAlphaToOneEnabled(&self) -> bool;
/// Setter for [`isAlphaToOneEnabled`][Self::isAlphaToOneEnabled].
#[unsafe(method(setAlphaToOneEnabled:))]
#[unsafe(method_family = none)]
pub fn setAlphaToOneEnabled(&self, alpha_to_one_enabled: bool);
#[unsafe(method(isRasterizationEnabled))]
#[unsafe(method_family = none)]
pub fn isRasterizationEnabled(&self) -> bool;
/// Setter for [`isRasterizationEnabled`][Self::isRasterizationEnabled].
#[unsafe(method(setRasterizationEnabled:))]
#[unsafe(method_family = none)]
pub fn setRasterizationEnabled(&self, rasterization_enabled: bool);
#[unsafe(method(maxVertexAmplificationCount))]
#[unsafe(method_family = none)]
pub fn maxVertexAmplificationCount(&self) -> NSUInteger;
/// Setter for [`maxVertexAmplificationCount`][Self::maxVertexAmplificationCount].
///
/// # Safety
///
/// This might not be bounds-checked.
#[unsafe(method(setMaxVertexAmplificationCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setMaxVertexAmplificationCount(
&self,
max_vertex_amplification_count: NSUInteger,
);
#[unsafe(method(colorAttachments))]
#[unsafe(method_family = none)]
pub fn colorAttachments(&self)
-> Retained<MTLRenderPipelineColorAttachmentDescriptorArray>;
#[cfg(feature = "MTLPixelFormat")]
#[unsafe(method(depthAttachmentPixelFormat))]
#[unsafe(method_family = none)]
pub fn depthAttachmentPixelFormat(&self) -> MTLPixelFormat;
#[cfg(feature = "MTLPixelFormat")]
/// Setter for [`depthAttachmentPixelFormat`][Self::depthAttachmentPixelFormat].
#[unsafe(method(setDepthAttachmentPixelFormat:))]
#[unsafe(method_family = none)]
pub fn setDepthAttachmentPixelFormat(&self, depth_attachment_pixel_format: MTLPixelFormat);
#[cfg(feature = "MTLPixelFormat")]
#[unsafe(method(stencilAttachmentPixelFormat))]
#[unsafe(method_family = none)]
pub fn stencilAttachmentPixelFormat(&self) -> MTLPixelFormat;
#[cfg(feature = "MTLPixelFormat")]
/// Setter for [`stencilAttachmentPixelFormat`][Self::stencilAttachmentPixelFormat].
#[unsafe(method(setStencilAttachmentPixelFormat:))]
#[unsafe(method_family = none)]
pub fn setStencilAttachmentPixelFormat(
&self,
stencil_attachment_pixel_format: MTLPixelFormat,
);
#[unsafe(method(inputPrimitiveTopology))]
#[unsafe(method_family = none)]
pub fn inputPrimitiveTopology(&self) -> MTLPrimitiveTopologyClass;
/// Setter for [`inputPrimitiveTopology`][Self::inputPrimitiveTopology].
#[unsafe(method(setInputPrimitiveTopology:))]
#[unsafe(method_family = none)]
pub unsafe fn setInputPrimitiveTopology(
&self,
input_primitive_topology: MTLPrimitiveTopologyClass,
);
#[unsafe(method(tessellationPartitionMode))]
#[unsafe(method_family = none)]
pub fn tessellationPartitionMode(&self) -> MTLTessellationPartitionMode;
/// Setter for [`tessellationPartitionMode`][Self::tessellationPartitionMode].
#[unsafe(method(setTessellationPartitionMode:))]
#[unsafe(method_family = none)]
pub unsafe fn setTessellationPartitionMode(
&self,
tessellation_partition_mode: MTLTessellationPartitionMode,
);
#[unsafe(method(maxTessellationFactor))]
#[unsafe(method_family = none)]
pub fn maxTessellationFactor(&self) -> NSUInteger;
/// Setter for [`maxTessellationFactor`][Self::maxTessellationFactor].
#[unsafe(method(setMaxTessellationFactor:))]
#[unsafe(method_family = none)]
pub unsafe fn setMaxTessellationFactor(&self, max_tessellation_factor: NSUInteger);
#[unsafe(method(isTessellationFactorScaleEnabled))]
#[unsafe(method_family = none)]
pub fn isTessellationFactorScaleEnabled(&self) -> bool;
/// Setter for [`isTessellationFactorScaleEnabled`][Self::isTessellationFactorScaleEnabled].
#[unsafe(method(setTessellationFactorScaleEnabled:))]
#[unsafe(method_family = none)]
pub fn setTessellationFactorScaleEnabled(&self, tessellation_factor_scale_enabled: bool);
#[unsafe(method(tessellationFactorFormat))]
#[unsafe(method_family = none)]
pub fn tessellationFactorFormat(&self) -> MTLTessellationFactorFormat;
/// Setter for [`tessellationFactorFormat`][Self::tessellationFactorFormat].
#[unsafe(method(setTessellationFactorFormat:))]
#[unsafe(method_family = none)]
pub fn setTessellationFactorFormat(
&self,
tessellation_factor_format: MTLTessellationFactorFormat,
);
#[unsafe(method(tessellationControlPointIndexType))]
#[unsafe(method_family = none)]
pub fn tessellationControlPointIndexType(&self) -> MTLTessellationControlPointIndexType;
/// Setter for [`tessellationControlPointIndexType`][Self::tessellationControlPointIndexType].
#[unsafe(method(setTessellationControlPointIndexType:))]
#[unsafe(method_family = none)]
pub unsafe fn setTessellationControlPointIndexType(
&self,
tessellation_control_point_index_type: MTLTessellationControlPointIndexType,
);
#[unsafe(method(tessellationFactorStepFunction))]
#[unsafe(method_family = none)]
pub fn tessellationFactorStepFunction(&self) -> MTLTessellationFactorStepFunction;
/// Setter for [`tessellationFactorStepFunction`][Self::tessellationFactorStepFunction].
#[unsafe(method(setTessellationFactorStepFunction:))]
#[unsafe(method_family = none)]
pub fn setTessellationFactorStepFunction(
&self,
tessellation_factor_step_function: MTLTessellationFactorStepFunction,
);
#[cfg(feature = "MTLRenderCommandEncoder")]
#[unsafe(method(tessellationOutputWindingOrder))]
#[unsafe(method_family = none)]
pub fn tessellationOutputWindingOrder(&self) -> MTLWinding;
#[cfg(feature = "MTLRenderCommandEncoder")]
/// Setter for [`tessellationOutputWindingOrder`][Self::tessellationOutputWindingOrder].
#[unsafe(method(setTessellationOutputWindingOrder:))]
#[unsafe(method_family = none)]
pub fn setTessellationOutputWindingOrder(
&self,
tessellation_output_winding_order: MTLWinding,
);
#[cfg(feature = "MTLPipeline")]
#[unsafe(method(vertexBuffers))]
#[unsafe(method_family = none)]
pub fn vertexBuffers(&self) -> Retained<MTLPipelineBufferDescriptorArray>;
#[cfg(feature = "MTLPipeline")]
#[unsafe(method(fragmentBuffers))]
#[unsafe(method_family = none)]
pub fn fragmentBuffers(&self) -> Retained<MTLPipelineBufferDescriptorArray>;
#[unsafe(method(supportIndirectCommandBuffers))]
#[unsafe(method_family = none)]
pub fn supportIndirectCommandBuffers(&self) -> bool;
/// Setter for [`supportIndirectCommandBuffers`][Self::supportIndirectCommandBuffers].
#[unsafe(method(setSupportIndirectCommandBuffers:))]
#[unsafe(method_family = none)]
pub fn setSupportIndirectCommandBuffers(&self, support_indirect_command_buffers: bool);
#[cfg(feature = "MTLBinaryArchive")]
/// The set of MTLBinaryArchive to search for compiled code when creating the pipeline state.
///
/// Accelerate pipeline state creation by providing archives of compiled code such that no compilation needs to happen on the fast path.
///
/// See: MTLBinaryArchive
#[unsafe(method(binaryArchives))]
#[unsafe(method_family = none)]
pub fn binaryArchives(
&self,
) -> Option<Retained<NSArray<ProtocolObject<dyn MTLBinaryArchive>>>>;
#[cfg(feature = "MTLBinaryArchive")]
/// Setter for [`binaryArchives`][Self::binaryArchives].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setBinaryArchives:))]
#[unsafe(method_family = none)]
pub fn setBinaryArchives(
&self,
binary_archives: Option<&NSArray<ProtocolObject<dyn MTLBinaryArchive>>>,
);
#[cfg(feature = "MTLDynamicLibrary")]
/// The set of MTLDynamicLibrary to use to resolve external symbols for the vertexFunction before considering symbols from dependent MTLDynamicLibrary.
///
/// Typical workflows use the libraries property of MTLCompileOptions to record dependent libraries at compile time without having to use vertexPreloadedLibraries.
/// This property can be used to override symbols from dependent libraries for experimentation or evaluating alternative implementations.
/// It can also be used to provide dynamic libraries that are dynamically created (for example, from source) that have no stable installName that can be used to automatically load from the file system.
///
/// See: MTLDynamicLibrary
#[unsafe(method(vertexPreloadedLibraries))]
#[unsafe(method_family = none)]
pub fn vertexPreloadedLibraries(
&self,
) -> Retained<NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>;
#[cfg(feature = "MTLDynamicLibrary")]
/// Setter for [`vertexPreloadedLibraries`][Self::vertexPreloadedLibraries].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setVertexPreloadedLibraries:))]
#[unsafe(method_family = none)]
pub fn setVertexPreloadedLibraries(
&self,
vertex_preloaded_libraries: &NSArray<ProtocolObject<dyn MTLDynamicLibrary>>,
);
#[cfg(feature = "MTLDynamicLibrary")]
/// The set of MTLDynamicLibrary to use to resolve external symbols for the fragmentFunction before considering symbols from dependent MTLDynamicLibrary.
///
/// Typical workflows use the libraries property of MTLCompileOptions to record dependent libraries at compile time without having to use fragmentPreloadedLibraries.
/// This property can be used to override symbols from dependent libraries for experimentation or evaluating alternative implementations.
/// It can also be used to provide dynamic libraries that are dynamically created (for example, from source) that have no stable installName that can be used to automatically load from the file system.
///
/// See: MTLDynamicLibrary
#[unsafe(method(fragmentPreloadedLibraries))]
#[unsafe(method_family = none)]
pub fn fragmentPreloadedLibraries(
&self,
) -> Retained<NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>;
#[cfg(feature = "MTLDynamicLibrary")]
/// Setter for [`fragmentPreloadedLibraries`][Self::fragmentPreloadedLibraries].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setFragmentPreloadedLibraries:))]
#[unsafe(method_family = none)]
pub fn setFragmentPreloadedLibraries(
&self,
fragment_preloaded_libraries: &NSArray<ProtocolObject<dyn MTLDynamicLibrary>>,
);
#[cfg(feature = "MTLLinkedFunctions")]
/// The set of functions to be linked with the pipeline state and accessed from the vertex function.
///
/// See: MTLLinkedFunctions
#[unsafe(method(vertexLinkedFunctions))]
#[unsafe(method_family = none)]
pub fn vertexLinkedFunctions(&self) -> Retained<MTLLinkedFunctions>;
#[cfg(feature = "MTLLinkedFunctions")]
/// Setter for [`vertexLinkedFunctions`][Self::vertexLinkedFunctions].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setVertexLinkedFunctions:))]
#[unsafe(method_family = none)]
pub fn setVertexLinkedFunctions(
&self,
vertex_linked_functions: Option<&MTLLinkedFunctions>,
);
#[cfg(feature = "MTLLinkedFunctions")]
/// The set of functions to be linked with the pipeline state and accessed from the fragment function.
///
/// See: MTLLinkedFunctions
#[unsafe(method(fragmentLinkedFunctions))]
#[unsafe(method_family = none)]
pub fn fragmentLinkedFunctions(&self) -> Retained<MTLLinkedFunctions>;
#[cfg(feature = "MTLLinkedFunctions")]
/// Setter for [`fragmentLinkedFunctions`][Self::fragmentLinkedFunctions].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setFragmentLinkedFunctions:))]
#[unsafe(method_family = none)]
pub fn setFragmentLinkedFunctions(
&self,
fragment_linked_functions: Option<&MTLLinkedFunctions>,
);
/// This flag makes this pipeline support creating a new pipeline by adding binary functions.
#[unsafe(method(supportAddingVertexBinaryFunctions))]
#[unsafe(method_family = none)]
pub fn supportAddingVertexBinaryFunctions(&self) -> bool;
/// Setter for [`supportAddingVertexBinaryFunctions`][Self::supportAddingVertexBinaryFunctions].
#[unsafe(method(setSupportAddingVertexBinaryFunctions:))]
#[unsafe(method_family = none)]
pub fn setSupportAddingVertexBinaryFunctions(
&self,
support_adding_vertex_binary_functions: bool,
);
/// This flag makes this pipeline support creating a new pipeline by adding binary functions.
#[unsafe(method(supportAddingFragmentBinaryFunctions))]
#[unsafe(method_family = none)]
pub fn supportAddingFragmentBinaryFunctions(&self) -> bool;
/// Setter for [`supportAddingFragmentBinaryFunctions`][Self::supportAddingFragmentBinaryFunctions].
#[unsafe(method(setSupportAddingFragmentBinaryFunctions:))]
#[unsafe(method_family = none)]
pub fn setSupportAddingFragmentBinaryFunctions(
&self,
support_adding_fragment_binary_functions: bool,
);
/// The maximum depth of the call stack in stack frames from the shader. Defaults to 1 additional stack frame.
#[unsafe(method(maxVertexCallStackDepth))]
#[unsafe(method_family = none)]
pub fn maxVertexCallStackDepth(&self) -> NSUInteger;
/// Setter for [`maxVertexCallStackDepth`][Self::maxVertexCallStackDepth].
#[unsafe(method(setMaxVertexCallStackDepth:))]
#[unsafe(method_family = none)]
pub fn setMaxVertexCallStackDepth(&self, max_vertex_call_stack_depth: NSUInteger);
/// The maximum depth of the call stack in stack frames from the shader. Defaults to 1 additional stack frame.
#[unsafe(method(maxFragmentCallStackDepth))]
#[unsafe(method_family = none)]
pub fn maxFragmentCallStackDepth(&self) -> NSUInteger;
/// Setter for [`maxFragmentCallStackDepth`][Self::maxFragmentCallStackDepth].
#[unsafe(method(setMaxFragmentCallStackDepth:))]
#[unsafe(method_family = none)]
pub fn setMaxFragmentCallStackDepth(&self, max_fragment_call_stack_depth: NSUInteger);
/// Restore all pipeline descriptor properties to their default values.
#[unsafe(method(reset))]
#[unsafe(method_family = none)]
pub fn reset(&self);
#[cfg(feature = "MTLPipeline")]
/// Toggle that determines whether Metal Shader Validation should be enabled or disabled for the pipeline.
///
/// The value can be overridden using `MTL_SHADER_VALIDATION_ENABLE_PIPELINES` or `MTL_SHADER_VALIDATION_DISABLE_PIPELINES` Environment Variables.
#[unsafe(method(shaderValidation))]
#[unsafe(method_family = none)]
pub fn shaderValidation(&self) -> MTLShaderValidation;
#[cfg(feature = "MTLPipeline")]
/// Setter for [`shaderValidation`][Self::shaderValidation].
#[unsafe(method(setShaderValidation:))]
#[unsafe(method_family = none)]
pub fn setShaderValidation(&self, shader_validation: MTLShaderValidation);
);
}
/// Methods declared on superclass `NSObject`.
impl MTLRenderPipelineDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLRenderPipelineDescriptor {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlrenderpipelinefunctionsdescriptor?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRenderPipelineFunctionsDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MTLRenderPipelineFunctionsDescriptor {}
);
unsafe impl CopyingHelper for MTLRenderPipelineFunctionsDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLRenderPipelineFunctionsDescriptor {}
);
impl MTLRenderPipelineFunctionsDescriptor {
extern_methods!(
#[cfg(feature = "MTLLibrary")]
/// The set of additional binary functions to be accessed from the vertex function in an incrementally created pipeline state.
#[unsafe(method(vertexAdditionalBinaryFunctions))]
#[unsafe(method_family = none)]
pub fn vertexAdditionalBinaryFunctions(
&self,
) -> Option<Retained<NSArray<ProtocolObject<dyn MTLFunction>>>>;
#[cfg(feature = "MTLLibrary")]
/// Setter for [`vertexAdditionalBinaryFunctions`][Self::vertexAdditionalBinaryFunctions].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
///
/// # Safety
///
/// - `vertex_additional_binary_functions` generic must be safe to call.
/// - `vertex_additional_binary_functions` generic must have the correct argument and return types.
#[unsafe(method(setVertexAdditionalBinaryFunctions:))]
#[unsafe(method_family = none)]
pub unsafe fn setVertexAdditionalBinaryFunctions(
&self,
vertex_additional_binary_functions: Option<&NSArray<ProtocolObject<dyn MTLFunction>>>,
);
#[cfg(feature = "MTLLibrary")]
/// The set of additional binary functions to be accessed from the fragment function in an incrementally created pipeline state.
#[unsafe(method(fragmentAdditionalBinaryFunctions))]
#[unsafe(method_family = none)]
pub fn fragmentAdditionalBinaryFunctions(
&self,
) -> Option<Retained<NSArray<ProtocolObject<dyn MTLFunction>>>>;
#[cfg(feature = "MTLLibrary")]
/// Setter for [`fragmentAdditionalBinaryFunctions`][Self::fragmentAdditionalBinaryFunctions].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
///
/// # Safety
///
/// - `fragment_additional_binary_functions` generic must be safe to call.
/// - `fragment_additional_binary_functions` generic must have the correct argument and return types.
#[unsafe(method(setFragmentAdditionalBinaryFunctions:))]
#[unsafe(method_family = none)]
pub unsafe fn setFragmentAdditionalBinaryFunctions(
&self,
fragment_additional_binary_functions: Option<&NSArray<ProtocolObject<dyn MTLFunction>>>,
);
#[cfg(feature = "MTLLibrary")]
/// The set of additional binary functions to be accessed from the tile function in an incrementally created pipeline state.
#[unsafe(method(tileAdditionalBinaryFunctions))]
#[unsafe(method_family = none)]
pub fn tileAdditionalBinaryFunctions(
&self,
) -> Option<Retained<NSArray<ProtocolObject<dyn MTLFunction>>>>;
#[cfg(feature = "MTLLibrary")]
/// Setter for [`tileAdditionalBinaryFunctions`][Self::tileAdditionalBinaryFunctions].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
///
/// # Safety
///
/// - `tile_additional_binary_functions` generic must be safe to call.
/// - `tile_additional_binary_functions` generic must have the correct argument and return types.
#[unsafe(method(setTileAdditionalBinaryFunctions:))]
#[unsafe(method_family = none)]
pub unsafe fn setTileAdditionalBinaryFunctions(
&self,
tile_additional_binary_functions: Option<&NSArray<ProtocolObject<dyn MTLFunction>>>,
);
);
}
/// Methods declared on superclass `NSObject`.
impl MTLRenderPipelineFunctionsDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLRenderPipelineFunctionsDescriptor {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
/// MTLRenderPipelineState represents a compiled render pipeline
///
///
/// MTLRenderPipelineState is a compiled render pipeline and can be set on a MTLRenderCommandEncoder.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlrenderpipelinestate?language=objc)
#[cfg(feature = "MTLAllocation")]
pub unsafe trait MTLRenderPipelineState:
MTLAllocation + NSObjectProtocol + Send + Sync
{
#[unsafe(method(label))]
#[unsafe(method_family = none)]
fn label(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "MTLDevice")]
#[unsafe(method(device))]
#[unsafe(method_family = none)]
fn device(&self) -> Retained<ProtocolObject<dyn MTLDevice>>;
/// Obtains a reflection object for this render pipeline.
///
/// When you create the pipeline through an ``MTLDevice`` instance, reflection is `nil`.
#[unsafe(method(reflection))]
#[unsafe(method_family = none)]
fn reflection(&self) -> Option<Retained<MTLRenderPipelineReflection>>;
#[cfg(all(feature = "MTLFunctionHandle", feature = "MTLRenderCommandEncoder"))]
/// Obtains a function handle for the a specific function this pipeline links at the Metal IR level.
///
/// - Parameters:
/// - name: A string containing the name of the function.
/// - stage: The shader stage that uses the function.
///
/// - Returns: a function handle representing the function if present, otherwise `nil`.
#[unsafe(method(functionHandleWithName:stage:))]
#[unsafe(method_family = none)]
fn functionHandleWithName_stage(
&self,
name: &NSString,
stage: MTLRenderStages,
) -> Option<Retained<ProtocolObject<dyn MTLFunctionHandle>>>;
#[cfg(all(
feature = "MTL4BinaryFunction",
feature = "MTLFunctionHandle",
feature = "MTLRenderCommandEncoder"
))]
/// Obtains the function handle for a specific function this pipeline state links at the binary level.
///
/// - Parameters:
/// - function: a binary function to retrieve the handle.
/// - stage: The shader stage that uses the function.
///
/// - Returns: a function handle representing the function if present, otherwise `nil`.
#[unsafe(method(functionHandleWithBinaryFunction:stage:))]
#[unsafe(method_family = none)]
fn functionHandleWithBinaryFunction_stage(
&self,
function: &ProtocolObject<dyn MTL4BinaryFunction>,
stage: MTLRenderStages,
) -> Option<Retained<ProtocolObject<dyn MTLFunctionHandle>>>;
#[cfg(feature = "MTL4RenderPipeline")]
/// Creates a new render pipeline state by adding binary functions to each stage of this pipeline
/// state.
///
/// - Parameters:
/// - binaryFunctionsDescriptor: A non-`nil` dynamic linking descriptor.
/// - error: An optional pointer that Metal populates with information in case of an error.
///
/// - Returns: A new render pipeline state upon success, otherwise `nil`.
#[unsafe(method(newRenderPipelineStateWithBinaryFunctions:error:_))]
#[unsafe(method_family = new)]
fn newRenderPipelineStateWithBinaryFunctions_error(
&self,
binary_functions_descriptor: &MTL4RenderPipelineBinaryFunctionsDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLRenderPipelineState>>, Retained<NSError>>;
#[cfg(feature = "MTL4PipelineState")]
/// Creates a render pipeline descriptor from this pipeline that you can use for pipeline specialization.
///
/// Use this method to obtain a new ``MTL4PipelineDescriptor`` instance that you can use to specialize any unspecialized
/// properties in this pipeline state object.
///
/// The returned descriptor contains every unspecialized field in the current pipeline state object, set to unspecialized.
/// It may, however, not contain valid or accurate properties in any other field.
///
/// This descriptor is only valid for the purpose of calling specialization functions on the ``MTL4Compiler`` to
/// specialize this pipeline, for example: ``MTL4Compiler/newRenderPipelineStateBySpecializationWithDescriptor:pipeline:error:``.
///
/// Although this method returns the ``MTL4PipelineDescriptor`` base class, the concrete instance this method returns
/// corresponds to the specific descriptor type for the creation of this pipeline state, for example if a ``MTL4Compiler``
/// instance creates this current pipeline form a ``MTLTileRenderPipelineDescriptor``, this method returns a concrete
/// ``MTLTileRenderPipelineDescriptor`` instance.
///
/// - Returns: a new pipeline descriptor that you use for pipeline state specialization.
#[unsafe(method(newRenderPipelineDescriptorForSpecialization))]
#[unsafe(method_family = new)]
fn newRenderPipelineDescriptorForSpecialization(&self) -> Retained<MTL4PipelineDescriptor>;
/// The maximum total number of threads that can be in a single tile shader threadgroup.
#[unsafe(method(maxTotalThreadsPerThreadgroup))]
#[unsafe(method_family = none)]
fn maxTotalThreadsPerThreadgroup(&self) -> NSUInteger;
/// Returns true when the pipeline state requires a tile shader threadgroup size equal to the tile size
#[unsafe(method(threadgroupSizeMatchesTileSize))]
#[unsafe(method_family = none)]
fn threadgroupSizeMatchesTileSize(&self) -> bool;
/// Returns imageblock memory length used by a single sample when rendered using this pipeline.
#[unsafe(method(imageblockSampleLength))]
#[unsafe(method_family = none)]
fn imageblockSampleLength(&self) -> NSUInteger;
#[cfg(feature = "MTLTypes")]
/// Returns imageblock memory length for given image block dimensions. Dimensions must be valid tile dimensions.
#[unsafe(method(imageblockMemoryLengthForDimensions:))]
#[unsafe(method_family = none)]
fn imageblockMemoryLengthForDimensions(&self, imageblock_dimensions: MTLSize)
-> NSUInteger;
#[unsafe(method(supportIndirectCommandBuffers))]
#[unsafe(method_family = none)]
fn supportIndirectCommandBuffers(&self) -> bool;
/// The maximum total number of threads that can be in a single object shader threadgroup.
///
/// This value is set in MTLMeshRenderPipelineDescriptor.
#[unsafe(method(maxTotalThreadsPerObjectThreadgroup))]
#[unsafe(method_family = none)]
fn maxTotalThreadsPerObjectThreadgroup(&self) -> NSUInteger;
/// The maximum total number of threads that can be in a single mesh shader threadgroup.
///
/// This value is set in MTLMeshRenderPipelineDescriptor.
#[unsafe(method(maxTotalThreadsPerMeshThreadgroup))]
#[unsafe(method_family = none)]
fn maxTotalThreadsPerMeshThreadgroup(&self) -> NSUInteger;
/// The number of threads in a SIMD group of the object shader.
///
/// This value is also available in the shader with the [[threads_per_simdgroup]] attribute.
#[unsafe(method(objectThreadExecutionWidth))]
#[unsafe(method_family = none)]
fn objectThreadExecutionWidth(&self) -> NSUInteger;
/// The number of threads in a SIMD group of the mesh shader.
///
/// This value is also available in the shader with the [[threads_per_simdgroup]] attribute.
#[unsafe(method(meshThreadExecutionWidth))]
#[unsafe(method_family = none)]
fn meshThreadExecutionWidth(&self) -> NSUInteger;
/// The maximum total number of threadgroups that can be in a single mesh shader grid.
///
/// This value is set in MTLMeshRenderPipelineDescriptor.
#[unsafe(method(maxTotalThreadgroupsPerMeshGrid))]
#[unsafe(method_family = none)]
fn maxTotalThreadgroupsPerMeshGrid(&self) -> NSUInteger;
#[cfg(feature = "MTLTypes")]
/// Handle of the GPU resource suitable for storing in an Argument Buffer
#[unsafe(method(gpuResourceID))]
#[unsafe(method_family = none)]
fn gpuResourceID(&self) -> MTLResourceID;
#[cfg(all(
feature = "MTLFunctionHandle",
feature = "MTLLibrary",
feature = "MTLRenderCommandEncoder"
))]
/// Gets the function handle for the specified function on the specified stage of the pipeline.
///
/// # Safety
///
/// - `function` must be safe to call.
/// - `function` must have the correct argument and return types.
#[unsafe(method(functionHandleWithFunction:stage:))]
#[unsafe(method_family = none)]
unsafe fn functionHandleWithFunction_stage(
&self,
function: &ProtocolObject<dyn MTLFunction>,
stage: MTLRenderStages,
) -> Option<Retained<ProtocolObject<dyn MTLFunctionHandle>>>;
#[cfg(all(
feature = "MTLRenderCommandEncoder",
feature = "MTLResource",
feature = "MTLVisibleFunctionTable"
))]
/// Allocate a visible function table for the specified stage of the pipeline with the provided descriptor.
#[unsafe(method(newVisibleFunctionTableWithDescriptor:stage:))]
#[unsafe(method_family = new)]
fn newVisibleFunctionTableWithDescriptor_stage(
&self,
descriptor: &MTLVisibleFunctionTableDescriptor,
stage: MTLRenderStages,
) -> Option<Retained<ProtocolObject<dyn MTLVisibleFunctionTable>>>;
#[cfg(all(
feature = "MTLIntersectionFunctionTable",
feature = "MTLRenderCommandEncoder",
feature = "MTLResource"
))]
/// Allocate an intersection function table for the specified stage of the pipeline with the provided descriptor.
#[unsafe(method(newIntersectionFunctionTableWithDescriptor:stage:))]
#[unsafe(method_family = new)]
fn newIntersectionFunctionTableWithDescriptor_stage(
&self,
descriptor: &MTLIntersectionFunctionTableDescriptor,
stage: MTLRenderStages,
) -> Option<Retained<ProtocolObject<dyn MTLIntersectionFunctionTable>>>;
/// Allocate a new render pipeline state by adding binary functions for each stage of this pipeline state.
#[unsafe(method(newRenderPipelineStateWithAdditionalBinaryFunctions:error:_))]
#[unsafe(method_family = new)]
fn newRenderPipelineStateWithAdditionalBinaryFunctions_error(
&self,
additional_binary_functions: &MTLRenderPipelineFunctionsDescriptor,
) -> Result<Retained<ProtocolObject<dyn MTLRenderPipelineState>>, Retained<NSError>>;
#[cfg(feature = "MTLPipeline")]
/// Current state of Shader Validation for the pipeline.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(shaderValidation))]
#[unsafe(method_family = none)]
unsafe fn shaderValidation(&self) -> MTLShaderValidation;
#[cfg(feature = "MTLTypes")]
/// The required size of every tile shader threadgroup.
#[unsafe(method(requiredThreadsPerTileThreadgroup))]
#[unsafe(method_family = none)]
fn requiredThreadsPerTileThreadgroup(&self) -> MTLSize;
#[cfg(feature = "MTLTypes")]
/// The required size of every object shader threadgroup.
///
/// This value is set in MTLMeshRenderPipelineDescriptor.
#[unsafe(method(requiredThreadsPerObjectThreadgroup))]
#[unsafe(method_family = none)]
fn requiredThreadsPerObjectThreadgroup(&self) -> MTLSize;
#[cfg(feature = "MTLTypes")]
/// The required size of every mesh shader threadgroup.
///
/// This value is set in MTLMeshRenderPipelineDescriptor.
#[unsafe(method(requiredThreadsPerMeshThreadgroup))]
#[unsafe(method_family = none)]
fn requiredThreadsPerMeshThreadgroup(&self) -> MTLSize;
}
);
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlrenderpipelinecolorattachmentdescriptorarray?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLRenderPipelineColorAttachmentDescriptorArray;
);
extern_conformance!(
unsafe impl NSObjectProtocol for MTLRenderPipelineColorAttachmentDescriptorArray {}
);
impl MTLRenderPipelineColorAttachmentDescriptorArray {
extern_methods!(
/// # Safety
///
/// `attachmentIndex` might not be bounds-checked.
#[unsafe(method(objectAtIndexedSubscript:))]
#[unsafe(method_family = none)]
pub unsafe fn objectAtIndexedSubscript(
&self,
attachment_index: NSUInteger,
) -> Retained<MTLRenderPipelineColorAttachmentDescriptor>;
/// # Safety
///
/// `attachmentIndex` might not be bounds-checked.
#[unsafe(method(setObject:atIndexedSubscript:))]
#[unsafe(method_family = none)]
pub unsafe fn setObject_atIndexedSubscript(
&self,
attachment: Option<&MTLRenderPipelineColorAttachmentDescriptor>,
attachment_index: NSUInteger,
);
);
}
/// Methods declared on superclass `NSObject`.
impl MTLRenderPipelineColorAttachmentDescriptorArray {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLRenderPipelineColorAttachmentDescriptorArray {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtltilerenderpipelinecolorattachmentdescriptor?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLTileRenderPipelineColorAttachmentDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MTLTileRenderPipelineColorAttachmentDescriptor {}
);
unsafe impl CopyingHelper for MTLTileRenderPipelineColorAttachmentDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLTileRenderPipelineColorAttachmentDescriptor {}
);
impl MTLTileRenderPipelineColorAttachmentDescriptor {
extern_methods!(
#[cfg(feature = "MTLPixelFormat")]
/// Pixel format. Defaults to MTLPixelFormatInvalid
#[unsafe(method(pixelFormat))]
#[unsafe(method_family = none)]
pub fn pixelFormat(&self) -> MTLPixelFormat;
#[cfg(feature = "MTLPixelFormat")]
/// Setter for [`pixelFormat`][Self::pixelFormat].
#[unsafe(method(setPixelFormat:))]
#[unsafe(method_family = none)]
pub fn setPixelFormat(&self, pixel_format: MTLPixelFormat);
);
}
/// Methods declared on superclass `NSObject`.
impl MTLTileRenderPipelineColorAttachmentDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLTileRenderPipelineColorAttachmentDescriptor {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtltilerenderpipelinecolorattachmentdescriptorarray?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLTileRenderPipelineColorAttachmentDescriptorArray;
);
extern_conformance!(
unsafe impl NSObjectProtocol for MTLTileRenderPipelineColorAttachmentDescriptorArray {}
);
impl MTLTileRenderPipelineColorAttachmentDescriptorArray {
extern_methods!(
/// # Safety
///
/// `attachmentIndex` might not be bounds-checked.
#[unsafe(method(objectAtIndexedSubscript:))]
#[unsafe(method_family = none)]
pub unsafe fn objectAtIndexedSubscript(
&self,
attachment_index: NSUInteger,
) -> Retained<MTLTileRenderPipelineColorAttachmentDescriptor>;
/// # Safety
///
/// `attachmentIndex` might not be bounds-checked.
#[unsafe(method(setObject:atIndexedSubscript:))]
#[unsafe(method_family = none)]
pub unsafe fn setObject_atIndexedSubscript(
&self,
attachment: &MTLTileRenderPipelineColorAttachmentDescriptor,
attachment_index: NSUInteger,
);
);
}
/// Methods declared on superclass `NSObject`.
impl MTLTileRenderPipelineColorAttachmentDescriptorArray {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLTileRenderPipelineColorAttachmentDescriptorArray {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtltilerenderpipelinedescriptor?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLTileRenderPipelineDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MTLTileRenderPipelineDescriptor {}
);
unsafe impl CopyingHelper for MTLTileRenderPipelineDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLTileRenderPipelineDescriptor {}
);
impl MTLTileRenderPipelineDescriptor {
extern_methods!(
/// The descriptor label.
#[unsafe(method(label))]
#[unsafe(method_family = none)]
pub fn label(&self) -> Option<Retained<NSString>>;
/// Setter for [`label`][Self::label].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setLabel:))]
#[unsafe(method_family = none)]
pub fn setLabel(&self, label: Option<&NSString>);
#[cfg(feature = "MTLLibrary")]
/// The kernel or fragment function that serves as the tile shader for this pipeline.
///
/// Both kernel-based and fragment-based tile pipelines dispatches will barrier against previous
/// draws and other dispatches. Kernel-based pipelines will wait until all prior access to the tile completes.
/// Fragment-based pipelines will only wait until all prior access to the fragment's location completes.
#[unsafe(method(tileFunction))]
#[unsafe(method_family = none)]
pub fn tileFunction(&self) -> Retained<ProtocolObject<dyn MTLFunction>>;
#[cfg(feature = "MTLLibrary")]
/// Setter for [`tileFunction`][Self::tileFunction].
///
/// # Safety
///
/// - `tile_function` must be safe to call.
/// - `tile_function` must have the correct argument and return types.
#[unsafe(method(setTileFunction:))]
#[unsafe(method_family = none)]
pub unsafe fn setTileFunction(&self, tile_function: &ProtocolObject<dyn MTLFunction>);
#[unsafe(method(rasterSampleCount))]
#[unsafe(method_family = none)]
pub fn rasterSampleCount(&self) -> NSUInteger;
/// Setter for [`rasterSampleCount`][Self::rasterSampleCount].
///
/// # Safety
///
/// This might not be bounds-checked.
#[unsafe(method(setRasterSampleCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setRasterSampleCount(&self, raster_sample_count: NSUInteger);
#[unsafe(method(colorAttachments))]
#[unsafe(method_family = none)]
pub fn colorAttachments(
&self,
) -> Retained<MTLTileRenderPipelineColorAttachmentDescriptorArray>;
/// Whether all threadgroups associated with this pipeline will cover tiles entirely.
///
/// Metal can optimize code generation for this case.
#[unsafe(method(threadgroupSizeMatchesTileSize))]
#[unsafe(method_family = none)]
pub fn threadgroupSizeMatchesTileSize(&self) -> bool;
/// Setter for [`threadgroupSizeMatchesTileSize`][Self::threadgroupSizeMatchesTileSize].
#[unsafe(method(setThreadgroupSizeMatchesTileSize:))]
#[unsafe(method_family = none)]
pub fn setThreadgroupSizeMatchesTileSize(&self, threadgroup_size_matches_tile_size: bool);
#[cfg(feature = "MTLPipeline")]
#[unsafe(method(tileBuffers))]
#[unsafe(method_family = none)]
pub fn tileBuffers(&self) -> Retained<MTLPipelineBufferDescriptorArray>;
/// Optional property. Set the maxTotalThreadsPerThreadgroup. If it is not set, returns zero.
#[unsafe(method(maxTotalThreadsPerThreadgroup))]
#[unsafe(method_family = none)]
pub fn maxTotalThreadsPerThreadgroup(&self) -> NSUInteger;
/// Setter for [`maxTotalThreadsPerThreadgroup`][Self::maxTotalThreadsPerThreadgroup].
#[unsafe(method(setMaxTotalThreadsPerThreadgroup:))]
#[unsafe(method_family = none)]
pub fn setMaxTotalThreadsPerThreadgroup(
&self,
max_total_threads_per_threadgroup: NSUInteger,
);
#[cfg(feature = "MTLBinaryArchive")]
/// The set of MTLBinaryArchive to search for compiled code when creating the pipeline state.
///
/// Accelerate pipeline state creation by providing archives of compiled code such that no compilation needs to happen on the fast path.
///
/// See: MTLBinaryArchive
#[unsafe(method(binaryArchives))]
#[unsafe(method_family = none)]
pub fn binaryArchives(
&self,
) -> Option<Retained<NSArray<ProtocolObject<dyn MTLBinaryArchive>>>>;
#[cfg(feature = "MTLBinaryArchive")]
/// Setter for [`binaryArchives`][Self::binaryArchives].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setBinaryArchives:))]
#[unsafe(method_family = none)]
pub fn setBinaryArchives(
&self,
binary_archives: Option<&NSArray<ProtocolObject<dyn MTLBinaryArchive>>>,
);
#[cfg(feature = "MTLDynamicLibrary")]
/// The set of MTLDynamicLibrary to use to resolve external symbols before considering symbols from dependent MTLDynamicLibrary.
///
/// Typical workflows use the libraries property of MTLCompileOptions to record dependent libraries at compile time without having to use preloadedLibraries.
/// This property can be used to override symbols from dependent libraries for experimentation or evaluating alternative implementations.
/// It can also be used to provide dynamic libraries that are dynamically created (for example, from source) that have no stable installName that can be used to automatically load from the file system.
///
/// See: MTLDynamicLibrary
#[unsafe(method(preloadedLibraries))]
#[unsafe(method_family = none)]
pub fn preloadedLibraries(
&self,
) -> Retained<NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>;
#[cfg(feature = "MTLDynamicLibrary")]
/// Setter for [`preloadedLibraries`][Self::preloadedLibraries].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setPreloadedLibraries:))]
#[unsafe(method_family = none)]
pub fn setPreloadedLibraries(
&self,
preloaded_libraries: &NSArray<ProtocolObject<dyn MTLDynamicLibrary>>,
);
#[cfg(feature = "MTLLinkedFunctions")]
/// The set of functions to be linked with the pipeline state and accessed from the tile function.
///
/// See: MTLLinkedFunctions
#[unsafe(method(linkedFunctions))]
#[unsafe(method_family = none)]
pub fn linkedFunctions(&self) -> Retained<MTLLinkedFunctions>;
#[cfg(feature = "MTLLinkedFunctions")]
/// Setter for [`linkedFunctions`][Self::linkedFunctions].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setLinkedFunctions:))]
#[unsafe(method_family = none)]
pub fn setLinkedFunctions(&self, linked_functions: Option<&MTLLinkedFunctions>);
/// This flag makes this pipeline support creating a new pipeline by adding binary functions.
#[unsafe(method(supportAddingBinaryFunctions))]
#[unsafe(method_family = none)]
pub fn supportAddingBinaryFunctions(&self) -> bool;
/// Setter for [`supportAddingBinaryFunctions`][Self::supportAddingBinaryFunctions].
#[unsafe(method(setSupportAddingBinaryFunctions:))]
#[unsafe(method_family = none)]
pub fn setSupportAddingBinaryFunctions(&self, support_adding_binary_functions: bool);
/// The maximum depth of the call stack in stack frames from the tile function. Defaults to 1 additional stack frame.
#[unsafe(method(maxCallStackDepth))]
#[unsafe(method_family = none)]
pub fn maxCallStackDepth(&self) -> NSUInteger;
/// Setter for [`maxCallStackDepth`][Self::maxCallStackDepth].
#[unsafe(method(setMaxCallStackDepth:))]
#[unsafe(method_family = none)]
pub fn setMaxCallStackDepth(&self, max_call_stack_depth: NSUInteger);
#[unsafe(method(reset))]
#[unsafe(method_family = none)]
pub fn reset(&self);
#[cfg(feature = "MTLPipeline")]
/// Toggle that determines whether Metal Shader Validation should be enabled or disabled for the pipeline.
///
/// The value can be overridden using `MTL_SHADER_VALIDATION_ENABLE_PIPELINES` or `MTL_SHADER_VALIDATION_DISABLE_PIPELINES` Environment Variables.
#[unsafe(method(shaderValidation))]
#[unsafe(method_family = none)]
pub fn shaderValidation(&self) -> MTLShaderValidation;
#[cfg(feature = "MTLPipeline")]
/// Setter for [`shaderValidation`][Self::shaderValidation].
#[unsafe(method(setShaderValidation:))]
#[unsafe(method_family = none)]
pub fn setShaderValidation(&self, shader_validation: MTLShaderValidation);
#[cfg(feature = "MTLTypes")]
/// Sets the required threads-per-threadgroup during tile dispatches. The `threadsPerTile` argument of any tile dispatch must match to this value if it is set.
/// Optional, unless the pipeline is going to use CooperativeTensors in which case this must be set.
/// Setting this to a size of 0 in every dimension disables this property
#[unsafe(method(requiredThreadsPerThreadgroup))]
#[unsafe(method_family = none)]
pub fn requiredThreadsPerThreadgroup(&self) -> MTLSize;
#[cfg(feature = "MTLTypes")]
/// Setter for [`requiredThreadsPerThreadgroup`][Self::requiredThreadsPerThreadgroup].
#[unsafe(method(setRequiredThreadsPerThreadgroup:))]
#[unsafe(method_family = none)]
pub fn setRequiredThreadsPerThreadgroup(&self, required_threads_per_threadgroup: MTLSize);
);
}
/// Methods declared on superclass `NSObject`.
impl MTLTileRenderPipelineDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLTileRenderPipelineDescriptor {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
/// As an alternative to a vertex + fragment shader render pipeline, this render pipeline uses a (object +) mesh + fragment shader for rendering geometry.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlmeshrenderpipelinedescriptor?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MTLMeshRenderPipelineDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MTLMeshRenderPipelineDescriptor {}
);
unsafe impl CopyingHelper for MTLMeshRenderPipelineDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MTLMeshRenderPipelineDescriptor {}
);
impl MTLMeshRenderPipelineDescriptor {
extern_methods!(
/// A name or description provided by the application that will be displayed in debugging tools.
/// The default value is nil.
#[unsafe(method(label))]
#[unsafe(method_family = none)]
pub fn label(&self) -> Option<Retained<NSString>>;
/// Setter for [`label`][Self::label].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setLabel:))]
#[unsafe(method_family = none)]
pub fn setLabel(&self, label: Option<&NSString>);
#[cfg(feature = "MTLLibrary")]
/// Optional shader function responsible for determining how many threadgroups of the mesh shader to run, can optionally provide payload data for the mesh stage.
/// If this is nil, no payload data is available to the mesh function, and the draw command determines how many threadgroups of the mesh stage to run.
/// The default value is nil.
#[unsafe(method(objectFunction))]
#[unsafe(method_family = none)]
pub fn objectFunction(&self) -> Option<Retained<ProtocolObject<dyn MTLFunction>>>;
#[cfg(feature = "MTLLibrary")]
/// Setter for [`objectFunction`][Self::objectFunction].
///
/// # Safety
///
/// - `object_function` must be safe to call.
/// - `object_function` must have the correct argument and return types.
#[unsafe(method(setObjectFunction:))]
#[unsafe(method_family = none)]
pub unsafe fn setObjectFunction(
&self,
object_function: Option<&ProtocolObject<dyn MTLFunction>>,
);
#[cfg(feature = "MTLLibrary")]
/// Shader function responsible for exporting a chunk of geometry per threadgroup for the rasterizer.
/// The default value is nil.
#[unsafe(method(meshFunction))]
#[unsafe(method_family = none)]
pub fn meshFunction(&self) -> Option<Retained<ProtocolObject<dyn MTLFunction>>>;
#[cfg(feature = "MTLLibrary")]
/// Setter for [`meshFunction`][Self::meshFunction].
///
/// # Safety
///
/// - `mesh_function` must be safe to call.
/// - `mesh_function` must have the correct argument and return types.
#[unsafe(method(setMeshFunction:))]
#[unsafe(method_family = none)]
pub unsafe fn setMeshFunction(
&self,
mesh_function: Option<&ProtocolObject<dyn MTLFunction>>,
);
#[cfg(feature = "MTLLibrary")]
/// Like a classical render pipeline, this fragments covered by the rasterized geometry are shaded with this function.
/// The default value is nil. To create a pipeline, you must either set fragmentFunction to non-nil, or set rasterizationEnabled to NO.
#[unsafe(method(fragmentFunction))]
#[unsafe(method_family = none)]
pub fn fragmentFunction(&self) -> Option<Retained<ProtocolObject<dyn MTLFunction>>>;
#[cfg(feature = "MTLLibrary")]
/// Setter for [`fragmentFunction`][Self::fragmentFunction].
///
/// # Safety
///
/// - `fragment_function` must be safe to call.
/// - `fragment_function` must have the correct argument and return types.
#[unsafe(method(setFragmentFunction:))]
#[unsafe(method_family = none)]
pub unsafe fn setFragmentFunction(
&self,
fragment_function: Option<&ProtocolObject<dyn MTLFunction>>,
);
/// The maximum size of the product of threadsPerObjectThreadgroup that can be used for draws with this pipeline.
/// This information can be used by the optimizer to generate more efficient code, specifically when the specified value does not exceed the thread execution width of the underlying GPU.
/// The default value is 0, which means that the value specified with the [[max_total_threads_per_threadgroup(N)]] specified on objectFunction will be used.
/// When both the [[max_total_threads_per_threadgroup(N)]] attribute and a non-zero value are specified, both values must match.
/// Any value specified cannot exceed the device limit as documented in the "Metal Feature Set Tables" for "Maximum threads per threadgroup".
#[unsafe(method(maxTotalThreadsPerObjectThreadgroup))]
#[unsafe(method_family = none)]
pub fn maxTotalThreadsPerObjectThreadgroup(&self) -> NSUInteger;
/// Setter for [`maxTotalThreadsPerObjectThreadgroup`][Self::maxTotalThreadsPerObjectThreadgroup].
#[unsafe(method(setMaxTotalThreadsPerObjectThreadgroup:))]
#[unsafe(method_family = none)]
pub fn setMaxTotalThreadsPerObjectThreadgroup(
&self,
max_total_threads_per_object_threadgroup: NSUInteger,
);
/// The maximum size of the product of threadsPerMeshThreadgroup that can be used for draws with this pipeline.
/// This information can be used by the optimizer to generate more efficient code, specifically when the specified value does not exceed the thread execution width of the underlying GPU.
/// The default value is 0, which means that the value specified with the [[max_total_threads_per_threadgroup(N)]] specified on meshFunction will be used.
/// When both the [[max_total_threads_per_threadgroup(N)]] attribute and a non-zero value are specified, both values must match.
/// Any value specified cannot exceed the device limit as documented in the "Metal Feature Set Tables" for "Maximum threads per threadgroup".
#[unsafe(method(maxTotalThreadsPerMeshThreadgroup))]
#[unsafe(method_family = none)]
pub fn maxTotalThreadsPerMeshThreadgroup(&self) -> NSUInteger;
/// Setter for [`maxTotalThreadsPerMeshThreadgroup`][Self::maxTotalThreadsPerMeshThreadgroup].
#[unsafe(method(setMaxTotalThreadsPerMeshThreadgroup:))]
#[unsafe(method_family = none)]
pub fn setMaxTotalThreadsPerMeshThreadgroup(
&self,
max_total_threads_per_mesh_threadgroup: NSUInteger,
);
/// Set this value to YES when you will only use draws with the product of threadsPerObjectThreadgroup set to a multiple of the objectThreadExecutionWidth of the returned pipeline state.
/// This information can be used by the optimizer to generate more efficient code.
/// The default value is NO.
#[unsafe(method(objectThreadgroupSizeIsMultipleOfThreadExecutionWidth))]
#[unsafe(method_family = none)]
pub fn objectThreadgroupSizeIsMultipleOfThreadExecutionWidth(&self) -> bool;
/// Setter for [`objectThreadgroupSizeIsMultipleOfThreadExecutionWidth`][Self::objectThreadgroupSizeIsMultipleOfThreadExecutionWidth].
#[unsafe(method(setObjectThreadgroupSizeIsMultipleOfThreadExecutionWidth:))]
#[unsafe(method_family = none)]
pub fn setObjectThreadgroupSizeIsMultipleOfThreadExecutionWidth(
&self,
object_threadgroup_size_is_multiple_of_thread_execution_width: bool,
);
/// Set this value to YES when you will only use draws with the product of threadsPerMeshThreadgroup set to a multiple of the meshThreadExecutionWidth of the returned pipeline state.
/// This information can be used by the optimizer to generate more efficient code.
/// The default value is NO.
#[unsafe(method(meshThreadgroupSizeIsMultipleOfThreadExecutionWidth))]
#[unsafe(method_family = none)]
pub fn meshThreadgroupSizeIsMultipleOfThreadExecutionWidth(&self) -> bool;
/// Setter for [`meshThreadgroupSizeIsMultipleOfThreadExecutionWidth`][Self::meshThreadgroupSizeIsMultipleOfThreadExecutionWidth].
#[unsafe(method(setMeshThreadgroupSizeIsMultipleOfThreadExecutionWidth:))]
#[unsafe(method_family = none)]
pub fn setMeshThreadgroupSizeIsMultipleOfThreadExecutionWidth(
&self,
mesh_threadgroup_size_is_multiple_of_thread_execution_width: bool,
);
/// The size, in bytes, of the buffer indicated by [[payload]] in the object and mesh shader.
/// If this value is 0, the size of the dereferenced type declared in the object shader for the buffer is used (space for a single element is assumed for pointers).
/// The default value is 0.
#[unsafe(method(payloadMemoryLength))]
#[unsafe(method_family = none)]
pub fn payloadMemoryLength(&self) -> NSUInteger;
/// Setter for [`payloadMemoryLength`][Self::payloadMemoryLength].
#[unsafe(method(setPayloadMemoryLength:))]
#[unsafe(method_family = none)]
pub fn setPayloadMemoryLength(&self, payload_memory_length: NSUInteger);
/// The maximum value of the product of vector elements that the object shader may pass to the mesh_grid_properties::set_threadgroups_per_grid built-in function.
/// The default value is 0, which means that the value specified with the [[max_total_threadgroups_per_mesh_grid(N)]] specified on objectFunction will be used.
/// When both the [[max_total_threadgroups_per_mesh_grid(N)]] attribute and a non-zero value are specified, both values must match.
/// Any value specified cannot exceed the device limit as documented in the "Metal Feature Set Tables" for "Maximum threadgroups per mesh grid".
/// Specifying this value is optional; it may be used to improve scheduling of the workload. If neither this value nor the shader attribute are used, the device's maximum supported value is used instead.
#[unsafe(method(maxTotalThreadgroupsPerMeshGrid))]
#[unsafe(method_family = none)]
pub fn maxTotalThreadgroupsPerMeshGrid(&self) -> NSUInteger;
/// Setter for [`maxTotalThreadgroupsPerMeshGrid`][Self::maxTotalThreadgroupsPerMeshGrid].
#[unsafe(method(setMaxTotalThreadgroupsPerMeshGrid:))]
#[unsafe(method_family = none)]
pub fn setMaxTotalThreadgroupsPerMeshGrid(
&self,
max_total_threadgroups_per_mesh_grid: NSUInteger,
);
#[cfg(feature = "MTLPipeline")]
/// Provide mutability information on the buffers used by objectFunction.
///
/// Specifying these values is optional; it may be used to optimize the shader code.
#[unsafe(method(objectBuffers))]
#[unsafe(method_family = none)]
pub fn objectBuffers(&self) -> Retained<MTLPipelineBufferDescriptorArray>;
#[cfg(feature = "MTLPipeline")]
/// Provide mutability information on the buffers used by meshFunction.
///
/// Specifying these values is optional; it may be used to optimize the shader code.
#[unsafe(method(meshBuffers))]
#[unsafe(method_family = none)]
pub fn meshBuffers(&self) -> Retained<MTLPipelineBufferDescriptorArray>;
#[cfg(feature = "MTLPipeline")]
/// Provide mutability information on the buffers used by fragmentFunction.
///
/// Specifying these values is optional; it may be used to optimize the shader code.
#[unsafe(method(fragmentBuffers))]
#[unsafe(method_family = none)]
pub fn fragmentBuffers(&self) -> Retained<MTLPipelineBufferDescriptorArray>;
/// The number of samples per fragment of the render pass in which this pipeline will be used.
#[unsafe(method(rasterSampleCount))]
#[unsafe(method_family = none)]
pub fn rasterSampleCount(&self) -> NSUInteger;
/// Setter for [`rasterSampleCount`][Self::rasterSampleCount].
///
/// # Safety
///
/// This might not be bounds-checked.
#[unsafe(method(setRasterSampleCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setRasterSampleCount(&self, raster_sample_count: NSUInteger);
/// Whether the alpha value exported by the fragment shader for the first color attachment is converted to a sample mask, which is subsequently AND-ed with the fragments' sample mask
///
/// The default value is NO.
#[unsafe(method(isAlphaToCoverageEnabled))]
#[unsafe(method_family = none)]
pub fn isAlphaToCoverageEnabled(&self) -> bool;
/// Setter for [`isAlphaToCoverageEnabled`][Self::isAlphaToCoverageEnabled].
#[unsafe(method(setAlphaToCoverageEnabled:))]
#[unsafe(method_family = none)]
pub fn setAlphaToCoverageEnabled(&self, alpha_to_coverage_enabled: bool);
/// Whether the alpha value exported by the fragment shader for all color attachments is modified to 1 (after evaluating alphaToCoverage).
///
/// The default value is NO.
#[unsafe(method(isAlphaToOneEnabled))]
#[unsafe(method_family = none)]
pub fn isAlphaToOneEnabled(&self) -> bool;
/// Setter for [`isAlphaToOneEnabled`][Self::isAlphaToOneEnabled].
#[unsafe(method(setAlphaToOneEnabled:))]
#[unsafe(method_family = none)]
pub fn setAlphaToOneEnabled(&self, alpha_to_one_enabled: bool);
/// Whether rasterization is disabled, all primitives are dropped prior to rasterization.
///
/// The default value is YES.
#[unsafe(method(isRasterizationEnabled))]
#[unsafe(method_family = none)]
pub fn isRasterizationEnabled(&self) -> bool;
/// Setter for [`isRasterizationEnabled`][Self::isRasterizationEnabled].
#[unsafe(method(setRasterizationEnabled:))]
#[unsafe(method_family = none)]
pub fn setRasterizationEnabled(&self, rasterization_enabled: bool);
/// The maximum value that can be passed to setVertexAmplificationCount when using this pipeline.
///
/// The default value is 1. The value must be supported by the device, which can be checked with supportsVertexAmplificationCount.
#[unsafe(method(maxVertexAmplificationCount))]
#[unsafe(method_family = none)]
pub fn maxVertexAmplificationCount(&self) -> NSUInteger;
/// Setter for [`maxVertexAmplificationCount`][Self::maxVertexAmplificationCount].
///
/// # Safety
///
/// This might not be bounds-checked.
#[unsafe(method(setMaxVertexAmplificationCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setMaxVertexAmplificationCount(
&self,
max_vertex_amplification_count: NSUInteger,
);
/// Describes the color attachments of the render pass in which this pipeline will be used.
#[unsafe(method(colorAttachments))]
#[unsafe(method_family = none)]
pub fn colorAttachments(&self)
-> Retained<MTLRenderPipelineColorAttachmentDescriptorArray>;
#[cfg(feature = "MTLPixelFormat")]
/// The pixel format of the depth attachment of the render pass in which this pipeline will be used.
///
/// The default value is MTLPixelFormatInvalid; indicating no depth attachment will be used.
#[unsafe(method(depthAttachmentPixelFormat))]
#[unsafe(method_family = none)]
pub fn depthAttachmentPixelFormat(&self) -> MTLPixelFormat;
#[cfg(feature = "MTLPixelFormat")]
/// Setter for [`depthAttachmentPixelFormat`][Self::depthAttachmentPixelFormat].
#[unsafe(method(setDepthAttachmentPixelFormat:))]
#[unsafe(method_family = none)]
pub fn setDepthAttachmentPixelFormat(&self, depth_attachment_pixel_format: MTLPixelFormat);
#[cfg(feature = "MTLPixelFormat")]
/// The pixel format of the stencil attachment of the render pass in which this pipeline will be used.
///
/// The default value is MTLPixelFormatInvalid; indicating no stencil attachment will be used.
#[unsafe(method(stencilAttachmentPixelFormat))]
#[unsafe(method_family = none)]
pub fn stencilAttachmentPixelFormat(&self) -> MTLPixelFormat;
#[cfg(feature = "MTLPixelFormat")]
/// Setter for [`stencilAttachmentPixelFormat`][Self::stencilAttachmentPixelFormat].
#[unsafe(method(setStencilAttachmentPixelFormat:))]
#[unsafe(method_family = none)]
pub fn setStencilAttachmentPixelFormat(
&self,
stencil_attachment_pixel_format: MTLPixelFormat,
);
/// Whether this pipeline will support being used by commands in an indirect command buffer.
///
/// The default value is NO.
#[unsafe(method(supportIndirectCommandBuffers))]
#[unsafe(method_family = none)]
pub fn supportIndirectCommandBuffers(&self) -> bool;
/// Setter for [`supportIndirectCommandBuffers`][Self::supportIndirectCommandBuffers].
#[unsafe(method(setSupportIndirectCommandBuffers:))]
#[unsafe(method_family = none)]
pub fn setSupportIndirectCommandBuffers(&self, support_indirect_command_buffers: bool);
#[cfg(feature = "MTLBinaryArchive")]
/// The set of MTLBinaryArchive to search for compiled code when creating the pipeline state.
///
/// Accelerate pipeline state creation by providing archives of compiled code such that no compilation needs to happen on the fast path.
///
/// See: MTLBinaryArchive
#[unsafe(method(binaryArchives))]
#[unsafe(method_family = none)]
pub fn binaryArchives(
&self,
) -> Option<Retained<NSArray<ProtocolObject<dyn MTLBinaryArchive>>>>;
#[cfg(feature = "MTLBinaryArchive")]
/// Setter for [`binaryArchives`][Self::binaryArchives].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setBinaryArchives:))]
#[unsafe(method_family = none)]
pub fn setBinaryArchives(
&self,
binary_archives: Option<&NSArray<ProtocolObject<dyn MTLBinaryArchive>>>,
);
#[cfg(feature = "MTLLinkedFunctions")]
/// The set of functions to be linked with the pipeline state and accessed from the object function.
///
/// See: MTLLinkedFunctions
#[unsafe(method(objectLinkedFunctions))]
#[unsafe(method_family = none)]
pub fn objectLinkedFunctions(&self) -> Retained<MTLLinkedFunctions>;
#[cfg(feature = "MTLLinkedFunctions")]
/// Setter for [`objectLinkedFunctions`][Self::objectLinkedFunctions].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setObjectLinkedFunctions:))]
#[unsafe(method_family = none)]
pub fn setObjectLinkedFunctions(
&self,
object_linked_functions: Option<&MTLLinkedFunctions>,
);
#[cfg(feature = "MTLLinkedFunctions")]
/// The set of functions to be linked with the pipeline state and accessed from the mesh function.
///
/// See: MTLLinkedFunctions
#[unsafe(method(meshLinkedFunctions))]
#[unsafe(method_family = none)]
pub fn meshLinkedFunctions(&self) -> Retained<MTLLinkedFunctions>;
#[cfg(feature = "MTLLinkedFunctions")]
/// Setter for [`meshLinkedFunctions`][Self::meshLinkedFunctions].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setMeshLinkedFunctions:))]
#[unsafe(method_family = none)]
pub fn setMeshLinkedFunctions(&self, mesh_linked_functions: Option<&MTLLinkedFunctions>);
#[cfg(feature = "MTLLinkedFunctions")]
/// The set of functions to be linked with the pipeline state and accessed from the fragment function.
///
/// See: MTLLinkedFunctions
#[unsafe(method(fragmentLinkedFunctions))]
#[unsafe(method_family = none)]
pub fn fragmentLinkedFunctions(&self) -> Retained<MTLLinkedFunctions>;
#[cfg(feature = "MTLLinkedFunctions")]
/// Setter for [`fragmentLinkedFunctions`][Self::fragmentLinkedFunctions].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setFragmentLinkedFunctions:))]
#[unsafe(method_family = none)]
pub fn setFragmentLinkedFunctions(
&self,
fragment_linked_functions: Option<&MTLLinkedFunctions>,
);
/// Restore all mesh pipeline descriptor properties to their default values.
#[unsafe(method(reset))]
#[unsafe(method_family = none)]
pub fn reset(&self);
#[cfg(feature = "MTLPipeline")]
/// Toggle that determines whether Metal Shader Validation should be enabled or disabled for the pipeline.
///
/// The value can be overridden using `MTL_SHADER_VALIDATION_ENABLE_PIPELINES` or `MTL_SHADER_VALIDATION_DISABLE_PIPELINES` Environment Variables.
#[unsafe(method(shaderValidation))]
#[unsafe(method_family = none)]
pub fn shaderValidation(&self) -> MTLShaderValidation;
#[cfg(feature = "MTLPipeline")]
/// Setter for [`shaderValidation`][Self::shaderValidation].
#[unsafe(method(setShaderValidation:))]
#[unsafe(method_family = none)]
pub fn setShaderValidation(&self, shader_validation: MTLShaderValidation);
#[cfg(feature = "MTLTypes")]
/// Sets the required object threads-per-threadgroup during mesh draws. The `threadsPerObjectThreadgroup` argument of any draw must match to this value if it is set.
/// Optional, unless the pipeline is going to use CooperativeTensors in which case this must be set.
/// Setting this to a size of 0 in every dimension disables this property
#[unsafe(method(requiredThreadsPerObjectThreadgroup))]
#[unsafe(method_family = none)]
pub fn requiredThreadsPerObjectThreadgroup(&self) -> MTLSize;
#[cfg(feature = "MTLTypes")]
/// Setter for [`requiredThreadsPerObjectThreadgroup`][Self::requiredThreadsPerObjectThreadgroup].
#[unsafe(method(setRequiredThreadsPerObjectThreadgroup:))]
#[unsafe(method_family = none)]
pub fn setRequiredThreadsPerObjectThreadgroup(
&self,
required_threads_per_object_threadgroup: MTLSize,
);
#[cfg(feature = "MTLTypes")]
/// Sets the required mesh threads-per-threadgroup during mesh draws. The `threadsPerMeshThreadgroup` argument of any draw must match to this value if it is set.
/// Optional, unless the pipeline is going to use CooperativeTensors in which case this must be set.
/// Setting this to a size of 0 in every dimension disables this property
#[unsafe(method(requiredThreadsPerMeshThreadgroup))]
#[unsafe(method_family = none)]
pub fn requiredThreadsPerMeshThreadgroup(&self) -> MTLSize;
#[cfg(feature = "MTLTypes")]
/// Setter for [`requiredThreadsPerMeshThreadgroup`][Self::requiredThreadsPerMeshThreadgroup].
#[unsafe(method(setRequiredThreadsPerMeshThreadgroup:))]
#[unsafe(method_family = none)]
pub fn setRequiredThreadsPerMeshThreadgroup(
&self,
required_threads_per_mesh_threadgroup: MTLSize,
);
);
}
/// Methods declared on superclass `NSObject`.
impl MTLMeshRenderPipelineDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for MTLMeshRenderPipelineDescriptor {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}