objc2-metal 0.3.2

Bindings to the Metal framework
Documentation
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
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
//! 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/mtlprimitivetype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLPrimitiveType(pub NSUInteger);
impl MTLPrimitiveType {
    #[doc(alias = "MTLPrimitiveTypePoint")]
    pub const Point: Self = Self(0);
    #[doc(alias = "MTLPrimitiveTypeLine")]
    pub const Line: Self = Self(1);
    #[doc(alias = "MTLPrimitiveTypeLineStrip")]
    pub const LineStrip: Self = Self(2);
    #[doc(alias = "MTLPrimitiveTypeTriangle")]
    pub const Triangle: Self = Self(3);
    #[doc(alias = "MTLPrimitiveTypeTriangleStrip")]
    pub const TriangleStrip: Self = Self(4);
}

unsafe impl Encode for MTLPrimitiveType {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for MTLPrimitiveType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlvisibilityresultmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLVisibilityResultMode(pub NSUInteger);
impl MTLVisibilityResultMode {
    #[doc(alias = "MTLVisibilityResultModeDisabled")]
    pub const Disabled: Self = Self(0);
    #[doc(alias = "MTLVisibilityResultModeBoolean")]
    pub const Boolean: Self = Self(1);
    #[doc(alias = "MTLVisibilityResultModeCounting")]
    pub const Counting: Self = Self(2);
}

unsafe impl Encode for MTLVisibilityResultMode {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for MTLVisibilityResultMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlscissorrect?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLScissorRect {
    pub x: NSUInteger,
    pub y: NSUInteger,
    pub width: NSUInteger,
    pub height: NSUInteger,
}

unsafe impl Encode for MTLScissorRect {
    const ENCODING: Encoding = Encoding::Struct(
        "?",
        &[
            <NSUInteger>::ENCODING,
            <NSUInteger>::ENCODING,
            <NSUInteger>::ENCODING,
            <NSUInteger>::ENCODING,
        ],
    );
}

unsafe impl RefEncode for MTLScissorRect {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlviewport?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLViewport {
    pub originX: c_double,
    pub originY: c_double,
    pub width: c_double,
    pub height: c_double,
    pub znear: c_double,
    pub zfar: c_double,
}

unsafe impl Encode for MTLViewport {
    const ENCODING: Encoding = Encoding::Struct(
        "?",
        &[
            <c_double>::ENCODING,
            <c_double>::ENCODING,
            <c_double>::ENCODING,
            <c_double>::ENCODING,
            <c_double>::ENCODING,
            <c_double>::ENCODING,
        ],
    );
}

unsafe impl RefEncode for MTLViewport {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlcullmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLCullMode(pub NSUInteger);
impl MTLCullMode {
    #[doc(alias = "MTLCullModeNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "MTLCullModeFront")]
    pub const Front: Self = Self(1);
    #[doc(alias = "MTLCullModeBack")]
    pub const Back: Self = Self(2);
}

unsafe impl Encode for MTLCullMode {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for MTLCullMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlwinding?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLWinding(pub NSUInteger);
impl MTLWinding {
    #[doc(alias = "MTLWindingClockwise")]
    pub const Clockwise: Self = Self(0);
    #[doc(alias = "MTLWindingCounterClockwise")]
    pub const CounterClockwise: Self = Self(1);
}

unsafe impl Encode for MTLWinding {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for MTLWinding {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtldepthclipmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLDepthClipMode(pub NSUInteger);
impl MTLDepthClipMode {
    #[doc(alias = "MTLDepthClipModeClip")]
    pub const Clip: Self = Self(0);
    #[doc(alias = "MTLDepthClipModeClamp")]
    pub const Clamp: Self = Self(1);
}

unsafe impl Encode for MTLDepthClipMode {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for MTLDepthClipMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtltrianglefillmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLTriangleFillMode(pub NSUInteger);
impl MTLTriangleFillMode {
    #[doc(alias = "MTLTriangleFillModeFill")]
    pub const Fill: Self = Self(0);
    #[doc(alias = "MTLTriangleFillModeLines")]
    pub const Lines: Self = Self(1);
}

unsafe impl Encode for MTLTriangleFillMode {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for MTLTriangleFillMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtldrawprimitivesindirectarguments?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLDrawPrimitivesIndirectArguments {
    pub vertexCount: u32,
    pub instanceCount: u32,
    pub vertexStart: u32,
    pub baseInstance: u32,
}

unsafe impl Encode for MTLDrawPrimitivesIndirectArguments {
    const ENCODING: Encoding = Encoding::Struct(
        "?",
        &[
            <u32>::ENCODING,
            <u32>::ENCODING,
            <u32>::ENCODING,
            <u32>::ENCODING,
        ],
    );
}

unsafe impl RefEncode for MTLDrawPrimitivesIndirectArguments {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtldrawindexedprimitivesindirectarguments?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLDrawIndexedPrimitivesIndirectArguments {
    pub indexCount: u32,
    pub instanceCount: u32,
    pub indexStart: u32,
    pub baseVertex: i32,
    pub baseInstance: u32,
}

unsafe impl Encode for MTLDrawIndexedPrimitivesIndirectArguments {
    const ENCODING: Encoding = Encoding::Struct(
        "?",
        &[
            <u32>::ENCODING,
            <u32>::ENCODING,
            <u32>::ENCODING,
            <i32>::ENCODING,
            <u32>::ENCODING,
        ],
    );
}

unsafe impl RefEncode for MTLDrawIndexedPrimitivesIndirectArguments {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlvertexamplificationviewmapping?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLVertexAmplificationViewMapping {
    pub viewportArrayIndexOffset: u32,
    pub renderTargetArrayIndexOffset: u32,
}

unsafe impl Encode for MTLVertexAmplificationViewMapping {
    const ENCODING: Encoding = Encoding::Struct("?", &[<u32>::ENCODING, <u32>::ENCODING]);
}

unsafe impl RefEncode for MTLVertexAmplificationViewMapping {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtldrawpatchindirectarguments?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLDrawPatchIndirectArguments {
    pub patchCount: u32,
    pub instanceCount: u32,
    pub patchStart: u32,
    pub baseInstance: u32,
}

unsafe impl Encode for MTLDrawPatchIndirectArguments {
    const ENCODING: Encoding = Encoding::Struct(
        "?",
        &[
            <u32>::ENCODING,
            <u32>::ENCODING,
            <u32>::ENCODING,
            <u32>::ENCODING,
        ],
    );
}

unsafe impl RefEncode for MTLDrawPatchIndirectArguments {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtlquadtessellationfactorshalf?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLQuadTessellationFactorsHalf {
    pub edgeTessellationFactor: [u16; 4],
    pub insideTessellationFactor: [u16; 2],
}

unsafe impl Encode for MTLQuadTessellationFactorsHalf {
    const ENCODING: Encoding = Encoding::Struct("?", &[<[u16; 4]>::ENCODING, <[u16; 2]>::ENCODING]);
}

unsafe impl RefEncode for MTLQuadTessellationFactorsHalf {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/metal/mtltriangletessellationfactorshalf?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLTriangleTessellationFactorsHalf {
    pub edgeTessellationFactor: [u16; 3],
    pub insideTessellationFactor: u16,
}

unsafe impl Encode for MTLTriangleTessellationFactorsHalf {
    const ENCODING: Encoding = Encoding::Struct("?", &[<[u16; 3]>::ENCODING, <u16>::ENCODING]);
}

unsafe impl RefEncode for MTLTriangleTessellationFactorsHalf {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// Generic render stage enum
///
/// Can also be used for points at which a fence may be waited on or signaled.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlrenderstages?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLRenderStages(pub NSUInteger);
bitflags::bitflags! {
    impl MTLRenderStages: NSUInteger {
        #[doc(alias = "MTLRenderStageVertex")]
        const Vertex = 1<<0;
        #[doc(alias = "MTLRenderStageFragment")]
        const Fragment = 1<<1;
        #[doc(alias = "MTLRenderStageTile")]
        const Tile = 1<<2;
        #[doc(alias = "MTLRenderStageObject")]
        const Object = 1<<3;
        #[doc(alias = "MTLRenderStageMesh")]
        const Mesh = 1<<4;
    }
}

unsafe impl Encode for MTLRenderStages {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for MTLRenderStages {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_protocol!(
    /// MTLRenderCommandEncoder is a container for graphics rendering state and the code to translate the state into a command format that the device can execute.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtlrendercommandencoder?language=objc)
    #[cfg(feature = "MTLCommandEncoder")]
    pub unsafe trait MTLRenderCommandEncoder: MTLCommandEncoder {
        #[cfg(all(feature = "MTLAllocation", feature = "MTLRenderPipeline"))]
        /// Sets the current render pipeline state object.
        #[unsafe(method(setRenderPipelineState:))]
        #[unsafe(method_family = none)]
        fn setRenderPipelineState(
            &self,
            pipeline_state: &ProtocolObject<dyn MTLRenderPipelineState>,
        );

        /// Set the data (by copy) for a given vertex buffer binding point.  This will remove any existing MTLBuffer from the binding point.
        ///
        /// # Safety
        ///
        /// - `bytes` must be a valid pointer.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setVertexBytes:length:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexBytes_length_atIndex(
            &self,
            bytes: NonNull<c_void>,
            length: NSUInteger,
            index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Set a global buffer for all vertex shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `buffer` may need to be synchronized.
        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `buffer` contents should be of the correct type.
        /// - `offset` might not be bounds-checked.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setVertexBuffer:offset:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexBuffer_offset_atIndex(
            &self,
            buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
            offset: NSUInteger,
            index: NSUInteger,
        );

        /// Set the offset within the current global buffer for all vertex shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `offset` might not be bounds-checked.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setVertexBufferOffset:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexBufferOffset_atIndex(&self, offset: NSUInteger, index: NSUInteger);

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Set an array of global buffers for all vertex shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `buffers` must be a valid pointer.
        /// - `offsets` might not be bounds-checked.
        /// - `offsets` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setVertexBuffers:offsets:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexBuffers_offsets_withRange(
            &self,
            buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
            offsets: NonNull<NSUInteger>,
            range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// sets vertex buffer at specified index with provided offset and stride. Only
        /// call this when the buffer-index is part of the vertexDescriptor and has set
        /// its stride to `MTLBufferLayoutStrideDynamic`
        ///
        /// # Safety
        ///
        /// - `buffer` may need to be synchronized.
        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `buffer` contents should be of the correct type.
        /// - `offset` might not be bounds-checked.
        /// - `stride` might not be bounds-checked.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setVertexBuffer:offset:attributeStride:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexBuffer_offset_attributeStride_atIndex(
            &self,
            buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
            offset: NSUInteger,
            stride: NSUInteger,
            index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// sets an array of vertex buffers with provided offsets and strides with the
        /// given bind point range.
        /// only call this when at least one buffer is part of the
        /// vertexDescriptor, other buffers must set their value relative to the
        /// `attributeStrides` array to `MTLAttributeStrideStatic`
        ///
        /// # Safety
        ///
        /// - `buffers` must be a valid pointer.
        /// - `offsets` might not be bounds-checked.
        /// - `offsets` must be a valid pointer.
        /// - `strides` might not be bounds-checked.
        /// - `strides` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setVertexBuffers:offsets:attributeStrides:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexBuffers_offsets_attributeStrides_withRange(
            &self,
            buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
            offsets: NonNull<NSUInteger>,
            strides: NonNull<NSUInteger>,
            range: NSRange,
        );

        /// only call this when the buffer-index is part of the vertexDescriptor and
        /// has set its stride to `MTLBufferLayoutStrideDynamic`
        ///
        /// # Safety
        ///
        /// - `offset` might not be bounds-checked.
        /// - `stride` might not be bounds-checked.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setVertexBufferOffset:attributeStride:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexBufferOffset_attributeStride_atIndex(
            &self,
            offset: NSUInteger,
            stride: NSUInteger,
            index: NSUInteger,
        );

        /// only call this when the buffer-index is part of the vertexDescriptor and
        /// has set its stride to `MTLBufferLayoutStrideDynamic`
        ///
        /// # Safety
        ///
        /// - `bytes` must be a valid pointer.
        /// - `stride` might not be bounds-checked.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setVertexBytes:length:attributeStride:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexBytes_length_attributeStride_atIndex(
            &self,
            bytes: NonNull<c_void>,
            length: NSUInteger,
            stride: NSUInteger,
            index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLTexture"
        ))]
        /// Set a global texture for all vertex shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `texture` may need to be synchronized.
        /// - `texture` may be unretained, you must ensure it is kept alive while in use.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setVertexTexture:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexTexture_atIndex(
            &self,
            texture: Option<&ProtocolObject<dyn MTLTexture>>,
            index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLTexture"
        ))]
        /// Set an array of global textures for all vertex shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `textures` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setVertexTextures:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexTextures_withRange(
            &self,
            textures: NonNull<*const ProtocolObject<dyn MTLTexture>>,
            range: NSRange,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set a global sampler for all vertex shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// `index` might not be bounds-checked.
        #[unsafe(method(setVertexSamplerState:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexSamplerState_atIndex(
            &self,
            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
            index: NSUInteger,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set an array of global samplers for all vertex shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `samplers` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setVertexSamplerStates:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexSamplerStates_withRange(
            &self,
            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
            range: NSRange,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set a global sampler for all vertex shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// `index` might not be bounds-checked.
        #[unsafe(method(setVertexSamplerState:lodMinClamp:lodMaxClamp:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexSamplerState_lodMinClamp_lodMaxClamp_atIndex(
            &self,
            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
            lod_min_clamp: c_float,
            lod_max_clamp: c_float,
            index: NSUInteger,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set an array of global samplers for all vertex shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `samplers` must be a valid pointer.
        /// - `lod_min_clamps` must be a valid pointer.
        /// - `lod_max_clamps` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setVertexSamplerStates:lodMinClamps:lodMaxClamps:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexSamplerStates_lodMinClamps_lodMaxClamps_withRange(
            &self,
            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
            lod_min_clamps: NonNull<c_float>,
            lod_max_clamps: NonNull<c_float>,
            range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLVisibleFunctionTable"
        ))]
        /// Set a global visible function table for all vertex shaders at the given buffer bind point index.
        ///
        /// # Safety
        ///
        /// - `function_table` may need to be synchronized.
        /// - `function_table` may be unretained, you must ensure it is kept alive while in use.
        /// - `bufferIndex` might not be bounds-checked.
        #[unsafe(method(setVertexVisibleFunctionTable:atBufferIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexVisibleFunctionTable_atBufferIndex(
            &self,
            function_table: Option<&ProtocolObject<dyn MTLVisibleFunctionTable>>,
            buffer_index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLVisibleFunctionTable"
        ))]
        /// Set an array of global visible function tables for all vertex shaders with the given buffer bind point range.
        ///
        /// # Safety
        ///
        /// - `function_tables` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setVertexVisibleFunctionTables:withBufferRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexVisibleFunctionTables_withBufferRange(
            &self,
            function_tables: NonNull<*const ProtocolObject<dyn MTLVisibleFunctionTable>>,
            range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLIntersectionFunctionTable",
            feature = "MTLResource"
        ))]
        /// Set a global intersection function table for all vertex shaders at the given buffer bind point index.
        ///
        /// # Safety
        ///
        /// - `intersection_function_table` may need to be synchronized.
        /// - `intersection_function_table` may be unretained, you must ensure it is kept alive while in use.
        /// - `bufferIndex` might not be bounds-checked.
        #[unsafe(method(setVertexIntersectionFunctionTable:atBufferIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexIntersectionFunctionTable_atBufferIndex(
            &self,
            intersection_function_table: Option<&ProtocolObject<dyn MTLIntersectionFunctionTable>>,
            buffer_index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLIntersectionFunctionTable",
            feature = "MTLResource"
        ))]
        /// Set an array of global intersection function tables for all vertex shaders with the given buffer bind point range.
        ///
        /// # Safety
        ///
        /// - `intersection_function_tables` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setVertexIntersectionFunctionTables:withBufferRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexIntersectionFunctionTables_withBufferRange(
            &self,
            intersection_function_tables: NonNull<
                *const ProtocolObject<dyn MTLIntersectionFunctionTable>,
            >,
            range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAccelerationStructure",
            feature = "MTLAllocation",
            feature = "MTLResource"
        ))]
        /// Set a global acceleration structure for all vertex shaders at the given buffer bind point index.
        ///
        /// # Safety
        ///
        /// - `acceleration_structure` may need to be synchronized.
        /// - `acceleration_structure` may be unretained, you must ensure it is kept alive while in use.
        /// - `bufferIndex` might not be bounds-checked.
        #[unsafe(method(setVertexAccelerationStructure:atBufferIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexAccelerationStructure_atBufferIndex(
            &self,
            acceleration_structure: Option<&ProtocolObject<dyn MTLAccelerationStructure>>,
            buffer_index: NSUInteger,
        );

        /// Set the viewport, which is used to transform vertexes from normalized device coordinates to window coordinates.  Fragments that lie outside of the viewport are clipped, and optionally clamped for fragments outside of znear/zfar.
        #[unsafe(method(setViewport:))]
        #[unsafe(method_family = none)]
        fn setViewport(&self, viewport: MTLViewport);

        /// Specifies an array of viewports, which are used to transform vertices from normalized device coordinates to window coordinates based on [[ viewport_array_index ]] value specified in the vertex shader.
        ///
        /// # Safety
        ///
        /// - `viewports` must be a valid pointer.
        /// - `count` might not be bounds-checked.
        #[unsafe(method(setViewports:count:))]
        #[unsafe(method_family = none)]
        unsafe fn setViewports_count(&self, viewports: NonNull<MTLViewport>, count: NSUInteger);

        /// The winding order of front-facing primitives.
        #[unsafe(method(setFrontFacingWinding:))]
        #[unsafe(method_family = none)]
        fn setFrontFacingWinding(&self, front_facing_winding: MTLWinding);

        /// Specifies the vertex amplification count and associated view mappings for each amplification ID.
        ///
        /// Parameter `count`: the amplification count. The maximum value is currently 2.
        ///
        /// Parameter `viewMappings`: an array of mapping elements.
        ///
        /// Each mapping element describes how to route the corresponding amplification ID to a specific viewport and render target array index by using offsets from the base array index provided by the [[render_target_array_index]] and/or [[viewport_array_index]] output attributes in the vertex shader. This allows a modicum of programmability for each amplified vertex to be routed to a different [[render_target_array_index]] and [[viewport_array_index]] even though these attribytes cannot be amplified themselves.
        ///
        /// # Safety
        ///
        /// - `count` might not be bounds-checked.
        /// - `view_mappings` must be a valid pointer or null.
        #[unsafe(method(setVertexAmplificationCount:viewMappings:))]
        #[unsafe(method_family = none)]
        unsafe fn setVertexAmplificationCount_viewMappings(
            &self,
            count: NSUInteger,
            view_mappings: *const MTLVertexAmplificationViewMapping,
        );

        /// Controls if primitives are culled when front facing, back facing, or not culled at all.
        #[unsafe(method(setCullMode:))]
        #[unsafe(method_family = none)]
        fn setCullMode(&self, cull_mode: MTLCullMode);

        /// Controls what is done with fragments outside of the near or far planes.
        #[unsafe(method(setDepthClipMode:))]
        #[unsafe(method_family = none)]
        fn setDepthClipMode(&self, depth_clip_mode: MTLDepthClipMode);

        /// Depth Bias.
        #[unsafe(method(setDepthBias:slopeScale:clamp:))]
        #[unsafe(method_family = none)]
        fn setDepthBias_slopeScale_clamp(
            &self,
            depth_bias: c_float,
            slope_scale: c_float,
            clamp: c_float,
        );

        /// Configures the minimum and maximum bounds for depth bounds testing.
        ///
        /// The render command encoder disables depth bounds testing by default.
        /// The render command encoder also disables depth bounds testing when all of the following properties equal a specific value:
        /// - The `minBound` property is equal to `0.0f`.
        /// - The `maxBound` property is equal to `1.0f`.
        /// Both `minBound` and `maxBound` need to be within `[0.0f, 1.0f]`, and `minBound` needs to be less than or equal to `maxBound`.
        /// - Parameters:
        /// - minBound: A minimum bound for depth testing, which discards fragments with a stored depth that is less than `minBound`.
        /// - maxBound: A maximum bound for depth testing, which discards fragments with a stored depth that is greater than `maxBound`.
        #[unsafe(method(setDepthTestMinBound:maxBound:))]
        #[unsafe(method_family = none)]
        fn setDepthTestMinBound_maxBound(&self, min_bound: c_float, max_bound: c_float);

        /// Specifies a rectangle for a fragment scissor test.  All fragments outside of this rectangle are discarded.
        #[unsafe(method(setScissorRect:))]
        #[unsafe(method_family = none)]
        fn setScissorRect(&self, rect: MTLScissorRect);

        /// Specifies an array of rectangles for a fragment scissor test. The specific rectangle used is based on the [[ viewport_array_index ]] value output by the vertex shader. Fragments that lie outside the scissor rectangle are discarded.
        ///
        /// # Safety
        ///
        /// - `scissor_rects` must be a valid pointer.
        /// - `count` might not be bounds-checked.
        #[unsafe(method(setScissorRects:count:))]
        #[unsafe(method_family = none)]
        unsafe fn setScissorRects_count(
            &self,
            scissor_rects: NonNull<MTLScissorRect>,
            count: NSUInteger,
        );

        /// Set how to rasterize triangle and triangle strip primitives.
        #[unsafe(method(setTriangleFillMode:))]
        #[unsafe(method_family = none)]
        fn setTriangleFillMode(&self, fill_mode: MTLTriangleFillMode);

        /// Set the data (by copy) for a given fragment buffer binding point.  This will remove any existing MTLBuffer from the binding point.
        ///
        /// # Safety
        ///
        /// - `bytes` must be a valid pointer.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setFragmentBytes:length:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentBytes_length_atIndex(
            &self,
            bytes: NonNull<c_void>,
            length: NSUInteger,
            index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Set a global buffer for all fragment shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `buffer` may need to be synchronized.
        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `buffer` contents should be of the correct type.
        /// - `offset` might not be bounds-checked.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setFragmentBuffer:offset:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentBuffer_offset_atIndex(
            &self,
            buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
            offset: NSUInteger,
            index: NSUInteger,
        );

        /// Set the offset within the current global buffer for all fragment shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `offset` might not be bounds-checked.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setFragmentBufferOffset:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentBufferOffset_atIndex(&self, offset: NSUInteger, index: NSUInteger);

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Set an array of global buffers for all fragment shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `buffers` must be a valid pointer.
        /// - `offsets` might not be bounds-checked.
        /// - `offsets` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setFragmentBuffers:offsets:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentBuffers_offsets_withRange(
            &self,
            buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
            offsets: NonNull<NSUInteger>,
            range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLTexture"
        ))]
        /// Set a global texture for all fragment shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `texture` may need to be synchronized.
        /// - `texture` may be unretained, you must ensure it is kept alive while in use.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setFragmentTexture:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentTexture_atIndex(
            &self,
            texture: Option<&ProtocolObject<dyn MTLTexture>>,
            index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLTexture"
        ))]
        /// Set an array of global textures for all fragment shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `textures` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setFragmentTextures:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentTextures_withRange(
            &self,
            textures: NonNull<*const ProtocolObject<dyn MTLTexture>>,
            range: NSRange,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set a global sampler for all fragment shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// `index` might not be bounds-checked.
        #[unsafe(method(setFragmentSamplerState:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentSamplerState_atIndex(
            &self,
            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
            index: NSUInteger,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set an array of global samplers for all fragment shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `samplers` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setFragmentSamplerStates:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentSamplerStates_withRange(
            &self,
            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
            range: NSRange,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set a global sampler for all fragment shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// `index` might not be bounds-checked.
        #[unsafe(method(setFragmentSamplerState:lodMinClamp:lodMaxClamp:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentSamplerState_lodMinClamp_lodMaxClamp_atIndex(
            &self,
            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
            lod_min_clamp: c_float,
            lod_max_clamp: c_float,
            index: NSUInteger,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set an array of global samplers for all fragment shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `samplers` must be a valid pointer.
        /// - `lod_min_clamps` must be a valid pointer.
        /// - `lod_max_clamps` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setFragmentSamplerStates:lodMinClamps:lodMaxClamps:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentSamplerStates_lodMinClamps_lodMaxClamps_withRange(
            &self,
            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
            lod_min_clamps: NonNull<c_float>,
            lod_max_clamps: NonNull<c_float>,
            range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLVisibleFunctionTable"
        ))]
        /// Set a global visible function table for all fragment shaders at the given buffer bind point index.
        ///
        /// # Safety
        ///
        /// - `function_table` may need to be synchronized.
        /// - `function_table` may be unretained, you must ensure it is kept alive while in use.
        /// - `bufferIndex` might not be bounds-checked.
        #[unsafe(method(setFragmentVisibleFunctionTable:atBufferIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentVisibleFunctionTable_atBufferIndex(
            &self,
            function_table: Option<&ProtocolObject<dyn MTLVisibleFunctionTable>>,
            buffer_index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLVisibleFunctionTable"
        ))]
        /// Set an array of global visible function tables for all fragment shaders with the given buffer bind point range.
        ///
        /// # Safety
        ///
        /// - `function_tables` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setFragmentVisibleFunctionTables:withBufferRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentVisibleFunctionTables_withBufferRange(
            &self,
            function_tables: NonNull<*const ProtocolObject<dyn MTLVisibleFunctionTable>>,
            range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLIntersectionFunctionTable",
            feature = "MTLResource"
        ))]
        /// Set a global intersection function table for all fragment shaders at the given buffer bind point index.
        ///
        /// # Safety
        ///
        /// - `intersection_function_table` may need to be synchronized.
        /// - `intersection_function_table` may be unretained, you must ensure it is kept alive while in use.
        /// - `bufferIndex` might not be bounds-checked.
        #[unsafe(method(setFragmentIntersectionFunctionTable:atBufferIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentIntersectionFunctionTable_atBufferIndex(
            &self,
            intersection_function_table: Option<&ProtocolObject<dyn MTLIntersectionFunctionTable>>,
            buffer_index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLIntersectionFunctionTable",
            feature = "MTLResource"
        ))]
        /// Set an array of global intersection function tables for all fragment shaders with the given buffer bind point range.
        ///
        /// # Safety
        ///
        /// - `intersection_function_tables` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setFragmentIntersectionFunctionTables:withBufferRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentIntersectionFunctionTables_withBufferRange(
            &self,
            intersection_function_tables: NonNull<
                *const ProtocolObject<dyn MTLIntersectionFunctionTable>,
            >,
            range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAccelerationStructure",
            feature = "MTLAllocation",
            feature = "MTLResource"
        ))]
        /// Set a global acceleration structure for all fragment shaders at the given buffer bind point index.
        ///
        /// # Safety
        ///
        /// - `acceleration_structure` may need to be synchronized.
        /// - `acceleration_structure` may be unretained, you must ensure it is kept alive while in use.
        /// - `bufferIndex` might not be bounds-checked.
        #[unsafe(method(setFragmentAccelerationStructure:atBufferIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setFragmentAccelerationStructure_atBufferIndex(
            &self,
            acceleration_structure: Option<&ProtocolObject<dyn MTLAccelerationStructure>>,
            buffer_index: NSUInteger,
        );

        /// Set the constant blend color used across all blending on all render targets
        #[unsafe(method(setBlendColorRed:green:blue:alpha:))]
        #[unsafe(method_family = none)]
        fn setBlendColorRed_green_blue_alpha(
            &self,
            red: c_float,
            green: c_float,
            blue: c_float,
            alpha: c_float,
        );

        #[cfg(feature = "MTLDepthStencil")]
        /// Set the DepthStencil state object.
        #[unsafe(method(setDepthStencilState:))]
        #[unsafe(method_family = none)]
        fn setDepthStencilState(
            &self,
            depth_stencil_state: Option<&ProtocolObject<dyn MTLDepthStencilState>>,
        );

        /// Set the stencil reference value for both the back and front stencil buffers.
        #[unsafe(method(setStencilReferenceValue:))]
        #[unsafe(method_family = none)]
        fn setStencilReferenceValue(&self, reference_value: u32);

        /// Set the stencil reference value for the back and front stencil buffers independently.
        #[unsafe(method(setStencilFrontReferenceValue:backReferenceValue:))]
        #[unsafe(method_family = none)]
        fn setStencilFrontReferenceValue_backReferenceValue(
            &self,
            front_reference_value: u32,
            back_reference_value: u32,
        );

        /// Monitor if samples pass the depth and stencil tests.
        ///
        /// Parameter `mode`: Controls if the counter is disabled or moniters passing samples.
        ///
        /// Parameter `offset`: The offset relative to the occlusion query buffer provided when the command encoder was created.  offset must be a multiple of 8.
        #[unsafe(method(setVisibilityResultMode:offset:))]
        #[unsafe(method_family = none)]
        fn setVisibilityResultMode_offset(&self, mode: MTLVisibilityResultMode, offset: NSUInteger);

        #[cfg(feature = "MTLRenderPass")]
        /// If the the store action for a given color attachment was set to MTLStoreActionUnknown when the render command encoder was created,
        /// setColorStoreAction:atIndex: must be used to finalize the store action before endEncoding is called.
        ///
        /// Parameter `storeAction`: The desired store action for the given color attachment.  This may be set to any value other than MTLStoreActionUnknown.
        ///
        /// Parameter `colorAttachmentIndex`: The index of the color attachment
        ///
        /// # Safety
        ///
        /// `colorAttachmentIndex` might not be bounds-checked.
        #[unsafe(method(setColorStoreAction:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setColorStoreAction_atIndex(
            &self,
            store_action: MTLStoreAction,
            color_attachment_index: NSUInteger,
        );

        #[cfg(feature = "MTLRenderPass")]
        /// If the the store action for the depth attachment was set to MTLStoreActionUnknown when the render command encoder was created,
        /// setDepthStoreAction: must be used to finalize the store action before endEncoding is called.
        #[unsafe(method(setDepthStoreAction:))]
        #[unsafe(method_family = none)]
        fn setDepthStoreAction(&self, store_action: MTLStoreAction);

        #[cfg(feature = "MTLRenderPass")]
        /// If the the store action for the stencil attachment was set to MTLStoreActionUnknown when the render command encoder was created,
        /// setStencilStoreAction: must be used to finalize the store action before endEncoding is called.
        #[unsafe(method(setStencilStoreAction:))]
        #[unsafe(method_family = none)]
        fn setStencilStoreAction(&self, store_action: MTLStoreAction);

        #[cfg(feature = "MTLRenderPass")]
        /// If the the store action for a given color attachment was set to MTLStoreActionUnknown when the render command encoder was created,
        /// setColorStoreActionOptions:atIndex: may be used to finalize the store action options before endEncoding is called.
        ///
        /// Parameter `storeActionOptions`: The desired store action options for the given color attachment.
        ///
        /// Parameter `colorAttachmentIndex`: The index of the color attachment
        ///
        /// # Safety
        ///
        /// `colorAttachmentIndex` might not be bounds-checked.
        #[unsafe(method(setColorStoreActionOptions:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setColorStoreActionOptions_atIndex(
            &self,
            store_action_options: MTLStoreActionOptions,
            color_attachment_index: NSUInteger,
        );

        #[cfg(feature = "MTLRenderPass")]
        /// If the the store action for the depth attachment was set to MTLStoreActionUnknown when the render command encoder was created,
        /// setDepthStoreActionOptions: may be used to finalize the store action options before endEncoding is called.
        #[unsafe(method(setDepthStoreActionOptions:))]
        #[unsafe(method_family = none)]
        fn setDepthStoreActionOptions(&self, store_action_options: MTLStoreActionOptions);

        #[cfg(feature = "MTLRenderPass")]
        /// If the the store action for the stencil attachment was set to MTLStoreActionUnknown when the render command encoder was created,
        /// setStencilStoreActionOptions: may be used to finalize the store action options before endEncoding is called.
        #[unsafe(method(setStencilStoreActionOptions:))]
        #[unsafe(method_family = none)]
        fn setStencilStoreActionOptions(&self, store_action_options: MTLStoreActionOptions);

        /// Set the data (by copy) for a given object shader buffer binding point.  This will remove any existing MTLBuffer from the binding point.
        ///
        /// # Safety
        ///
        /// - `bytes` must be a valid pointer.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setObjectBytes:length:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setObjectBytes_length_atIndex(
            &self,
            bytes: NonNull<c_void>,
            length: NSUInteger,
            index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Set a global buffer for all object shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `buffer` may need to be synchronized.
        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `buffer` contents should be of the correct type.
        /// - `offset` might not be bounds-checked.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setObjectBuffer:offset:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setObjectBuffer_offset_atIndex(
            &self,
            buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
            offset: NSUInteger,
            index: NSUInteger,
        );

        /// Set the offset within the current global buffer for all object shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `offset` might not be bounds-checked.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setObjectBufferOffset:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setObjectBufferOffset_atIndex(&self, offset: NSUInteger, index: NSUInteger);

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Set an array of global buffers for all object shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `buffers` must be a valid pointer.
        /// - `offsets` might not be bounds-checked.
        /// - `offsets` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setObjectBuffers:offsets:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setObjectBuffers_offsets_withRange(
            &self,
            buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
            offsets: NonNull<NSUInteger>,
            range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLTexture"
        ))]
        /// Set a global texture for all object shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `texture` may need to be synchronized.
        /// - `texture` may be unretained, you must ensure it is kept alive while in use.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setObjectTexture:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setObjectTexture_atIndex(
            &self,
            texture: Option<&ProtocolObject<dyn MTLTexture>>,
            index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLTexture"
        ))]
        /// Set an array of global textures for all object shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `textures` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setObjectTextures:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setObjectTextures_withRange(
            &self,
            textures: NonNull<*const ProtocolObject<dyn MTLTexture>>,
            range: NSRange,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set a global sampler for all object shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// `index` might not be bounds-checked.
        #[unsafe(method(setObjectSamplerState:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setObjectSamplerState_atIndex(
            &self,
            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
            index: NSUInteger,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set an array of global samplers for all object shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `samplers` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setObjectSamplerStates:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setObjectSamplerStates_withRange(
            &self,
            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
            range: NSRange,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set a global sampler for all object shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// `index` might not be bounds-checked.
        #[unsafe(method(setObjectSamplerState:lodMinClamp:lodMaxClamp:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setObjectSamplerState_lodMinClamp_lodMaxClamp_atIndex(
            &self,
            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
            lod_min_clamp: c_float,
            lod_max_clamp: c_float,
            index: NSUInteger,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set an array of global samplers for all object shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `samplers` must be a valid pointer.
        /// - `lod_min_clamps` must be a valid pointer.
        /// - `lod_max_clamps` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setObjectSamplerStates:lodMinClamps:lodMaxClamps:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setObjectSamplerStates_lodMinClamps_lodMaxClamps_withRange(
            &self,
            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
            lod_min_clamps: NonNull<c_float>,
            lod_max_clamps: NonNull<c_float>,
            range: NSRange,
        );

        /// Set the threadgroup memory byte length at the binding point specified by the index for all object shaders.
        ///
        /// # Safety
        ///
        /// `index` might not be bounds-checked.
        #[unsafe(method(setObjectThreadgroupMemoryLength:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setObjectThreadgroupMemoryLength_atIndex(
            &self,
            length: NSUInteger,
            index: NSUInteger,
        );

        /// Set the data (by copy) for a given mesh shader buffer binding point.  This will remove any existing MTLBuffer from the binding point.
        ///
        /// # Safety
        ///
        /// - `bytes` must be a valid pointer.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setMeshBytes:length:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setMeshBytes_length_atIndex(
            &self,
            bytes: NonNull<c_void>,
            length: NSUInteger,
            index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Set a global buffer for all mesh shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `buffer` may need to be synchronized.
        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `buffer` contents should be of the correct type.
        /// - `offset` might not be bounds-checked.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setMeshBuffer:offset:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setMeshBuffer_offset_atIndex(
            &self,
            buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
            offset: NSUInteger,
            index: NSUInteger,
        );

        /// Set the offset within the current global buffer for all mesh shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `offset` might not be bounds-checked.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setMeshBufferOffset:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setMeshBufferOffset_atIndex(&self, offset: NSUInteger, index: NSUInteger);

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Set an array of global buffers for all mesh shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `buffers` must be a valid pointer.
        /// - `offsets` might not be bounds-checked.
        /// - `offsets` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setMeshBuffers:offsets:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setMeshBuffers_offsets_withRange(
            &self,
            buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
            offsets: NonNull<NSUInteger>,
            range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLTexture"
        ))]
        /// Set a global texture for all mesh shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `texture` may need to be synchronized.
        /// - `texture` may be unretained, you must ensure it is kept alive while in use.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setMeshTexture:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setMeshTexture_atIndex(
            &self,
            texture: Option<&ProtocolObject<dyn MTLTexture>>,
            index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLTexture"
        ))]
        /// Set an array of global textures for all mesh shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `textures` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setMeshTextures:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setMeshTextures_withRange(
            &self,
            textures: NonNull<*const ProtocolObject<dyn MTLTexture>>,
            range: NSRange,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set a global sampler for all mesh shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// `index` might not be bounds-checked.
        #[unsafe(method(setMeshSamplerState:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setMeshSamplerState_atIndex(
            &self,
            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
            index: NSUInteger,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set an array of global samplers for all mesh shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `samplers` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setMeshSamplerStates:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setMeshSamplerStates_withRange(
            &self,
            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
            range: NSRange,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set a global sampler for all mesh shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// `index` might not be bounds-checked.
        #[unsafe(method(setMeshSamplerState:lodMinClamp:lodMaxClamp:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setMeshSamplerState_lodMinClamp_lodMaxClamp_atIndex(
            &self,
            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
            lod_min_clamp: c_float,
            lod_max_clamp: c_float,
            index: NSUInteger,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set an array of global samplers for all mesh shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `samplers` must be a valid pointer.
        /// - `lod_min_clamps` must be a valid pointer.
        /// - `lod_max_clamps` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setMeshSamplerStates:lodMinClamps:lodMaxClamps:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setMeshSamplerStates_lodMinClamps_lodMaxClamps_withRange(
            &self,
            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
            lod_min_clamps: NonNull<c_float>,
            lod_max_clamps: NonNull<c_float>,
            range: NSRange,
        );

        #[cfg(feature = "MTLTypes")]
        /// Enqueue a grid of object (if present) or mesh shader threadgroups.
        ///
        /// The dimensions of the threadgroups and the grid are specified directly.
        ///
        /// Parameter `threadgroupsPerGrid`: The number of threadgroups in the object (if present) or mesh shader grid.
        ///
        /// Parameter `threadsPerObjectThreadgroup`: The number of threads in one object shader threadgroup. Ignored if object shader is not present.
        ///
        /// Parameter `threadsPerMeshThreadgroup`: The number of threads in one mesh shader threadgroup.
        #[unsafe(method(drawMeshThreadgroups:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:))]
        #[unsafe(method_family = none)]
        fn drawMeshThreadgroups_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
            &self,
            threadgroups_per_grid: MTLSize,
            threads_per_object_threadgroup: MTLSize,
            threads_per_mesh_threadgroup: MTLSize,
        );

        #[cfg(feature = "MTLTypes")]
        /// Enqueue a grid of object (if present) of mesh shader threadgroups.
        ///
        /// The dimensions of the threadgroups and the grid are specified directly.
        /// The dimensions of threadsPerGrid does not have to be a multiple of threadsPerThreadgroup for object shaders.
        /// For mesh shaders, threadsPerGrid is rounded down to the neareset multiple of threadsPerMeshThreadgroup (in each dimension).
        ///
        /// Parameter `threadsPerGrid`: The number of threads in the object (if present) or mesh shader grid
        ///
        /// Parameter `threadsPerObjectThreadgroup`: The number of threads in one object shader threadgroup. Ignored if object shader is not present.
        ///
        /// Parameter `threadsPerMeshThreadgroup`: The number of threads in one mesh shader threadgroup.
        #[unsafe(method(drawMeshThreads:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:))]
        #[unsafe(method_family = none)]
        fn drawMeshThreads_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
            &self,
            threads_per_grid: MTLSize,
            threads_per_object_threadgroup: MTLSize,
            threads_per_mesh_threadgroup: MTLSize,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource",
            feature = "MTLTypes"
        ))]
        /// Enqueue a grid of object (if present) or mesh shader threadgroups.
        ///
        /// The dimensions of the threadgroups are specified directly, the dimensions of the grid, in threadgroups, are read from a buffer by the GPU.
        ///
        /// Parameter `indirectBuffer`: A buffer object that the device will read the grid size from, see MTLDispatchThreadgroupsIndirectArguments.
        ///
        /// Parameter `indirectBufferOffset`: Byte offset within
        /// _indirectBuffer_to read arguments from.
        /// _indirectBufferOffset_must be a multiple of 4.
        ///
        /// Parameter `threadsPerObjectThreadgroup`: The number of threads in one object shader threadgroup. Ignored if object shader is not present.
        ///
        /// Parameter `threadsPerMeshThreadgroup`: The number of threads in one mesh shader threadgroup.
        ///
        /// # Safety
        ///
        /// - `indirect_buffer` may need to be synchronized.
        /// - `indirect_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `indirect_buffer` contents should be of the correct type.
        /// - `indirectBufferOffset` might not be bounds-checked.
        #[unsafe(method(drawMeshThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:))]
        #[unsafe(method_family = none)]
        unsafe fn drawMeshThreadgroupsWithIndirectBuffer_indirectBufferOffset_threadsPerObjectThreadgroup_threadsPerMeshThreadgroup(
            &self,
            indirect_buffer: &ProtocolObject<dyn MTLBuffer>,
            indirect_buffer_offset: NSUInteger,
            threads_per_object_threadgroup: MTLSize,
            threads_per_mesh_threadgroup: MTLSize,
        );

        /// Draw primitives without an index list.
        ///
        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
        ///
        /// Parameter `vertexStart`: For each instance, the first index to draw
        ///
        /// Parameter `vertexCount`: For each instance, the number of indexes to draw
        ///
        /// Parameter `instanceCount`: The number of instances drawn.
        ///
        /// # Safety
        ///
        /// - `vertexCount` might not be bounds-checked.
        /// - `instanceCount` might not be bounds-checked.
        #[unsafe(method(drawPrimitives:vertexStart:vertexCount:instanceCount:))]
        #[unsafe(method_family = none)]
        unsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount(
            &self,
            primitive_type: MTLPrimitiveType,
            vertex_start: NSUInteger,
            vertex_count: NSUInteger,
            instance_count: NSUInteger,
        );

        /// Draw primitives without an index list.
        ///
        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
        ///
        /// Parameter `vertexStart`: For each instance, the first index to draw
        ///
        /// Parameter `vertexCount`: For each instance, the number of indexes to draw
        ///
        /// # Safety
        ///
        /// `vertexCount` might not be bounds-checked.
        #[unsafe(method(drawPrimitives:vertexStart:vertexCount:))]
        #[unsafe(method_family = none)]
        unsafe fn drawPrimitives_vertexStart_vertexCount(
            &self,
            primitive_type: MTLPrimitiveType,
            vertex_start: NSUInteger,
            vertex_count: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLArgument",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Draw primitives with an index list.
        ///
        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
        ///
        /// Parameter `indexCount`: The number of indexes to read from the index buffer for each instance.
        ///
        /// Parameter `indexType`: The type if indexes, either 16 bit integer or 32 bit integer.
        ///
        /// Parameter `indexBuffer`: A buffer object that the device will read indexes from.
        ///
        /// Parameter `indexBufferOffset`: Byte offset within
        /// _indexBuffer_to start reading indexes from.
        /// _indexBufferOffset_must be a multiple of the index size.
        ///
        /// Parameter `instanceCount`: The number of instances drawn.
        ///
        /// # Safety
        ///
        /// - `indexCount` might not be bounds-checked.
        /// - `index_buffer` may need to be synchronized.
        /// - `index_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `index_buffer` contents should be of the correct type.
        /// - `indexBufferOffset` might not be bounds-checked.
        /// - `instanceCount` might not be bounds-checked.
        #[unsafe(method(drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:))]
        #[unsafe(method_family = none)]
        unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferOffset_instanceCount(
            &self,
            primitive_type: MTLPrimitiveType,
            index_count: NSUInteger,
            index_type: MTLIndexType,
            index_buffer: &ProtocolObject<dyn MTLBuffer>,
            index_buffer_offset: NSUInteger,
            instance_count: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLArgument",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Draw primitives with an index list.
        ///
        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
        ///
        /// Parameter `indexCount`: The number of indexes to read from the index buffer for each instance.
        ///
        /// Parameter `indexType`: The type if indexes, either 16 bit integer or 32 bit integer.
        ///
        /// Parameter `indexBuffer`: A buffer object that the device will read indexes from.
        ///
        /// Parameter `indexBufferOffset`: Byte offset within
        /// _indexBuffer_to start reading indexes from.
        /// _indexBufferOffset_must be a multiple of the index size.
        ///
        /// # Safety
        ///
        /// - `indexCount` might not be bounds-checked.
        /// - `index_buffer` may need to be synchronized.
        /// - `index_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `index_buffer` contents should be of the correct type.
        /// - `indexBufferOffset` might not be bounds-checked.
        #[unsafe(method(drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:))]
        #[unsafe(method_family = none)]
        unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferOffset(
            &self,
            primitive_type: MTLPrimitiveType,
            index_count: NSUInteger,
            index_type: MTLIndexType,
            index_buffer: &ProtocolObject<dyn MTLBuffer>,
            index_buffer_offset: NSUInteger,
        );

        /// Draw primitives without an index list.
        ///
        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
        ///
        /// Parameter `vertexStart`: For each instance, the first index to draw
        ///
        /// Parameter `vertexCount`: For each instance, the number of indexes to draw
        ///
        /// Parameter `instanceCount`: The number of instances drawn.
        ///
        /// Parameter `baseInstance`: Offset for instance_id.
        ///
        /// # Safety
        ///
        /// - `vertexCount` might not be bounds-checked.
        /// - `instanceCount` might not be bounds-checked.
        #[unsafe(method(drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance:))]
        #[unsafe(method_family = none)]
        unsafe fn drawPrimitives_vertexStart_vertexCount_instanceCount_baseInstance(
            &self,
            primitive_type: MTLPrimitiveType,
            vertex_start: NSUInteger,
            vertex_count: NSUInteger,
            instance_count: NSUInteger,
            base_instance: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLArgument",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Draw primitives with an index list.
        ///
        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
        ///
        /// Parameter `indexCount`: The number of indexes to read from the index buffer for each instance.
        ///
        /// Parameter `indexType`: The type if indexes, either 16 bit integer or 32 bit integer.
        ///
        /// Parameter `indexBuffer`: A buffer object that the device will read indexes from.
        ///
        /// Parameter `indexBufferOffset`: Byte offset within
        /// _indexBuffer_to start reading indexes from.
        /// _indexBufferOffset_must be a multiple of the index size.
        ///
        /// Parameter `instanceCount`: The number of instances drawn.
        ///
        /// Parameter `baseVertex`: Offset for vertex_id. NOTE: this can be negative
        ///
        /// Parameter `baseInstance`: Offset for instance_id.
        ///
        /// # Safety
        ///
        /// - `indexCount` might not be bounds-checked.
        /// - `index_buffer` may need to be synchronized.
        /// - `index_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `index_buffer` contents should be of the correct type.
        /// - `indexBufferOffset` might not be bounds-checked.
        /// - `instanceCount` might not be bounds-checked.
        #[unsafe(method(drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:))]
        #[unsafe(method_family = none)]
        unsafe fn drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferOffset_instanceCount_baseVertex_baseInstance(
            &self,
            primitive_type: MTLPrimitiveType,
            index_count: NSUInteger,
            index_type: MTLIndexType,
            index_buffer: &ProtocolObject<dyn MTLBuffer>,
            index_buffer_offset: NSUInteger,
            instance_count: NSUInteger,
            base_vertex: NSInteger,
            base_instance: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Draw primitives without an index list using an indirect buffer see MTLDrawPrimitivesIndirectArguments.
        ///
        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
        ///
        /// Parameter `indirectBuffer`: A buffer object that the device will read drawPrimitives arguments from, see MTLDrawPrimitivesIndirectArguments.
        ///
        /// Parameter `indirectBufferOffset`: Byte offset within
        /// _indirectBuffer_to start reading indexes from.
        /// _indirectBufferOffset_must be a multiple of 4.
        ///
        /// # Safety
        ///
        /// - `indirect_buffer` may need to be synchronized.
        /// - `indirect_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `indirect_buffer` contents should be of the correct type.
        /// - `indirectBufferOffset` might not be bounds-checked.
        #[unsafe(method(drawPrimitives:indirectBuffer:indirectBufferOffset:))]
        #[unsafe(method_family = none)]
        unsafe fn drawPrimitives_indirectBuffer_indirectBufferOffset(
            &self,
            primitive_type: MTLPrimitiveType,
            indirect_buffer: &ProtocolObject<dyn MTLBuffer>,
            indirect_buffer_offset: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLArgument",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Draw primitives with an index list using an indirect buffer see MTLDrawIndexedPrimitivesIndirectArguments.
        ///
        /// Parameter `primitiveType`: The type of primitives that elements are assembled into.
        ///
        /// Parameter `indexType`: The type if indexes, either 16 bit integer or 32 bit integer.
        ///
        /// Parameter `indexBuffer`: A buffer object that the device will read indexes from.
        ///
        /// Parameter `indexBufferOffset`: Byte offset within
        /// _indexBuffer_to start reading indexes from.
        /// _indexBufferOffset_must be a multiple of the index size.
        ///
        /// Parameter `indirectBuffer`: A buffer object that the device will read drawIndexedPrimitives arguments from, see MTLDrawIndexedPrimitivesIndirectArguments.
        ///
        /// Parameter `indirectBufferOffset`: Byte offset within
        /// _indirectBuffer_to start reading indexes from.
        /// _indirectBufferOffset_must be a multiple of 4.
        ///
        /// # Safety
        ///
        /// - `index_buffer` may need to be synchronized.
        /// - `index_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `index_buffer` contents should be of the correct type.
        /// - `indexBufferOffset` might not be bounds-checked.
        /// - `indirect_buffer` may need to be synchronized.
        /// - `indirect_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `indirect_buffer` contents should be of the correct type.
        /// - `indirectBufferOffset` might not be bounds-checked.
        #[unsafe(method(drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset:))]
        #[unsafe(method_family = none)]
        unsafe fn drawIndexedPrimitives_indexType_indexBuffer_indexBufferOffset_indirectBuffer_indirectBufferOffset(
            &self,
            primitive_type: MTLPrimitiveType,
            index_type: MTLIndexType,
            index_buffer: &ProtocolObject<dyn MTLBuffer>,
            index_buffer_offset: NSUInteger,
            indirect_buffer: &ProtocolObject<dyn MTLBuffer>,
            indirect_buffer_offset: NSUInteger,
        );

        /// Ensure that following fragment shaders can read textures written by previous draw calls (in particular the framebuffer)
        #[deprecated]
        #[unsafe(method(textureBarrier))]
        #[unsafe(method_family = none)]
        fn textureBarrier(&self);

        #[cfg(feature = "MTLFence")]
        /// Update the fence to capture all GPU work so far enqueued by this encoder for the given stages.
        ///
        /// Unlike
        /// <st
        /// >updateFence:
        /// </st
        /// >, this method will update the fence when the given stage(s) complete, allowing for commands to overlap in execution.
        /// On iOS, render command encoder fence updates are always delayed until the end of the encoder.
        #[unsafe(method(updateFence:afterStages:))]
        #[unsafe(method_family = none)]
        fn updateFence_afterStages(
            &self,
            fence: &ProtocolObject<dyn MTLFence>,
            stages: MTLRenderStages,
        );

        #[cfg(feature = "MTLFence")]
        /// Prevent further GPU work until the fence is reached for the given stages.
        ///
        /// Unlike
        /// <st
        /// >waitForFence:
        /// </st
        /// >, this method will only block commands assoicated with the given stage(s), allowing for commands to overlap in execution.
        /// On iOS, render command encoder fence waits always occur the beginning of the encoder.
        #[unsafe(method(waitForFence:beforeStages:))]
        #[unsafe(method_family = none)]
        fn waitForFence_beforeStages(
            &self,
            fence: &ProtocolObject<dyn MTLFence>,
            stages: MTLRenderStages,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// # Safety
        ///
        /// - `buffer` may need to be synchronized.
        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `buffer` contents should be of the correct type.
        /// - `offset` might not be bounds-checked.
        /// - `instanceStride` might not be bounds-checked.
        #[unsafe(method(setTessellationFactorBuffer:offset:instanceStride:))]
        #[unsafe(method_family = none)]
        unsafe fn setTessellationFactorBuffer_offset_instanceStride(
            &self,
            buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
            offset: NSUInteger,
            instance_stride: NSUInteger,
        );

        #[unsafe(method(setTessellationFactorScale:))]
        #[unsafe(method_family = none)]
        fn setTessellationFactorScale(&self, scale: c_float);

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// # Safety
        ///
        /// - `patchCount` might not be bounds-checked.
        /// - `patch_index_buffer` may need to be synchronized.
        /// - `patch_index_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `patch_index_buffer` contents should be of the correct type.
        /// - `patchIndexBufferOffset` might not be bounds-checked.
        /// - `instanceCount` might not be bounds-checked.
        #[unsafe(method(drawPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:))]
        #[unsafe(method_family = none)]
        unsafe fn drawPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_instanceCount_baseInstance(
            &self,
            number_of_patch_control_points: NSUInteger,
            patch_start: NSUInteger,
            patch_count: NSUInteger,
            patch_index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
            patch_index_buffer_offset: NSUInteger,
            instance_count: NSUInteger,
            base_instance: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// # Safety
        ///
        /// - `patch_index_buffer` may need to be synchronized.
        /// - `patch_index_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `patch_index_buffer` contents should be of the correct type.
        /// - `patchIndexBufferOffset` might not be bounds-checked.
        /// - `indirect_buffer` may need to be synchronized.
        /// - `indirect_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `indirect_buffer` contents should be of the correct type.
        /// - `indirectBufferOffset` might not be bounds-checked.
        #[unsafe(method(drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset:))]
        #[unsafe(method_family = none)]
        unsafe fn drawPatches_patchIndexBuffer_patchIndexBufferOffset_indirectBuffer_indirectBufferOffset(
            &self,
            number_of_patch_control_points: NSUInteger,
            patch_index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
            patch_index_buffer_offset: NSUInteger,
            indirect_buffer: &ProtocolObject<dyn MTLBuffer>,
            indirect_buffer_offset: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// # Safety
        ///
        /// - `patchCount` might not be bounds-checked.
        /// - `patch_index_buffer` may need to be synchronized.
        /// - `patch_index_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `patch_index_buffer` contents should be of the correct type.
        /// - `patchIndexBufferOffset` might not be bounds-checked.
        /// - `control_point_index_buffer` may need to be synchronized.
        /// - `control_point_index_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `control_point_index_buffer` contents should be of the correct type.
        /// - `controlPointIndexBufferOffset` might not be bounds-checked.
        /// - `instanceCount` might not be bounds-checked.
        #[unsafe(method(drawIndexedPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance:))]
        #[unsafe(method_family = none)]
        unsafe fn drawIndexedPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_controlPointIndexBuffer_controlPointIndexBufferOffset_instanceCount_baseInstance(
            &self,
            number_of_patch_control_points: NSUInteger,
            patch_start: NSUInteger,
            patch_count: NSUInteger,
            patch_index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
            patch_index_buffer_offset: NSUInteger,
            control_point_index_buffer: &ProtocolObject<dyn MTLBuffer>,
            control_point_index_buffer_offset: NSUInteger,
            instance_count: NSUInteger,
            base_instance: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// # Safety
        ///
        /// - `patch_index_buffer` may need to be synchronized.
        /// - `patch_index_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `patch_index_buffer` contents should be of the correct type.
        /// - `patchIndexBufferOffset` might not be bounds-checked.
        /// - `control_point_index_buffer` may need to be synchronized.
        /// - `control_point_index_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `control_point_index_buffer` contents should be of the correct type.
        /// - `controlPointIndexBufferOffset` might not be bounds-checked.
        /// - `indirect_buffer` may need to be synchronized.
        /// - `indirect_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `indirect_buffer` contents should be of the correct type.
        /// - `indirectBufferOffset` might not be bounds-checked.
        #[unsafe(method(drawIndexedPatches:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:indirectBuffer:indirectBufferOffset:))]
        #[unsafe(method_family = none)]
        unsafe fn drawIndexedPatches_patchIndexBuffer_patchIndexBufferOffset_controlPointIndexBuffer_controlPointIndexBufferOffset_indirectBuffer_indirectBufferOffset(
            &self,
            number_of_patch_control_points: NSUInteger,
            patch_index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
            patch_index_buffer_offset: NSUInteger,
            control_point_index_buffer: &ProtocolObject<dyn MTLBuffer>,
            control_point_index_buffer_offset: NSUInteger,
            indirect_buffer: &ProtocolObject<dyn MTLBuffer>,
            indirect_buffer_offset: NSUInteger,
        );

        /// The width of the tile for this render pass.
        #[unsafe(method(tileWidth))]
        #[unsafe(method_family = none)]
        fn tileWidth(&self) -> NSUInteger;

        /// The height of the tile for this render pass.
        #[unsafe(method(tileHeight))]
        #[unsafe(method_family = none)]
        fn tileHeight(&self) -> NSUInteger;

        /// Set the data (by copy) for a given tile buffer binding point.  This will remove any existing MTLBuffer from the binding point.
        ///
        /// # Safety
        ///
        /// - `bytes` must be a valid pointer.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setTileBytes:length:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileBytes_length_atIndex(
            &self,
            bytes: NonNull<c_void>,
            length: NSUInteger,
            index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Set a global buffer for all tile shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `buffer` may need to be synchronized.
        /// - `buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `buffer` contents should be of the correct type.
        /// - `offset` might not be bounds-checked.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setTileBuffer:offset:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileBuffer_offset_atIndex(
            &self,
            buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
            offset: NSUInteger,
            index: NSUInteger,
        );

        /// Set the offset within the current global buffer for all tile shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `offset` might not be bounds-checked.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setTileBufferOffset:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileBufferOffset_atIndex(&self, offset: NSUInteger, index: NSUInteger);

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLResource"
        ))]
        /// Set an array of global buffers for all tile shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `buffers` must be a valid pointer.
        /// - `offsets` might not be bounds-checked.
        /// - `offsets` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setTileBuffers:offsets:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileBuffers_offsets_withRange(
            &self,
            buffers: NonNull<*const ProtocolObject<dyn MTLBuffer>>,
            offsets: NonNull<NSUInteger>,
            range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLTexture"
        ))]
        /// Set a global texture for all tile shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// - `texture` may need to be synchronized.
        /// - `texture` may be unretained, you must ensure it is kept alive while in use.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setTileTexture:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileTexture_atIndex(
            &self,
            texture: Option<&ProtocolObject<dyn MTLTexture>>,
            index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLTexture"
        ))]
        /// Set an array of global textures for all tile shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `textures` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setTileTextures:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileTextures_withRange(
            &self,
            textures: NonNull<*const ProtocolObject<dyn MTLTexture>>,
            range: NSRange,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set a global sampler for all tile shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// `index` might not be bounds-checked.
        #[unsafe(method(setTileSamplerState:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileSamplerState_atIndex(
            &self,
            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
            index: NSUInteger,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set an array of global samplers for all fragment shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `samplers` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setTileSamplerStates:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileSamplerStates_withRange(
            &self,
            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
            range: NSRange,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set a global sampler for all tile shaders at the given bind point index.
        ///
        /// # Safety
        ///
        /// `index` might not be bounds-checked.
        #[unsafe(method(setTileSamplerState:lodMinClamp:lodMaxClamp:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileSamplerState_lodMinClamp_lodMaxClamp_atIndex(
            &self,
            sampler: Option<&ProtocolObject<dyn MTLSamplerState>>,
            lod_min_clamp: c_float,
            lod_max_clamp: c_float,
            index: NSUInteger,
        );

        #[cfg(feature = "MTLSampler")]
        /// Set an array of global samplers for all tile shaders with the given bind point range.
        ///
        /// # Safety
        ///
        /// - `samplers` must be a valid pointer.
        /// - `lod_min_clamps` must be a valid pointer.
        /// - `lod_max_clamps` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setTileSamplerStates:lodMinClamps:lodMaxClamps:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileSamplerStates_lodMinClamps_lodMaxClamps_withRange(
            &self,
            samplers: NonNull<*const ProtocolObject<dyn MTLSamplerState>>,
            lod_min_clamps: NonNull<c_float>,
            lod_max_clamps: NonNull<c_float>,
            range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLVisibleFunctionTable"
        ))]
        /// Set a global visible function table for all tile shaders at the given buffer bind point index.
        ///
        /// # Safety
        ///
        /// - `function_table` may need to be synchronized.
        /// - `function_table` may be unretained, you must ensure it is kept alive while in use.
        /// - `bufferIndex` might not be bounds-checked.
        #[unsafe(method(setTileVisibleFunctionTable:atBufferIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileVisibleFunctionTable_atBufferIndex(
            &self,
            function_table: Option<&ProtocolObject<dyn MTLVisibleFunctionTable>>,
            buffer_index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLResource",
            feature = "MTLVisibleFunctionTable"
        ))]
        /// Set an array of global visible function tables for all tile shaders with the given buffer bind point range.
        ///
        /// # Safety
        ///
        /// - `function_tables` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setTileVisibleFunctionTables:withBufferRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileVisibleFunctionTables_withBufferRange(
            &self,
            function_tables: NonNull<*const ProtocolObject<dyn MTLVisibleFunctionTable>>,
            range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLIntersectionFunctionTable",
            feature = "MTLResource"
        ))]
        /// Set a global intersection function table for all tile shaders at the given buffer bind point index.
        ///
        /// # Safety
        ///
        /// - `intersection_function_table` may need to be synchronized.
        /// - `intersection_function_table` may be unretained, you must ensure it is kept alive while in use.
        /// - `bufferIndex` might not be bounds-checked.
        #[unsafe(method(setTileIntersectionFunctionTable:atBufferIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileIntersectionFunctionTable_atBufferIndex(
            &self,
            intersection_function_table: Option<&ProtocolObject<dyn MTLIntersectionFunctionTable>>,
            buffer_index: NSUInteger,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLIntersectionFunctionTable",
            feature = "MTLResource"
        ))]
        /// Set an array of global intersection function tables for all tile shaders with the given buffer bind point range.
        ///
        /// # Safety
        ///
        /// - `intersection_function_tables` must be a valid pointer.
        /// - `range` might not be bounds-checked.
        #[unsafe(method(setTileIntersectionFunctionTables:withBufferRange:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileIntersectionFunctionTables_withBufferRange(
            &self,
            intersection_function_tables: NonNull<
                *const ProtocolObject<dyn MTLIntersectionFunctionTable>,
            >,
            range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAccelerationStructure",
            feature = "MTLAllocation",
            feature = "MTLResource"
        ))]
        /// Set a global acceleration structure for all tile shaders at the given buffer bind point index.
        ///
        /// # Safety
        ///
        /// - `acceleration_structure` may need to be synchronized.
        /// - `acceleration_structure` may be unretained, you must ensure it is kept alive while in use.
        /// - `bufferIndex` might not be bounds-checked.
        #[unsafe(method(setTileAccelerationStructure:atBufferIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setTileAccelerationStructure_atBufferIndex(
            &self,
            acceleration_structure: Option<&ProtocolObject<dyn MTLAccelerationStructure>>,
            buffer_index: NSUInteger,
        );

        #[cfg(feature = "MTLTypes")]
        /// dispatch threads to perform a mid-render compute operation.
        #[unsafe(method(dispatchThreadsPerTile:))]
        #[unsafe(method_family = none)]
        fn dispatchThreadsPerTile(&self, threads_per_tile: MTLSize);

        /// Set the size of the threadgroup memory argument at the given bind point index and offset.
        ///
        /// # Safety
        ///
        /// - `offset` might not be bounds-checked.
        /// - `index` might not be bounds-checked.
        #[unsafe(method(setThreadgroupMemoryLength:offset:atIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn setThreadgroupMemoryLength_offset_atIndex(
            &self,
            length: NSUInteger,
            offset: NSUInteger,
            index: NSUInteger,
        );

        #[cfg(all(feature = "MTLAllocation", feature = "MTLResource"))]
        /// Declare that a resource may be accessed by the render pass through an argument buffer
        ///
        /// This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resource through an argument buffer. However, this method may cause color attachments to become decompressed. Therefore, this method should be called until as late as possible within a render command encoder. Declaring a minimal usage (i.e. read-only) may prevent color attachments from becoming decompressed on some devices.
        ///
        /// Note that calling useResource does not retain the resource. It is the responsiblity of the user to retain the resource until
        /// the command buffer has been executed.
        #[deprecated]
        #[unsafe(method(useResource:usage:))]
        #[unsafe(method_family = none)]
        fn useResource_usage(
            &self,
            resource: &ProtocolObject<dyn MTLResource>,
            usage: MTLResourceUsage,
        );

        #[cfg(all(feature = "MTLAllocation", feature = "MTLResource"))]
        /// Declare that an array of resources may be accessed through an argument buffer by the render pass
        ///
        /// This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources through an argument buffer. However, this method may cause color attachments to become decompressed. Therefore, this method should be called until as late as possible within a render command encoder. Declaring a minimal usage (i.e. read-only) may prevent color attachments from becoming decompressed on some devices.
        ///
        /// Note that calling useResources does not retain the resources. It is the responsiblity of the user to retain the resources until
        /// the command buffer has been executed.
        ///
        /// # Safety
        ///
        /// - `resources` must be a valid pointer.
        /// - `count` might not be bounds-checked.
        #[deprecated]
        #[unsafe(method(useResources:count:usage:))]
        #[unsafe(method_family = none)]
        unsafe fn useResources_count_usage(
            &self,
            resources: NonNull<NonNull<ProtocolObject<dyn MTLResource>>>,
            count: NSUInteger,
            usage: MTLResourceUsage,
        );

        #[cfg(all(feature = "MTLAllocation", feature = "MTLResource"))]
        /// Declare that a resource may be accessed by the render pass through an argument buffer
        ///
        /// For hazard tracked resources, this method protects against data hazards. This method must be called before encoding any draw commands which may access the resource through an argument buffer. However, this method may cause color attachments to become decompressed. Therefore, this method should be called until as late as possible within a render command encoder. Declaring a minimal usage (i.e. read-only) may prevent color attachments from becoming decompressed on some devices.
        ///
        /// Note that calling useResource does not retain the resource. It is the responsiblity of the user to retain the resource until
        /// the command buffer has been executed.
        #[unsafe(method(useResource:usage:stages:))]
        #[unsafe(method_family = none)]
        fn useResource_usage_stages(
            &self,
            resource: &ProtocolObject<dyn MTLResource>,
            usage: MTLResourceUsage,
            stages: MTLRenderStages,
        );

        #[cfg(all(feature = "MTLAllocation", feature = "MTLResource"))]
        /// Declare that an array of resources may be accessed through an argument buffer by the render pass
        ///
        /// For hazard tracked resources, this method protects against data hazards.  This method must be called before encoding any draw commands which may access the resources through an argument buffer. However, this method may cause color attachments to become decompressed. Therefore, this method should be called until as late as possible within a render command encoder. Declaring a minimal usage (i.e. read-only) may prevent color attachments from becoming decompressed on some devices.
        ///
        /// Note that calling useResources does not retain the resources. It is the responsiblity of the user to retain the resources until
        /// the command buffer has been executed.
        ///
        /// # Safety
        ///
        /// - `resources` must be a valid pointer.
        /// - `count` might not be bounds-checked.
        #[unsafe(method(useResources:count:usage:stages:))]
        #[unsafe(method_family = none)]
        unsafe fn useResources_count_usage_stages(
            &self,
            resources: NonNull<NonNull<ProtocolObject<dyn MTLResource>>>,
            count: NSUInteger,
            usage: MTLResourceUsage,
            stages: MTLRenderStages,
        );

        #[cfg(all(feature = "MTLAllocation", feature = "MTLHeap"))]
        /// Declare that the resources allocated from a heap may be accessed by the render pass through an argument buffer
        ///
        /// This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources allocated from the heap through an argument buffer. This method may cause all of the color attachments allocated from the heap to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
        #[deprecated]
        #[unsafe(method(useHeap:))]
        #[unsafe(method_family = none)]
        fn useHeap(&self, heap: &ProtocolObject<dyn MTLHeap>);

        #[cfg(all(feature = "MTLAllocation", feature = "MTLHeap"))]
        /// Declare that the resources allocated from an array of heaps may be accessed by the render pass through an argument buffer
        ///
        /// This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources allocated from the heaps through an argument buffer. This method may cause all of the color attachments allocated from the heaps to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
        ///
        /// # Safety
        ///
        /// - `heaps` must be a valid pointer.
        /// - `count` might not be bounds-checked.
        #[deprecated]
        #[unsafe(method(useHeaps:count:))]
        #[unsafe(method_family = none)]
        unsafe fn useHeaps_count(
            &self,
            heaps: NonNull<NonNull<ProtocolObject<dyn MTLHeap>>>,
            count: NSUInteger,
        );

        #[cfg(all(feature = "MTLAllocation", feature = "MTLHeap"))]
        /// Declare that the resources allocated from a heap may be accessed by the render pass through an argument buffer
        ///
        /// If the heap is tracked, this method protects against hazard tracking; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources allocated from the heap through an argument buffer. This method may cause all of the color attachments allocated from the heap to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
        #[unsafe(method(useHeap:stages:))]
        #[unsafe(method_family = none)]
        fn useHeap_stages(&self, heap: &ProtocolObject<dyn MTLHeap>, stages: MTLRenderStages);

        #[cfg(all(feature = "MTLAllocation", feature = "MTLHeap"))]
        /// Declare that the resources allocated from an array of heaps may be accessed by the render pass through an argument buffer
        ///
        /// This method does not protect against data hazards; these hazards must be addressed using an MTLFence. This method must be called before encoding any draw commands which may access the resources allocated from the heaps through an argument buffer. This method may cause all of the color attachments allocated from the heaps to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage.
        ///
        /// # Safety
        ///
        /// - `heaps` must be a valid pointer.
        /// - `count` might not be bounds-checked.
        #[unsafe(method(useHeaps:count:stages:))]
        #[unsafe(method_family = none)]
        unsafe fn useHeaps_count_stages(
            &self,
            heaps: NonNull<NonNull<ProtocolObject<dyn MTLHeap>>>,
            count: NSUInteger,
            stages: MTLRenderStages,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLIndirectCommandBuffer",
            feature = "MTLResource"
        ))]
        /// Execute commands in the buffer within the range specified.
        ///
        /// The same indirect command buffer may be executed any number of times within the same encoder.
        ///
        /// # Safety
        ///
        /// - `indirect_command_buffer` may need to be synchronized.
        /// - `indirect_command_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `executionRange` might not be bounds-checked.
        #[unsafe(method(executeCommandsInBuffer:withRange:))]
        #[unsafe(method_family = none)]
        unsafe fn executeCommandsInBuffer_withRange(
            &self,
            indirect_command_buffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
            execution_range: NSRange,
        );

        #[cfg(all(
            feature = "MTLAllocation",
            feature = "MTLBuffer",
            feature = "MTLIndirectCommandBuffer",
            feature = "MTLResource"
        ))]
        /// Execute commands in the buffer within the range specified by the indirect range buffer.
        ///
        /// Parameter `indirectRangeBuffer`: An indirect buffer from which the device reads the execution range parameter, as laid out in the MTLIndirectCommandBufferExecutionRange structure.
        ///
        /// Parameter `indirectBufferOffset`: The byte offset within indirectBuffer where the execution range parameter is located. Must be a multiple of 4 bytes.
        ///
        /// The same indirect command buffer may be executed any number of times within the same encoder.
        ///
        /// # Safety
        ///
        /// - `indirect_commandbuffer` may need to be synchronized.
        /// - `indirect_commandbuffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `indirect_range_buffer` may need to be synchronized.
        /// - `indirect_range_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `indirect_range_buffer` contents should be of the correct type.
        /// - `indirectBufferOffset` might not be bounds-checked.
        #[unsafe(method(executeCommandsInBuffer:indirectBuffer:indirectBufferOffset:))]
        #[unsafe(method_family = none)]
        unsafe fn executeCommandsInBuffer_indirectBuffer_indirectBufferOffset(
            &self,
            indirect_commandbuffer: &ProtocolObject<dyn MTLIndirectCommandBuffer>,
            indirect_range_buffer: &ProtocolObject<dyn MTLBuffer>,
            indirect_buffer_offset: NSUInteger,
        );

        /// Make stores to memory encoded before the barrier coherent with loads from memory encoded after the barrier.
        ///
        /// The barrier makes stores coherent that 1) are to a resource with a type in the given scope, and 2) happen at (or before) the stage given by afterStages. Only affects loads that happen at (or after) the stage given by beforeStages.
        #[unsafe(method(memoryBarrierWithScope:afterStages:beforeStages:))]
        #[unsafe(method_family = none)]
        fn memoryBarrierWithScope_afterStages_beforeStages(
            &self,
            scope: MTLBarrierScope,
            after: MTLRenderStages,
            before: MTLRenderStages,
        );

        #[cfg(all(feature = "MTLAllocation", feature = "MTLResource"))]
        /// Make stores to memory encoded before the barrier coherent with loads from memory encoded after the barrier.
        ///
        /// The barrier makes stores coherent that 1) are to resources in given array, and 2) happen at (or before) the stage given by afterStages. Only affects loads that happen at (or after) the stage give by beforeStages.
        ///
        /// # Safety
        ///
        /// - `resources` must be a valid pointer.
        /// - `count` might not be bounds-checked.
        #[unsafe(method(memoryBarrierWithResources:count:afterStages:beforeStages:))]
        #[unsafe(method_family = none)]
        unsafe fn memoryBarrierWithResources_count_afterStages_beforeStages(
            &self,
            resources: NonNull<NonNull<ProtocolObject<dyn MTLResource>>>,
            count: NSUInteger,
            after: MTLRenderStages,
            before: MTLRenderStages,
        );

        #[cfg(feature = "MTLCounters")]
        /// Sample hardware counters at this point in the render encoder and
        /// store the counter sample into the sample buffer at the specified index.
        ///
        /// Parameter `sampleBuffer`: The sample buffer to sample into
        ///
        /// Parameter `sampleIndex`: The index into the counter buffer to write the sample.
        ///
        /// Parameter `barrier`: Insert a barrier before taking the sample.  Passing
        /// YES will ensure that all work encoded before this operation in the encoder is
        /// complete but does not isolate the work with respect to other encoders.  Passing
        /// NO will allow the sample to be taken concurrently with other operations in this
        /// encoder.
        /// In general, passing YES will lead to more repeatable counter results but
        /// may negatively impact performance.  Passing NO will generally be higher performance
        /// but counter results may not be repeatable.
        ///
        /// # Safety
        ///
        /// `sampleIndex` might not be bounds-checked.
        #[unsafe(method(sampleCountersInBuffer:atSampleIndex:withBarrier:))]
        #[unsafe(method_family = none)]
        unsafe fn sampleCountersInBuffer_atSampleIndex_withBarrier(
            &self,
            sample_buffer: &ProtocolObject<dyn MTLCounterSampleBuffer>,
            sample_index: NSUInteger,
            barrier: bool,
        );

        #[cfg(feature = "MTLRenderPipeline")]
        /// Sets the mapping from logical shader color output to physical render pass color attachments.
        ///
        /// Use this method to define how the physical color attachments you specify via ``MTLRenderPassDescriptor/colorAttachments``
        /// map to the logical color output the fragment shader writes to.
        ///
        /// To use this feature, make sure to set ``MTLRenderPassDescriptor/supportColorAttachmentMapping`` to
        /// <doc
        /// ://com.apple.documentation/documentation/swift/true>.
        ///
        /// - Parameter mapping: Mapping from logical shader outputs to physical outputs.
        #[unsafe(method(setColorAttachmentMap:))]
        #[unsafe(method_family = none)]
        fn setColorAttachmentMap(&self, mapping: Option<&MTLLogicalToPhysicalColorAttachmentMap>);
    }
);