metal-rust 1.0.0

Safe Rust interfaces for Apple Metal
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
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
#!/usr/bin/env python3
"""Generate the explicit metal-cpp to safe-Rust coverage ledger."""

from __future__ import annotations

import argparse
import json
import sys
from collections import Counter
from pathlib import Path
from typing import Any

from generate_value_types import EXTENSIBLE_MANUAL_TYPES, MANUAL_TYPES
from generate_struct_types import MANUAL_STRUCTS, snake_case
from generate_facade_types import (
    available_object_names,
    generated_facade_alias_paths,
    generated_facade_method_paths,
    module_for,
)


ACTUAL_CLASSES = {
    "NS::Bundle": "foundation::Bundle",
    "NS::Notification": "foundation::Notification",
    "NS::NotificationCenter": "foundation::NotificationCenter",
    "NS::ProcessInfo": "foundation::ProcessInfo",
    "NS::URL": "foundation::URL",
    "MTL4::CounterHeap": "metal4::TimestampCounterHeap",
    "MTL::CaptureManager": "metal::CaptureSession",
    "MTL::Device": "metal::Device",
    "MTL::Function": "metal::Function",
    "MTL::Library": "metal::Library",
    "MTL::CommandQueue": "metal::CommandQueue",
    "MTL::CommandBuffer": "metal::CommandBuffer",
    "MTL::Buffer": "metal::Buffer",
    "MTL::Texture": "metal::Texture",
    "MTL::TextureDescriptor": "metal::TextureDescriptor",
    "MTL::CompileOptions": "metal::CompileOptions",
    "MTL::RenderCommandEncoder": "metal::RenderCommandEncoder",
    "MTL::ComputeCommandEncoder": "metal::ComputeCommandEncoder",
    "MTL::BlitCommandEncoder": "metal::BlitCommandEncoder",
    "MTL::ComputePassDescriptor": "metal::ComputePassDescriptor",
    "MTL4::CommandBuffer": "metal4::AvailableCommandBuffer",
    "MTL4::CommandEncoder": "metal4::RecordingComputeEncoder",
    "MTL4::ComputeCommandEncoder": "metal4::RecordingComputeEncoder",
    "MTL4::MachineLearningCommandEncoder": "metal4::RecordingMachineLearningEncoder",
    "MTL4::RenderCommandEncoder": "metal4::RecordingRenderEncoder",
    "MTL::RenderPipelineState": "metal::RenderPipelineState",
    "MTL::RenderPipelineDescriptor": "metal::RenderPipelineDescriptor",
    "MTL::RenderPassDescriptor": "metal::RenderPassDescriptor",
    "MTL::ComputePipelineState": "metal::ComputePipelineState",
    "MTLFX::SpatialScalerDescriptor": "metal_fx::SpatialScalerDescriptor",
    "MTLFX::SpatialScaler": "metal_fx::SpatialScaler",
    "MTLFX::TemporalScalerDescriptor": "metal_fx::TemporalScalerDescriptor",
    "MTLFX::TemporalScaler": "metal_fx::TemporalScaler",
    "CA::MetalLayer": "quartz_core::Layer",
    "CA::MetalDrawable": "quartz_core::Drawable",
}

FOUNDATION_SUBSTITUTE_CLASSES = {
    "NS::Array": "foundation::Array",
    "NS::AutoreleasePool": "foundation::Object",
    "NS::Condition": "foundation::Condition",
    "NS::Copying": "foundation::Copying",
    "NS::Data": "foundation::Data",
    "NS::Date": "foundation::Date",
    "NS::Dictionary": "foundation::Dictionary",
    "NS::Enumerator": "foundation::Enumerator",
    "NS::Error": "foundation::Error",
    "NS::FastEnumeration": "foundation::Enumerator",
    "NS::Locking": "foundation::Locking",
    "NS::Number": "foundation::Number",
    "NS::Object": "foundation::Object",
    "NS::Referencing": "foundation::Object",
    "NS::SecureCoding": "foundation::SecureCoding",
    "NS::Set": "foundation::Set",
    "NS::String": "foundation::String",
    "NS::Value": "foundation::Value",
    "SharedPtr": "foundation::Object",
}

TYPESTATE_SUBSTITUTE_CLASSES = {
    "MTL4::CommandBuffer",
    "MTL4::CommandEncoder",
    "MTL4::ComputeCommandEncoder",
    "MTL4::MachineLearningCommandEncoder",
    "MTL4::RenderCommandEncoder",
}

FOUNDATION_SUBSTITUTE_METHODS = {
    ("NS::Bundle", "alloc"): "foundation::Bundle::main",
    ("NS::Bundle", "init"): "foundation::Bundle::main",
    ("NS::Bundle", "unload"): "foundation::Bundle",
    ("NS::NotificationCenter", "removeObserver"): "foundation::Registration",
    ("NS::Notification", "object"): "foundation::Notification::object_description",
    ("NS::Notification", "userInfo"): "foundation::Notification::user_info_description",
    ("NS::Array", "array"): "foundation::Array::from",
    ("NS::Array", "alloc"): "foundation::Array::new",
    ("NS::Array", "init"): "foundation::Array::from",
    ("NS::Array", "count"): "foundation::Array::len",
    ("NS::Array", "objectEnumerator"): "foundation::enumerate",
    ("NS::AutoreleasePool", "alloc"): "foundation::Object",
    ("NS::AutoreleasePool", "init"): "foundation::Object",
    ("NS::AutoreleasePool", "drain"): "foundation::Object",
    ("NS::AutoreleasePool", "addObject"): "foundation::Object",
    ("NS::AutoreleasePool", "showPools"): "foundation::Object",
    ("NS::Data", "bytes"): "foundation::Data::as_slice",
    ("NS::Data", "length"): "foundation::Data::len",
    ("NS::Date", "dateWithTimeIntervalSinceNow"): "foundation::date_with_time_interval_since_now",
    ("NS::Dictionary", "dictionary"): "foundation::Dictionary::from_iter",
    ("NS::Dictionary", "alloc"): "foundation::Dictionary::new",
    ("NS::Dictionary", "init"): "foundation::Dictionary::from_iter",
    ("NS::Dictionary", "count"): "foundation::Dictionary::len",
    ("NS::Set", "alloc"): "foundation::Set::new",
    ("NS::Set", "init"): "foundation::Set::from_iter",
    ("NS::Set", "count"): "foundation::Set::len",
    ("NS::Set", "objectEnumerator"): "foundation::enumerate",
    ("NS::String", "string"): "foundation::String::from",
    ("NS::String", "alloc"): "foundation::String::new",
    ("NS::String", "init"): "foundation::String::from",
    ("NS::String", "character"): "foundation::StringExt::character",
    ("NS::String", "length"): "foundation::String::len",
    ("NS::String", "cString"): "foundation::String::as_bytes",
    ("NS::String", "utf8String"): "foundation::String::as_bytes",
    ("NS::String", "maximumLengthOfBytes"): "foundation::String::len",
    ("NS::String", "lengthOfBytes"): "foundation::String::len",
    ("NS::String", "isEqualToString"): "foundation::is_equal",
    ("NS::String", "rangeOfString"): "foundation::StringExt::range_of",
    ("NS::String", "fileSystemRepresentation"): "foundation::String::as_bytes",
    ("NS::String", "stringByAppendingString"): "foundation::append_string",
    ("NS::String", "caseInsensitiveCompare"): "foundation::StringExt::compare_case_insensitive",
    ("NS::Copying", "copy"): "foundation::Copying::copy_owned",
    ("NS::Error", "alloc"): "foundation::Error",
    ("NS::Error", "init"): "foundation::Error",
    ("NS::Error", "code"): "foundation::Error::code",
    ("NS::Error", "domain"): "foundation::Error::domain",
    ("NS::FastEnumeration", "countByEnumerating"): "foundation::enumerate",
    ("NS::Enumerator", "nextObject"): "foundation::Enumerator::next",
    ("NS::Locking", "lock"): "foundation::Locking::with_lock",
    ("NS::Locking", "unlock"): "foundation::Locking::with_lock",
    ("NS::Referencing", "retain"): "foundation::Object",
    ("NS::Referencing", "release"): "foundation::Object",
    ("NS::Referencing", "autorelease"): "foundation::Object",
    ("NS::Referencing", "retainCount"): "foundation::Object",
    ("NS::Object", "hash"): "foundation::Object::object_hash",
    ("NS::Object", "isEqual"): "foundation::Object::object_is_equal",
    ("NS::Condition", "alloc"): "foundation::Condition::new",
    ("NS::Condition", "init"): "foundation::Condition::new",
    ("NS::Condition", "wait"): "foundation::Condition::wait",
    ("NS::Condition", "waitUntilDate"): "foundation::Condition::wait_until",
    ("NS::Condition", "signal"): "foundation::Condition::signal",
    ("NS::Condition", "broadcast"): "foundation::Condition::broadcast",
    ("NS::Value", "value"): "foundation::Value::new",
    ("NS::Value", "alloc"): "foundation::Value::new",
    ("NS::Value", "init"): "foundation::Value::new",
    ("NS::Value", "getValue"): "foundation::Value::downcast_ref",
    ("NS::Value", "objCType"): "foundation::Value::downcast_ref",
    ("NS::Value", "isEqualToValue"): "foundation::Value::downcast_ref",
    ("NS::Value", "pointerValue"): "foundation::Value::downcast_ref",
    ("NS::URL", "alloc"): "foundation::URL::from_file_path",
    ("NS::URL", "init"): "foundation::URL::from_file_path",
    ("NS::Number", "number"): "foundation::Number::from",
    ("NS::Number", "alloc"): "foundation::Number::from",
    ("NS::Number", "init"): "foundation::Number::from",
    ("NS::Number", "charValue"): "foundation::Number::as_i64",
    ("NS::Number", "unsignedCharValue"): "foundation::Number::as_u64",
    ("NS::Number", "shortValue"): "foundation::Number::as_i64",
    ("NS::Number", "unsignedShortValue"): "foundation::Number::as_u64",
    ("NS::Number", "intValue"): "foundation::Number::as_i64",
    ("NS::Number", "unsignedIntValue"): "foundation::Number::as_u64",
    ("NS::Number", "longValue"): "foundation::Number::as_i64",
    ("NS::Number", "unsignedLongValue"): "foundation::Number::as_u64",
    ("NS::Number", "longLongValue"): "foundation::Number::as_i64",
    ("NS::Number", "unsignedLongLongValue"): "foundation::Number::as_u64",
    ("NS::Number", "floatValue"): "foundation::Number::as_f64",
    ("NS::Number", "doubleValue"): "foundation::Number::as_f64",
    ("NS::Number", "boolValue"): "foundation::Number::as_bool",
    ("NS::Number", "integerValue"): "foundation::Number::as_i64",
    ("NS::Number", "unsignedIntegerValue"): "foundation::Number::as_u64",
    ("NS::Number", "compare"): "foundation::Number::compare",
    ("NS::Number", "isEqualToNumber"): "foundation::is_equal",
    ("SharedPtr", "SharedPtr"): "foundation::Object",
    ("SharedPtr", "~SharedPtr"): "foundation::Object",
    ("SharedPtr", "operator="): "foundation::Object",
    ("SharedPtr", "get"): "foundation::Object",
    ("SharedPtr", "operator->"): "foundation::Object",
    ("SharedPtr", "operatorbool"): "foundation::Object",
    ("SharedPtr", "reset"): "foundation::Object",
    ("SharedPtr", "detach"): "foundation::Object",
    ("NS::Range", "Make"): "foundation::Range::new",
    ("NS::Range", "Range"): "foundation::Range::new",
    ("NS::Range", "Equal"): "foundation::is_equal",
    ("NS::Range", "LocationInRange"): "foundation::Range::contains",
    ("NS::Range", "Max"): "foundation::Range::end",
}

ACTUAL_VALUES = {
    "MTL::ClearColor": "metal::ClearColor",
    "MTL::CommandBufferStatus": "metal::CommandBufferStatus",
    "MTL::Origin": "metal::Origin",
    "MTL::PixelFormat": "metal::PixelFormat",
    "MTL::PrimitiveType": "metal::PrimitiveType",
    "MTL::Region": "metal::Region",
    "MTL::ResourceOptions": "metal::ResourceOptions",
    "MTL::Size": "metal::Size",
    "MTL::StorageMode": "metal::StorageMode",
    "MTL::TextureType": "metal::TextureType",
    "MTL::TextureUsage": "metal::TextureUsage",
    "MTL::Viewport": "metal::Viewport",
    "MTLFX::SpatialScalerColorProcessingMode": "metal_fx::SpatialScalerColorProcessingMode",
}

MANUAL_ENUM_MEMBERS = {
    ("MTL::CommandBufferStatus", "CommandBufferStatusNotEnqueued"): "metal::CommandBufferStatus::NotEnqueued",
    ("MTL::CommandBufferStatus", "CommandBufferStatusEnqueued"): "metal::CommandBufferStatus::Enqueued",
    ("MTL::CommandBufferStatus", "CommandBufferStatusCommitted"): "metal::CommandBufferStatus::Committed",
    ("MTL::CommandBufferStatus", "CommandBufferStatusScheduled"): "metal::CommandBufferStatus::Scheduled",
    ("MTL::CommandBufferStatus", "CommandBufferStatusCompleted"): "metal::CommandBufferStatus::Completed",
    ("MTL::CommandBufferStatus", "CommandBufferStatusError"): "metal::CommandBufferStatus::Error",
    ("MTL::PrimitiveType", "PrimitiveTypePoint"): "metal::PrimitiveType::Point",
    ("MTL::PrimitiveType", "PrimitiveTypeLine"): "metal::PrimitiveType::Line",
    ("MTL::PrimitiveType", "PrimitiveTypeLineStrip"): "metal::PrimitiveType::LineStrip",
    ("MTL::PrimitiveType", "PrimitiveTypeTriangle"): "metal::PrimitiveType::Triangle",
    ("MTL::PrimitiveType", "PrimitiveTypeTriangleStrip"): "metal::PrimitiveType::TriangleStrip",
    ("MTL::StorageMode", "StorageModeShared"): "metal::StorageMode::Shared",
    ("MTL::StorageMode", "StorageModeManaged"): "metal::StorageMode::Managed",
    ("MTL::StorageMode", "StorageModePrivate"): "metal::StorageMode::Private",
    ("MTL::StorageMode", "StorageModeMemoryless"): "metal::StorageMode::Memoryless",
    ("MTL::TextureType", "TextureType2D"): "metal::TextureType::D2",
    ("MTL::TextureType", "TextureType2DArray"): "metal::TextureType::D2Array",
    ("MTL::TextureType", "TextureType1D"): "metal::TextureType::D1",
    ("MTL::TextureType", "TextureType1DArray"): "metal::TextureType::D1Array",
    ("MTL::TextureType", "TextureType2DMultisample"): "metal::TextureType::D2Multisample",
    ("MTL::TextureType", "TextureType2DMultisampleArray"): "metal::TextureType::D2MultisampleArray",
    ("MTL::TextureType", "TextureType3D"): "metal::TextureType::D3",
    ("MTL::TextureType", "TextureTypeCube"): "metal::TextureType::Cube",
    ("MTL::TextureType", "TextureTypeCubeArray"): "metal::TextureType::CubeArray",
    ("MTL::TextureType", "TextureTypeTextureBuffer"): "metal::TextureType::TextureBuffer",
    ("MTLFX::SpatialScalerColorProcessingMode", "SpatialScalerColorProcessingModePerceptual"): "metal_fx::SpatialScalerColorProcessingMode::PERCEPTUAL",
    ("MTLFX::SpatialScalerColorProcessingMode", "SpatialScalerColorProcessingModeLinear"): "metal_fx::SpatialScalerColorProcessingMode::LINEAR",
    ("MTLFX::SpatialScalerColorProcessingMode", "SpatialScalerColorProcessingModeHDR"): "metal_fx::SpatialScalerColorProcessingMode::HDR",
}

ACTUAL_METHODS = {
    ("NS::Bundle", "mainBundle"): "foundation::Bundle::main",
    ("NS::Bundle", "load"): "foundation::Bundle::load",
    ("NS::Bundle", "isLoaded"): "foundation::Bundle::is_loaded",
    ("NS::Notification", "name"): "foundation::Notification::name",
    ("NS::NotificationCenter", "addObserver"): "foundation::NotificationCenter::add_observer",
    ("NS::ProcessInfo", "processInfo"): "foundation::ProcessInfo::current",
    ("NS::ProcessInfo", "setProcessName"): "foundation::ProcessInfo::set_process_name",
    ("NS::ProcessInfo", "processIdentifier"): "foundation::ProcessInfo::process_identifier",
    ("NS::ProcessInfo", "operatingSystem"): "foundation::ProcessInfo::operating_system_version",
    ("NS::ProcessInfo", "operatingSystemVersion"): "foundation::ProcessInfo::operating_system_version",
    ("NS::ProcessInfo", "isOperatingSystemAtLeastVersion"): "foundation::ProcessInfo::is_operating_system_at_least",
    ("NS::ProcessInfo", "processorCount"): "foundation::ProcessInfo::processor_count",
    ("NS::ProcessInfo", "activeProcessorCount"): "foundation::ProcessInfo::active_processor_count",
    ("NS::ProcessInfo", "physicalMemory"): "foundation::ProcessInfo::physical_memory",
    ("NS::ProcessInfo", "systemUptime"): "foundation::ProcessInfo::system_uptime",
    ("NS::ProcessInfo", "disableSuddenTermination"): "foundation::ProcessInfo::disable_sudden_termination",
    ("NS::ProcessInfo", "enableSuddenTermination"): "foundation::ProcessInfo::enable_sudden_termination",
    ("NS::ProcessInfo", "automaticTerminationSupportEnabled"): "foundation::ProcessInfo::automatic_termination_support_enabled",
    ("NS::ProcessInfo", "setAutomaticTerminationSupportEnabled"): "foundation::ProcessInfo::set_automatic_termination_support_enabled",
    ("NS::ProcessInfo", "thermalState"): "foundation::ProcessInfo::thermal_state",
    ("NS::ProcessInfo", "isLowPowerModeEnabled"): "foundation::ProcessInfo::is_low_power_mode_enabled",
    ("NS::ProcessInfo", "isiOSAppOnMac"): "foundation::ProcessInfo::is_ios_app_on_mac",
    ("NS::ProcessInfo", "isMacCatalystApp"): "foundation::ProcessInfo::is_mac_catalyst_app",
    ("NS::ProcessInfo", "isDeviceCertified"): "foundation::ProcessInfo::is_device_certified",
    ("NS::ProcessInfo", "hasPerformanceProfile"): "foundation::ProcessInfo::has_performance_profile",
    ("NS::URL", "alloc"): "foundation::URL::from_file_path",
    ("NS::URL", "init"): "foundation::URL::from_file_path",
    ("NS::URL", "fileSystemRepresentation"): "foundation::URL::file_path",
    ("MTL4::CounterHeap", "count"): "metal::TimestampCounterHeap::count",
    ("MTL::CaptureManager", "sharedCaptureManager"): "metal::CaptureSession::start",
    ("MTL::Device", "name"): "metal::Device::name",
    ("MTL::CommandQueue", "label"): "metal::CommandQueue::label",
    ("MTL::CommandQueue", "setLabel"): "metal::CommandQueue::set_label",
    ("MTL::CommandBuffer", "commit"): "metal::CommandBuffer::commit",
    ("MTL::CommandBuffer", "waitUntilCompleted"): "metal::SubmittedCommandBuffer::wait",
    ("MTL::CommandBuffer", "presentDrawable"): "metal::CommandBuffer::present_drawable",
    ("MTL::CommandBuffer", "status"): "metal::CommandBuffer::status",
    ("MTL::CommandBuffer", "error"): "metal::CommandBuffer::error",
    ("MTL::CommandBuffer", "renderCommandEncoderWithDescriptor"): "metal::CommandBuffer::render_encoder",
    ("MTL::CommandBuffer", "computeCommandEncoderWithDescriptor"): "metal::CommandBuffer::compute_encoder",
    ("MTL::Buffer", "length"): "metal::Buffer::length",
    ("MTL::Buffer", "contents"): "metal::Buffer::write",
    ("MTL::Buffer", "didModifyRange"): "metal::Buffer::write",
    ("MTL::Texture", "width"): "metal::Texture::width",
    ("MTL::Texture", "height"): "metal::Texture::height",
    ("MTL::Texture", "storageMode"): "metal::Texture::storage_mode",
    ("MTL::Device", "supportsTextureSampleCount"): "metal::Device::supports_texture_sample_count",
    ("MTL::Function", "name"): "metal::Function::name",
    ("MTL::ComputePipelineState", "threadExecutionWidth"): "metal::ComputePipelineState::execution_width",
    ("MTL::ComputePipelineState", "maxTotalThreadsPerThreadgroup"): "metal::ComputePipelineState::max_total_threads_per_threadgroup",
    ("MTL::ComputeCommandEncoder", "dispatchType"): "metal::ComputeCommandEncoder::dispatch_type",
    ("MTL::ComputeCommandEncoder", "setTexture"): "metal::ComputeCommandEncoder::set_texture",
    ("MTL::ComputeCommandEncoder", "setTextures"): "metal::ComputeCommandEncoder::set_textures",
    ("MTL::ComputeCommandEncoder", "setImageblockWidth"): "metal::ComputeCommandEncoder::set_imageblock_size",
    ("MTL::ComputeCommandEncoder", "setThreadgroupMemoryLength"): "metal::ComputeCommandEncoder::set_threadgroup_memory_length",
    ("MTL::RenderPipelineState", "maxTotalThreadsPerThreadgroup"): "metal::RenderPipelineState::max_total_threads_per_threadgroup",
    ("MTLFX::SpatialScalerDescriptor", "newSpatialScaler"): "metal_fx::SpatialScalerDescriptor::new_scaler",
    ("MTLFX::SpatialScalerDescriptor", "supportsDevice"): "metal_fx::SpatialScalerDescriptor::supports_device",
    ("MTLFX::SpatialScaler", "encodeToCommandBuffer"): "metal_fx::SpatialScaler::encode",
    ("MTLFX::SpatialScalerBase", "colorTextureUsage"): "metal_fx::SpatialScaler::color_texture_usage",
    ("MTLFX::SpatialScalerBase", "outputTextureUsage"): "metal_fx::SpatialScaler::output_texture_usage",
    ("MTLFX::SpatialScalerBase", "setInputContentWidth"): "metal_fx::SpatialScaler::set_input_content_size",
    ("MTLFX::SpatialScalerBase", "setInputContentHeight"): "metal_fx::SpatialScaler::set_input_content_size",
    ("MTLFX::SpatialScalerBase", "setColorTexture"): "metal_fx::SpatialScaler::set_textures",
    ("MTLFX::SpatialScalerBase", "setOutputTexture"): "metal_fx::SpatialScaler::set_textures",
    ("MTLFX::TemporalScalerDescriptor", "newTemporalScaler"): "metal_fx::TemporalScalerDescriptor::new_scaler",
    ("MTLFX::TemporalScalerDescriptor", "supportsDevice"): "metal_fx::TemporalScalerDescriptor::supports_device",
    ("MTLFX::TemporalScalerDescriptor", "supportedInputContentMinScale"): "metal_fx::TemporalScalerDescriptor::supported_input_content_min_scale",
    ("MTLFX::TemporalScalerDescriptor", "supportedInputContentMaxScale"): "metal_fx::TemporalScalerDescriptor::supported_input_content_max_scale",
    ("MTLFX::TemporalScaler", "encodeToCommandBuffer"): "metal_fx::TemporalScaler::encode",
    ("MTLFX::TemporalScalerBase", "colorTextureUsage"): "metal_fx::TemporalScaler::color_texture_usage",
    ("MTLFX::TemporalScalerBase", "depthTextureUsage"): "metal_fx::TemporalScaler::depth_texture_usage",
    ("MTLFX::TemporalScalerBase", "motionTextureUsage"): "metal_fx::TemporalScaler::motion_texture_usage",
    ("MTLFX::TemporalScalerBase", "outputTextureUsage"): "metal_fx::TemporalScaler::output_texture_usage",
    ("MTLFX::TemporalScalerBase", "setInputContentWidth"): "metal_fx::TemporalScaler::set_input_content_size",
    ("MTLFX::TemporalScalerBase", "setInputContentHeight"): "metal_fx::TemporalScaler::set_input_content_size",
    ("MTLFX::TemporalScalerBase", "setColorTexture"): "metal_fx::TemporalScaler::set_textures",
    ("MTLFX::TemporalScalerBase", "setDepthTexture"): "metal_fx::TemporalScaler::set_textures",
    ("MTLFX::TemporalScalerBase", "setMotionTexture"): "metal_fx::TemporalScaler::set_textures",
    ("MTLFX::TemporalScalerBase", "setOutputTexture"): "metal_fx::TemporalScaler::set_textures",
    ("CA::MetalLayer", "layer"): "quartz_core::Layer::new",
    ("CA::MetalLayer", "device"): "quartz_core::Layer::device",
    ("CA::MetalLayer", "setDevice"): "quartz_core::Layer::set_device",
    ("CA::MetalLayer", "pixelFormat"): "quartz_core::Layer::pixel_format",
    ("CA::MetalLayer", "setPixelFormat"): "quartz_core::Layer::set_pixel_format",
    ("CA::MetalLayer", "framebufferOnly"): "quartz_core::Layer::framebuffer_only",
    ("CA::MetalLayer", "setFramebufferOnly"): "quartz_core::Layer::set_framebuffer_only",
    ("CA::MetalLayer", "drawableSize"): "quartz_core::Layer::drawable_size",
    ("CA::MetalLayer", "setDrawableSize"): "quartz_core::Layer::set_drawable_size",
    ("CA::MetalLayer", "maximumDrawableCount"): "quartz_core::Layer::maximum_drawable_count",
    ("CA::MetalLayer", "setMaximumDrawableCount"): "quartz_core::Layer::set_maximum_drawable_count",
    ("CA::MetalLayer", "displaySyncEnabled"): "quartz_core::Layer::display_sync_enabled",
    ("CA::MetalLayer", "setDisplaySyncEnabled"): "quartz_core::Layer::set_display_sync_enabled",
    ("CA::MetalLayer", "colorspace"): "quartz_core::Layer::color_space",
    ("CA::MetalLayer", "setColorspace"): "quartz_core::Layer::set_color_space",
    ("CA::MetalLayer", "allowsNextDrawableTimeout"): "quartz_core::Layer::allows_next_drawable_timeout",
    ("CA::MetalLayer", "setAllowsNextDrawableTimeout"): "quartz_core::Layer::set_allows_next_drawable_timeout",
    ("CA::MetalLayer", "wantsExtendedDynamicRangeContent"): "quartz_core::Layer::wants_extended_dynamic_range_content",
    ("CA::MetalLayer", "setWantsExtendedDynamicRangeContent"): "quartz_core::Layer::set_wants_extended_dynamic_range_content",
    ("CA::MetalLayer", "residencySet"): "quartz_core::Layer::residency_set",
    ("CA::MetalLayer", "nextDrawable"): "quartz_core::Layer::next_drawable",
    ("CA::MetalDrawable", "texture"): "quartz_core::Drawable::texture",
    ("MTL::CommandBuffer", "addCompletedHandler"): "metal::CommandBuffer::on_complete",
    ("MTL::CommandBuffer", "addScheduledHandler"): "metal::CommandBuffer::on_scheduled",
    ("MTL::CommandBuffer", "device"): "metal::CommandBuffer::device",
    ("MTL::CommandBuffer", "commandQueue"): "metal::CommandBuffer::command_queue",
    ("MTL::CommandBuffer", "label"): "metal::CommandBuffer::label",
    ("MTL::CommandBuffer", "setLabel"): "metal::CommandBuffer::set_label",
    ("MTL::CommandBuffer", "retainedReferences"): "metal::CommandBuffer::retained_references",
    ("MTL::CommandBuffer", "pushDebugGroup"): "metal::CommandBuffer::push_debug_group",
    ("MTL::CommandBuffer", "popDebugGroup"): "metal::CommandBuffer::pop_debug_group",
    ("MTL::CommandBuffer", "presentDrawableAtTime"): "metal::CommandBuffer::present_drawable_at_time",
    ("MTL::CommandBuffer", "presentDrawableAfterMinimumDuration"): "metal::CommandBuffer::present_drawable_after_minimum_duration",
    ("MTL::CommandBuffer", "GPUStartTime"): "metal::CommandBuffer::gpu_start_time",
    ("MTL::CommandBuffer", "GPUEndTime"): "metal::CommandBuffer::gpu_end_time",
    ("MTL::CommandBuffer", "kernelStartTime"): "metal::CommandBuffer::kernel_start_time",
    ("MTL::CommandBuffer", "kernelEndTime"): "metal::CommandBuffer::kernel_end_time",
    ("MTL::Texture", "getBytes"): "metal::BlitCommandEncoder::read_texture",
    ("MTL::TextureDescriptor", "alloc"): "metal::TextureDescriptor::new",
    ("MTL::TextureDescriptor", "init"): "metal::TextureDescriptor::new",
    ("MTL::TextureDescriptor", "width"): "metal::TextureDescriptor::dimensions",
    ("MTL::TextureDescriptor", "height"): "metal::TextureDescriptor::dimensions",
    ("MTL::TextureDescriptor", "depth"): "metal::TextureDescriptor::dimensions",
    ("MTL::TextureDescriptor", "setWidth"): "metal::TextureDescriptor::set_dimensions",
    ("MTL::TextureDescriptor", "setHeight"): "metal::TextureDescriptor::set_dimensions",
    ("MTL::TextureDescriptor", "setDepth"): "metal::TextureDescriptor::set_dimensions",
    ("MTL::TextureDescriptor", "arrayLength"): "metal::TextureDescriptor::array_length",
    ("MTL::TextureDescriptor", "setArrayLength"): "metal::TextureDescriptor::set_array_length",
    ("MTL::TextureDescriptor", "sampleCount"): "metal::TextureDescriptor::sample_count",
    ("MTL::TextureDescriptor", "setSampleCount"): "metal::TextureDescriptor::set_sample_count",
    ("MTL::TextureDescriptor", "mipmapLevelCount"): "metal::TextureDescriptor::mipmap_level_count",
    ("MTL::TextureDescriptor", "setMipmapLevelCount"): "metal::TextureDescriptor::set_mipmap_level_count",
    ("MTL::TextureDescriptor", "pixelFormat"): "metal::TextureDescriptor::pixel_format",
    ("MTL::TextureDescriptor", "setPixelFormat"): "metal::TextureDescriptor::set_pixel_format",
    ("MTL::TextureDescriptor", "textureType"): "metal::TextureDescriptor::texture_type",
    ("MTL::TextureDescriptor", "setTextureType"): "metal::TextureDescriptor::set_texture_type",
    ("MTL::TextureDescriptor", "resourceOptions"): "metal::TextureDescriptor::resource_options",
    ("MTL::TextureDescriptor", "setResourceOptions"): "metal::TextureDescriptor::set_resource_options",
    ("MTL::TextureDescriptor", "usage"): "metal::TextureDescriptor::usage",
    ("MTL::TextureDescriptor", "setUsage"): "metal::TextureDescriptor::set_usage",
    ("MTL::TextureDescriptor", "storageMode"): "metal::TextureDescriptor::storage_mode",
    ("MTL::TextureDescriptor", "setStorageMode"): "metal::TextureDescriptor::set_storage_mode",
    ("MTL::TextureDescriptor", "cpuCacheMode"): "metal::TextureDescriptor::cpu_cache_mode",
    ("MTL::TextureDescriptor", "setCpuCacheMode"): "metal::TextureDescriptor::set_cpu_cache_mode",
    ("MTL::TextureDescriptor", "hazardTrackingMode"): "metal::TextureDescriptor::hazard_tracking_mode",
    ("MTL::TextureDescriptor", "setHazardTrackingMode"): "metal::TextureDescriptor::set_hazard_tracking_mode",
    ("MTL::TextureDescriptor", "compressionType"): "metal::TextureDescriptor::compression_type",
    ("MTL::TextureDescriptor", "setCompressionType"): "metal::TextureDescriptor::set_compression_type",
    ("MTL::TextureDescriptor", "placementSparsePageSize"): "metal::TextureDescriptor::placement_sparse_page_size",
    ("MTL::TextureDescriptor", "setPlacementSparsePageSize"): "metal::TextureDescriptor::set_placement_sparse_page_size",
    ("MTL::TextureDescriptor", "allowGPUOptimizedContents"): "metal::TextureDescriptor::allows_gpu_optimized_contents",
    ("MTL::TextureDescriptor", "setAllowGPUOptimizedContents"): "metal::TextureDescriptor::set_allows_gpu_optimized_contents",
    ("MTL::Texture", "depth"): "metal::Texture::layout",
    ("MTL::Texture", "arrayLength"): "metal::Texture::layout",
    ("MTL::Texture", "mipmapLevelCount"): "metal::Texture::layout",
    ("MTL::Texture", "sampleCount"): "metal::Texture::layout",
    ("MTL::Texture", "textureType"): "metal::Texture::texture_type",
    ("MTL::Texture", "usage"): "metal::Texture::usage",
    ("MTL::Texture", "isFramebufferOnly"): "metal::Texture::is_framebuffer_only",
    ("MTL::Texture", "isShareable"): "metal::Texture::is_shareable",
    ("MTL::Texture", "isSparse"): "metal::Texture::is_sparse",
    ("MTL::Texture", "allowGPUOptimizedContents"): "metal::Texture::allows_gpu_optimized_contents",
    ("MTL::Texture", "compressionType"): "metal::Texture::compression_type",
    ("MTL::Texture", "sparseTextureTier"): "metal::Texture::sparse_texture_tier",
    ("MTL::Texture", "parentTexture"): "metal::Texture::parent_texture",
    ("MTL::Texture", "parentRelativeLevel"): "metal::Texture::parent_relative_location",
    ("MTL::Texture", "parentRelativeSlice"): "metal::Texture::parent_relative_location",
    ("MTL::Texture", "buffer"): "metal::Texture::buffer",
    ("MTL::Texture", "bufferOffset"): "metal::Texture::buffer_layout",
    ("MTL::Texture", "bufferBytesPerRow"): "metal::Texture::buffer_layout",
    ("MTL::Texture", "firstMipmapInTail"): "metal::Texture::sparse_tail",
    ("MTL::Texture", "tailSizeInBytes"): "metal::Texture::sparse_tail",
    ("MTL::Device", "areBarycentricCoordsSupported"): "metal::Device::capability",
    ("MTL::Device", "areProgrammableSamplePositionsSupported"): "metal::Device::capability",
    ("MTL::Device", "areRasterOrderGroupsSupported"): "metal::Device::capability",
    ("MTL::Device", "hasUnifiedMemory"): "metal::Device::capability",
    ("MTL::Device", "isDepth24Stencil8PixelFormatSupported"): "metal::Device::capability",
    ("MTL::Device", "isHeadless"): "metal::Device::capability",
    ("MTL::Device", "isLowPower"): "metal::Device::capability",
    ("MTL::Device", "isRemovable"): "metal::Device::capability",
    ("MTL::Device", "supports32BitFloatFiltering"): "metal::Device::capability",
    ("MTL::Device", "supports32BitMSAA"): "metal::Device::capability",
    ("MTL::Device", "supportsBCTextureCompression"): "metal::Device::capability",
    ("MTL::Device", "supportsDynamicLibraries"): "metal::Device::capability",
    ("MTL::Device", "supportsFunctionPointers"): "metal::Device::capability",
    ("MTL::Device", "supportsFunctionPointersFromRender"): "metal::Device::capability",
    ("MTL::Device", "supportsPlacementSparse"): "metal::Device::capability",
    ("MTL::Device", "supportsPrimitiveMotionBlur"): "metal::Device::capability",
    ("MTL::Device", "supportsPullModelInterpolation"): "metal::Device::capability",
    ("MTL::Device", "supportsQueryTextureLOD"): "metal::Device::capability",
    ("MTL::Device", "supportsRaytracing"): "metal::Device::capability",
    ("MTL::Device", "supportsRaytracingFromRender"): "metal::Device::capability",
    ("MTL::Device", "supportsRenderDynamicLibraries"): "metal::Device::capability",
    ("MTL::Device", "supportsShaderBarycentricCoordinates"): "metal::Device::capability",
    ("MTL::Device", "currentAllocatedSize"): "metal::Device::numeric_property",
    ("MTL::Device", "locationNumber"): "metal::Device::numeric_property",
    ("MTL::Device", "maxArgumentBufferSamplerCount"): "metal::Device::numeric_property",
    ("MTL::Device", "maxBufferLength"): "metal::Device::numeric_property",
    ("MTL::Device", "maxThreadgroupMemoryLength"): "metal::Device::numeric_property",
    ("MTL::Device", "maxTransferRate"): "metal::Device::numeric_property",
    ("MTL::Device", "maximumConcurrentCompilationTaskCount"): "metal::Device::numeric_property",
    ("MTL::Device", "peerCount"): "metal::Device::numeric_property",
    ("MTL::Device", "peerGroupID"): "metal::Device::numeric_property",
    ("MTL::Device", "peerIndex"): "metal::Device::numeric_property",
    ("MTL::Device", "recommendedMaxWorkingSetSize"): "metal::Device::numeric_property",
    ("MTL::Device", "registryID"): "metal::Device::numeric_property",
    ("MTL::Device", "sparseTileSizeInBytes"): "metal::Device::numeric_property",
    ("MTL::Device", "queryTimestampFrequency"): "metal::Device::numeric_property",
    ("MTL::Device", "maxThreadsPerThreadgroup"): "metal::Device::max_threads_per_threadgroup",
    ("MTL::Device", "minimumLinearTextureAlignmentForPixelFormat"): "metal::Device::texture_alignments",
    ("MTL::Device", "minimumTextureBufferAlignmentForPixelFormat"): "metal::Device::texture_alignments",
    ("MTL::Device", "sampleTimestamps"): "metal::Device::sample_timestamps",
    ("MTL::Device", "location"): "metal::Device::location",
    ("MTL::Device", "argumentBuffersSupport"): "metal::Device::argument_buffers_tier",
    ("MTL::Device", "readWriteTextureSupport"): "metal::Device::read_write_texture_tier",
    ("MTL::Device", "supportsFamily"): "metal::Device::supports_family",
    ("MTL::Device", "supportsFeatureSet"): "metal::Device::supports_feature_set",
    ("MTL::Device", "supportsCounterSampling"): "metal::Device::supports_counter_sampling",
    ("MTL::Device", "supportsRasterizationRateMap"): "metal::Device::supports_rasterization_rate_map",
    ("MTL::Device", "supportsVertexAmplificationCount"): "metal::Device::supports_vertex_amplification_count",
    ("MTL::Device", "shouldMaximizeConcurrentCompilation"): "metal::Device::should_maximize_concurrent_compilation",
    ("MTL::Device", "setShouldMaximizeConcurrentCompilation"): "metal::Device::set_should_maximize_concurrent_compilation",
    ("MTL::Device", "getDefaultSamplePositions"): "metal::Device::default_sample_positions",
    ("MTL::Device", "heapBufferSizeAndAlign"): "metal::Device::heap_buffer_size_and_align",
    ("MTL::Device", "sparseTileSize"): "metal::Device::sparse_tile_size",
    ("MTL::Buffer", "addDebugMarker"): "metal::Buffer::add_debug_marker",
    ("MTL::Buffer", "removeAllDebugMarkers"): "metal::Buffer::remove_all_debug_markers",
    ("MTL::Buffer", "gpuAddress"): "metal::Buffer::gpu_address",
    ("MTL::Buffer", "sparseBufferTier"): "metal::Buffer::sparse_buffer_tier",
    ("MTL::Buffer", "remoteStorageBuffer"): "metal::Buffer::remote_storage_buffer",
    ("MTL::Buffer", "newRemoteBufferViewForDevice"): "metal::Buffer::new_remote_view",
    ("MTL::Buffer", "newTexture"): "metal::Buffer::new_texture",
    ("MTL::CommandQueue", "device"): "metal::CommandQueue::device",
    ("MTL::CommandQueue", "insertDebugCaptureBoundary"): "metal::CommandQueue::insert_debug_capture_boundary",
    ("MTL::CommandQueue", "addResidencySet"): "metal::CommandQueue::add_residency_sets",
    ("MTL::CommandQueue", "addResidencySets"): "metal::CommandQueue::add_residency_sets",
    ("MTL::CommandQueue", "removeResidencySet"): "metal::CommandQueue::remove_residency_sets",
    ("MTL::CommandQueue", "removeResidencySets"): "metal::CommandQueue::remove_residency_sets",
    ("MTL::CommandQueue", "commandBufferWithUnretainedReferences"): "metal::CommandQueue::command_buffer",
    ("MTL::CompileOptions", "alloc"): "metal::CompileOptions::new",
    ("MTL::CompileOptions", "init"): "metal::CompileOptions::new",
    ("MTL::CompileOptions", "fastMathEnabled"): "metal::CompileOptions::fast_math_enabled",
    ("MTL::CompileOptions", "setFastMathEnabled"): "metal::CompileOptions::set_fast_math_enabled",
    ("MTL::CompileOptions", "allowReferencingUndefinedSymbols"): "metal::CompileOptions::allows_referencing_undefined_symbols",
    ("MTL::CompileOptions", "setAllowReferencingUndefinedSymbols"): "metal::CompileOptions::set_allows_referencing_undefined_symbols",
    ("MTL::CompileOptions", "enableLogging"): "metal::CompileOptions::logging_enabled",
    ("MTL::CompileOptions", "setEnableLogging"): "metal::CompileOptions::set_logging_enabled",
    ("MTL::CompileOptions", "preserveInvariance"): "metal::CompileOptions::preserves_invariance",
    ("MTL::CompileOptions", "setPreserveInvariance"): "metal::CompileOptions::set_preserves_invariance",
    ("MTL::CompileOptions", "installName"): "metal::CompileOptions::install_name",
    ("MTL::CompileOptions", "setInstallName"): "metal::CompileOptions::set_install_name",
    ("MTL::CompileOptions", "maxTotalThreadsPerThreadgroup"): "metal::CompileOptions::max_total_threads_per_threadgroup",
    ("MTL::CompileOptions", "setMaxTotalThreadsPerThreadgroup"): "metal::CompileOptions::set_max_total_threads_per_threadgroup",
    ("MTL::CompileOptions", "requiredThreadsPerThreadgroup"): "metal::CompileOptions::required_threads_per_threadgroup",
    ("MTL::CompileOptions", "setRequiredThreadsPerThreadgroup"): "metal::CompileOptions::set_required_threads_per_threadgroup",
    ("MTL::CompileOptions", "mathMode"): "metal::CompileOptions::math_mode",
    ("MTL::CompileOptions", "setMathMode"): "metal::CompileOptions::set_math_mode",
    ("MTL::CompileOptions", "mathFloatingPointFunctions"): "metal::CompileOptions::math_floating_point_functions",
    ("MTL::CompileOptions", "setMathFloatingPointFunctions"): "metal::CompileOptions::set_math_floating_point_functions",
    ("MTL::CompileOptions", "languageVersion"): "metal::CompileOptions::language_version",
    ("MTL::CompileOptions", "setLanguageVersion"): "metal::CompileOptions::set_language_version",
    ("MTL::CompileOptions", "libraryType"): "metal::CompileOptions::library_type",
    ("MTL::CompileOptions", "setLibraryType"): "metal::CompileOptions::set_library_type",
    ("MTL::CompileOptions", "optimizationLevel"): "metal::CompileOptions::optimization_level",
    ("MTL::CompileOptions", "setOptimizationLevel"): "metal::CompileOptions::set_optimization_level",
    ("MTL::CompileOptions", "compileSymbolVisibility"): "metal::CompileOptions::compile_symbol_visibility",
    ("MTL::CompileOptions", "setCompileSymbolVisibility"): "metal::CompileOptions::set_compile_symbol_visibility",
    ("MTL::RenderPipelineDescriptor", "alloc"): "metal::RenderPipelineDescriptor::empty",
    ("MTL::RenderPipelineDescriptor", "init"): "metal::RenderPipelineDescriptor::empty",
    ("MTL::RenderPipelineDescriptor", "label"): "metal::RenderPipelineDescriptor::label",
    ("MTL::RenderPipelineDescriptor", "setLabel"): "metal::RenderPipelineDescriptor::set_label",
    ("MTL::RenderPipelineDescriptor", "vertexFunction"): "metal::RenderPipelineDescriptor::vertex_function",
    ("MTL::RenderPipelineDescriptor", "setVertexFunction"): "metal::RenderPipelineDescriptor::set_vertex_function",
    ("MTL::RenderPipelineDescriptor", "fragmentFunction"): "metal::RenderPipelineDescriptor::fragment_function",
    ("MTL::RenderPipelineDescriptor", "setFragmentFunction"): "metal::RenderPipelineDescriptor::set_fragment_function",
    ("MTL::RenderPipelineDescriptor", "reset"): "metal::RenderPipelineDescriptor::reset",
    ("MTL::RenderPipelineDescriptor", "inputPrimitiveTopology"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "isAlphaToCoverageEnabled"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "isAlphaToOneEnabled"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "isRasterizationEnabled"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "isTessellationFactorScaleEnabled"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "depthAttachmentPixelFormat"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "stencilAttachmentPixelFormat"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "maxFragmentCallStackDepth"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "maxTessellationFactor"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "maxVertexAmplificationCount"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "maxVertexCallStackDepth"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "rasterSampleCount"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "sampleCount"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "shaderValidation"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "supportAddingFragmentBinaryFunctions"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "supportAddingVertexBinaryFunctions"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "supportIndirectCommandBuffers"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "tessellationControlPointIndexType"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "tessellationFactorFormat"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "tessellationFactorStepFunction"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "tessellationOutputWindingOrder"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "tessellationPartitionMode"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "setInputPrimitiveTopology"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setAlphaToCoverageEnabled"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setAlphaToOneEnabled"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setRasterizationEnabled"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setTessellationFactorScaleEnabled"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setDepthAttachmentPixelFormat"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setStencilAttachmentPixelFormat"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setMaxFragmentCallStackDepth"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setMaxTessellationFactor"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setMaxVertexAmplificationCount"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setMaxVertexCallStackDepth"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setRasterSampleCount"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setSampleCount"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setShaderValidation"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setSupportAddingFragmentBinaryFunctions"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setSupportAddingVertexBinaryFunctions"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setSupportIndirectCommandBuffers"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setTessellationControlPointIndexType"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setTessellationFactorFormat"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setTessellationFactorStepFunction"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setTessellationOutputWindingOrder"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPipelineDescriptor", "setTessellationPartitionMode"): "metal::RenderPipelineDescriptor::set_options",
    ("MTL::RenderPassDescriptor", "alloc"): "metal::RenderPassDescriptor::new",
    ("MTL::RenderPassDescriptor", "init"): "metal::RenderPassDescriptor::new",
    ("MTL::RenderPassDescriptor", "renderPassDescriptor"): "metal::RenderPassDescriptor::new",
    ("MTL::RenderPassDescriptor", "defaultRasterSampleCount"): "metal::RenderPassDescriptor::options",
    ("MTL::RenderPassDescriptor", "imageblockSampleLength"): "metal::RenderPassDescriptor::options",
    ("MTL::RenderPassDescriptor", "renderTargetArrayLength"): "metal::RenderPassDescriptor::options",
    ("MTL::RenderPassDescriptor", "renderTargetHeight"): "metal::RenderPassDescriptor::options",
    ("MTL::RenderPassDescriptor", "renderTargetWidth"): "metal::RenderPassDescriptor::options",
    ("MTL::RenderPassDescriptor", "supportColorAttachmentMapping"): "metal::RenderPassDescriptor::options",
    ("MTL::RenderPassDescriptor", "threadgroupMemoryLength"): "metal::RenderPassDescriptor::options",
    ("MTL::RenderPassDescriptor", "tileHeight"): "metal::RenderPassDescriptor::options",
    ("MTL::RenderPassDescriptor", "tileWidth"): "metal::RenderPassDescriptor::options",
    ("MTL::RenderPassDescriptor", "visibilityResultType"): "metal::RenderPassDescriptor::options",
    ("MTL::RenderPassDescriptor", "setDefaultRasterSampleCount"): "metal::RenderPassDescriptor::set_options",
    ("MTL::RenderPassDescriptor", "setImageblockSampleLength"): "metal::RenderPassDescriptor::set_options",
    ("MTL::RenderPassDescriptor", "setRenderTargetArrayLength"): "metal::RenderPassDescriptor::set_options",
    ("MTL::RenderPassDescriptor", "setRenderTargetHeight"): "metal::RenderPassDescriptor::set_options",
    ("MTL::RenderPassDescriptor", "setRenderTargetWidth"): "metal::RenderPassDescriptor::set_options",
    ("MTL::RenderPassDescriptor", "setSupportColorAttachmentMapping"): "metal::RenderPassDescriptor::set_options",
    ("MTL::RenderPassDescriptor", "setThreadgroupMemoryLength"): "metal::RenderPassDescriptor::set_options",
    ("MTL::RenderPassDescriptor", "setTileHeight"): "metal::RenderPassDescriptor::set_options",
    ("MTL::RenderPassDescriptor", "setTileWidth"): "metal::RenderPassDescriptor::set_options",
    ("MTL::RenderPassDescriptor", "setVisibilityResultType"): "metal::RenderPassDescriptor::set_options",
    ("MTL::RenderPassDescriptor", "getSamplePositions"): "metal::RenderPassDescriptor::sample_positions",
    ("MTL::RenderPassDescriptor", "setSamplePositions"): "metal::RenderPassDescriptor::set_sample_positions",
    ("MTL::RenderPassDescriptor", "visibilityResultBuffer"): "metal::RenderPassDescriptor::visibility_result_buffer",
    ("MTL::RenderPassDescriptor", "setVisibilityResultBuffer"): "metal::RenderPassDescriptor::set_visibility_result_buffer",
    ("MTL::RenderCommandEncoder", "setRenderPipelineState"): "metal::RenderCommandEncoder::set_pipeline",
    ("MTL::RenderCommandEncoder", "setViewport"): "metal::RenderCommandEncoder::set_viewport",
    ("MTL::RenderCommandEncoder", "setFragmentBytes"): "metal::RenderCommandEncoder::set_fragment_bytes",
    ("MTL::RenderCommandEncoder", "setFragmentBuffer"): "metal::RenderCommandEncoder::set_fragment_buffer",
    ("MTL::RenderCommandEncoder", "setVertexTexture"): "metal::RenderCommandEncoder::set_vertex_texture",
    ("MTL::RenderCommandEncoder", "setFragmentTexture"): "metal::RenderCommandEncoder::set_fragment_texture",
    ("MTL::RenderCommandEncoder", "setBlendColor"): "metal::RenderCommandEncoder::set_blend_color",
    ("MTL::RenderCommandEncoder", "setCullMode"): "metal::RenderCommandEncoder::set_cull_mode",
    ("MTL::RenderCommandEncoder", "setFrontFacingWinding"): "metal::RenderCommandEncoder::set_front_facing_winding",
    ("MTL::RenderCommandEncoder", "setTriangleFillMode"): "metal::RenderCommandEncoder::set_triangle_fill_mode",
    ("MTL::RenderCommandEncoder", "setDepthBias"): "metal::RenderCommandEncoder::set_depth_bias",
    ("MTL::RenderCommandEncoder", "setDepthClipMode"): "metal::RenderCommandEncoder::set_depth_clip_mode",
    ("MTL::RenderCommandEncoder", "setDepthTestBounds"): "metal::RenderCommandEncoder::set_depth_test_bounds",
    ("MTL::RenderCommandEncoder", "setStencilReferenceValue"): "metal::RenderCommandEncoder::set_stencil_reference_value",
    ("MTL::RenderCommandEncoder", "setStencilReferenceValues"): "metal::RenderCommandEncoder::set_stencil_reference_values",
    ("MTL::RenderCommandEncoder", "setScissorRect"): "metal::RenderCommandEncoder::set_scissor_rect",
    ("MTL::RenderCommandEncoder", "tileWidth"): "metal::RenderCommandEncoder::tile_size",
    ("MTL::RenderCommandEncoder", "tileHeight"): "metal::RenderCommandEncoder::tile_size",
    ("MTL::RenderCommandEncoder", "textureBarrier"): "metal::RenderCommandEncoder::texture_barrier",
    ("MTL::ComputeCommandEncoder", "setComputePipelineState"): "metal::ComputeCommandEncoder::set_pipeline",
    ("MTL::ComputeCommandEncoder", "dispatchThreads"): "metal::ComputeCommandEncoder::dispatch_threads",
    ("MTL::BlitCommandEncoder", "fillBuffer"): "metal::BlitCommandEncoder::fill_buffer",
    ("MTL::BlitCommandEncoder", "generateMipmaps"): "metal::BlitCommandEncoder::generate_mipmaps",
    ("MTL::BlitCommandEncoder", "synchronizeTexture"): "metal::BlitCommandEncoder::synchronize_texture",
    ("MTL::CommandEncoder", "device"): "metal::RenderCommandEncoder::device",
    ("MTL::CommandEncoder", "insertDebugSignpost"): "metal::RenderCommandEncoder::insert_debug_signpost",
    ("MTL::CommandEncoder", "pushDebugGroup"): "metal::RenderCommandEncoder::push_debug_group",
    ("MTL::CommandEncoder", "popDebugGroup"): "metal::RenderCommandEncoder::pop_debug_group",
    ("MTL::CommandEncoder", "endEncoding"): "metal::RenderCommandEncoder::end_encoding",
    ("MTL::Library", "device"): "metal::Library::device",
    ("MTL::Library", "installName"): "metal::Library::install_name",
    ("MTL::Library", "label"): "metal::Library::label",
    ("MTL::Library", "setLabel"): "metal::Library::set_label",
    ("MTL::Library", "type"): "metal::Library::library_type",
    ("MTL::Function", "device"): "metal::Function::device",
    ("MTL::Function", "label"): "metal::Function::label",
    ("MTL::Function", "setLabel"): "metal::Function::set_label",
    ("MTL::Function", "functionType"): "metal::Function::function_type",
    ("MTL::Function", "options"): "metal::Function::options",
    ("MTL::Function", "patchControlPointCount"): "metal::Function::patch_control_point_count",
    ("MTL::Function", "patchType"): "metal::Function::patch_type",
    ("MTL::RenderPipelineState", "device"): "metal::RenderPipelineState::device",
    ("MTL::RenderPipelineState", "label"): "metal::RenderPipelineState::label",
    ("MTL::RenderPipelineState", "supportIndirectCommandBuffers"): "metal::RenderPipelineState::supports_indirect_command_buffers",
    ("MTL::RenderPipelineState", "threadgroupSizeMatchesTileSize"): "metal::RenderPipelineState::threadgroup_size_matches_tile_size",
    ("MTL::RenderPipelineState", "imageblockSampleLength"): "metal::RenderPipelineState::imageblock_sample_length",
    ("MTL::RenderPipelineState", "shaderValidation"): "metal::RenderPipelineState::shader_validation",
    ("MTL::RenderPipelineState", "requiredThreadsPerTileThreadgroup"): "metal::RenderPipelineState::required_threadgroups",
    ("MTL::RenderPipelineState", "requiredThreadsPerMeshThreadgroup"): "metal::RenderPipelineState::required_threadgroups",
    ("MTL::RenderPipelineState", "requiredThreadsPerObjectThreadgroup"): "metal::RenderPipelineState::required_threadgroups",
    ("MTL::ComputePipelineState", "device"): "metal::ComputePipelineState::device",
    ("MTL::ComputePipelineState", "label"): "metal::ComputePipelineState::label",
    ("MTL::ComputePipelineState", "supportIndirectCommandBuffers"): "metal::ComputePipelineState::supports_indirect_command_buffers",
    ("MTL::ComputePipelineState", "staticThreadgroupMemoryLength"): "metal::ComputePipelineState::static_threadgroup_memory_length",
    ("MTL::ComputePipelineState", "requiredThreadsPerThreadgroup"): "metal::ComputePipelineState::required_threads_per_threadgroup",
    ("MTL::ComputePipelineState", "shaderValidation"): "metal::ComputePipelineState::shader_validation",
    ("MTLFX::SpatialScalerDescriptor", "colorTextureFormat"): "metal_fx::SpatialScalerDescriptor::color_texture_format",
    ("MTLFX::SpatialScalerDescriptor", "setColorTextureFormat"): "metal_fx::SpatialScalerDescriptor::set_color_texture_format",
    ("MTLFX::SpatialScalerDescriptor", "outputTextureFormat"): "metal_fx::SpatialScalerDescriptor::output_texture_format",
    ("MTLFX::SpatialScalerDescriptor", "setOutputTextureFormat"): "metal_fx::SpatialScalerDescriptor::set_output_texture_format",
    ("MTLFX::SpatialScalerDescriptor", "inputWidth"): "metal_fx::SpatialScalerDescriptor::input_size",
    ("MTLFX::SpatialScalerDescriptor", "inputHeight"): "metal_fx::SpatialScalerDescriptor::input_size",
    ("MTLFX::SpatialScalerDescriptor", "setInputWidth"): "metal_fx::SpatialScalerDescriptor::set_input_size",
    ("MTLFX::SpatialScalerDescriptor", "setInputHeight"): "metal_fx::SpatialScalerDescriptor::set_input_size",
    ("MTLFX::SpatialScalerDescriptor", "outputWidth"): "metal_fx::SpatialScalerDescriptor::output_size",
    ("MTLFX::SpatialScalerDescriptor", "outputHeight"): "metal_fx::SpatialScalerDescriptor::output_size",
    ("MTLFX::SpatialScalerDescriptor", "setOutputWidth"): "metal_fx::SpatialScalerDescriptor::set_output_size",
    ("MTLFX::SpatialScalerDescriptor", "setOutputHeight"): "metal_fx::SpatialScalerDescriptor::set_output_size",
    ("MTLFX::SpatialScalerDescriptor", "colorProcessingMode"): "metal_fx::SpatialScalerDescriptor::color_processing_mode",
    ("MTLFX::SpatialScalerDescriptor", "setColorProcessingMode"): "metal_fx::SpatialScalerDescriptor::set_color_processing_mode",
    ("MTLFX::SpatialScalerDescriptor", "supportsMetal4FX"): "metal_fx::SpatialScalerDescriptor::supports_metal4_fx",
    ("MTLFX::SpatialScalerBase", "colorTexture"): "metal_fx::SpatialScaler::color_texture",
    ("MTLFX::SpatialScalerBase", "outputTexture"): "metal_fx::SpatialScaler::output_texture",
    ("MTLFX::SpatialScalerBase", "colorProcessingMode"): "metal_fx::SpatialScaler::color_processing_mode",
    ("MTLFX::TemporalScalerDescriptor", "colorTextureFormat"): "metal_fx::TemporalScalerDescriptor::texture_formats",
    ("MTLFX::TemporalScalerDescriptor", "depthTextureFormat"): "metal_fx::TemporalScalerDescriptor::texture_formats",
    ("MTLFX::TemporalScalerDescriptor", "motionTextureFormat"): "metal_fx::TemporalScalerDescriptor::texture_formats",
    ("MTLFX::TemporalScalerDescriptor", "outputTextureFormat"): "metal_fx::TemporalScalerDescriptor::texture_formats",
    ("MTLFX::TemporalScalerDescriptor", "setColorTextureFormat"): "metal_fx::TemporalScalerDescriptor::set_texture_formats",
    ("MTLFX::TemporalScalerDescriptor", "setDepthTextureFormat"): "metal_fx::TemporalScalerDescriptor::set_texture_formats",
    ("MTLFX::TemporalScalerDescriptor", "setMotionTextureFormat"): "metal_fx::TemporalScalerDescriptor::set_texture_formats",
    ("MTLFX::TemporalScalerDescriptor", "setOutputTextureFormat"): "metal_fx::TemporalScalerDescriptor::set_texture_formats",
    ("MTLFX::TemporalScalerDescriptor", "inputWidth"): "metal_fx::TemporalScalerDescriptor::input_size",
    ("MTLFX::TemporalScalerDescriptor", "inputHeight"): "metal_fx::TemporalScalerDescriptor::input_size",
    ("MTLFX::TemporalScalerDescriptor", "setInputWidth"): "metal_fx::TemporalScalerDescriptor::set_input_size",
    ("MTLFX::TemporalScalerDescriptor", "setInputHeight"): "metal_fx::TemporalScalerDescriptor::set_input_size",
    ("MTLFX::TemporalScalerDescriptor", "outputWidth"): "metal_fx::TemporalScalerDescriptor::output_size",
    ("MTLFX::TemporalScalerDescriptor", "outputHeight"): "metal_fx::TemporalScalerDescriptor::output_size",
    ("MTLFX::TemporalScalerDescriptor", "setOutputWidth"): "metal_fx::TemporalScalerDescriptor::set_output_size",
    ("MTLFX::TemporalScalerDescriptor", "setOutputHeight"): "metal_fx::TemporalScalerDescriptor::set_output_size",
    ("MTLFX::TemporalScalerDescriptor", "isAutoExposureEnabled"): "metal_fx::TemporalScalerDescriptor::auto_exposure_enabled",
    ("MTLFX::TemporalScalerDescriptor", "setAutoExposureEnabled"): "metal_fx::TemporalScalerDescriptor::set_auto_exposure_enabled",
    ("MTLFX::TemporalScalerDescriptor", "isInputContentPropertiesEnabled"): "metal_fx::TemporalScalerDescriptor::input_content_properties_enabled",
    ("MTLFX::TemporalScalerDescriptor", "setInputContentPropertiesEnabled"): "metal_fx::TemporalScalerDescriptor::set_input_content_properties_enabled",
    ("MTLFX::TemporalScalerDescriptor", "requiresSynchronousInitialization"): "metal_fx::TemporalScalerDescriptor::requires_synchronous_initialization",
    ("MTLFX::TemporalScalerDescriptor", "setRequiresSynchronousInitialization"): "metal_fx::TemporalScalerDescriptor::set_requires_synchronous_initialization",
    ("MTLFX::TemporalScalerDescriptor", "isReactiveMaskTextureEnabled"): "metal_fx::TemporalScalerDescriptor::reactive_mask_texture_enabled",
    ("MTLFX::TemporalScalerDescriptor", "setReactiveMaskTextureEnabled"): "metal_fx::TemporalScalerDescriptor::set_reactive_mask_texture_enabled",
    ("MTLFX::TemporalScalerDescriptor", "reactiveMaskTextureFormat"): "metal_fx::TemporalScalerDescriptor::reactive_mask_texture_format",
    ("MTLFX::TemporalScalerDescriptor", "setReactiveMaskTextureFormat"): "metal_fx::TemporalScalerDescriptor::set_reactive_mask_texture_format",
    ("MTLFX::TemporalScalerDescriptor", "inputContentMinScale"): "metal_fx::TemporalScalerDescriptor::input_content_scale_range",
    ("MTLFX::TemporalScalerDescriptor", "inputContentMaxScale"): "metal_fx::TemporalScalerDescriptor::input_content_scale_range",
    ("MTLFX::TemporalScalerDescriptor", "setInputContentMinScale"): "metal_fx::TemporalScalerDescriptor::set_input_content_scale_range",
    ("MTLFX::TemporalScalerDescriptor", "setInputContentMaxScale"): "metal_fx::TemporalScalerDescriptor::set_input_content_scale_range",
    ("MTLFX::TemporalScalerDescriptor", "isOutputResolutionMotionVectorsEnabled"): "metal_fx::TemporalScalerDescriptor::output_resolution_motion_vectors_enabled",
    ("MTLFX::TemporalScalerDescriptor", "setOutputResolutionMotionVectorsEnabled"): "metal_fx::TemporalScalerDescriptor::set_output_resolution_motion_vectors_enabled",
    ("MTLFX::TemporalScalerDescriptor", "supportsMetal4FX"): "metal_fx::TemporalScalerDescriptor::supports_metal4_fx",
    ("MTLFX::TemporalScalerBase", "colorTexture"): "metal_fx::TemporalScaler::textures",
    ("MTLFX::TemporalScalerBase", "depthTexture"): "metal_fx::TemporalScaler::textures",
    ("MTLFX::TemporalScalerBase", "motionTexture"): "metal_fx::TemporalScaler::textures",
    ("MTLFX::TemporalScalerBase", "outputTexture"): "metal_fx::TemporalScaler::textures",
    ("MTLFX::TemporalScalerBase", "exposureTexture"): "metal_fx::TemporalScaler::exposure_texture",
    ("MTLFX::TemporalScalerBase", "setExposureTexture"): "metal_fx::TemporalScaler::set_exposure_texture",
    ("MTLFX::TemporalScalerBase", "reactiveMaskTexture"): "metal_fx::TemporalScaler::reactive_mask_texture",
    ("MTLFX::TemporalScalerBase", "setReactiveMaskTexture"): "metal_fx::TemporalScaler::set_reactive_mask_texture",
    ("MTLFX::TemporalScalerBase", "reactiveTextureUsage"): "metal_fx::TemporalScaler::reactive_texture_usage",
    ("MTLFX::TemporalScalerBase", "setDepthReversed"): "metal_fx::TemporalScaler::set_depth_reversed",
}

# Handwritten safe facade methods added by the vertical migration slices.  Only
# declarations whose parent/name pair is unique in the inventory belong here;
# overloaded APIs are recorded by their complete C++ signature below.
ACTUAL_METHODS.update(
    {
        ("MTL4::CommandBuffer", "writeTimestampIntoHeap"): "metal4::RecordingCommandBuffer::write_timestamp_into_heap",
        ("MTL4::MachineLearningCommandEncoder", "dispatchNetwork"): "metal4::RecordingMachineLearningEncoder::dispatch_network",
        ("MTL4::MachineLearningCommandEncoder", "setArgumentTable"): "metal4::RecordingMachineLearningEncoder::set_argument_table",
        ("MTL4::MachineLearningCommandEncoder", "setPipelineState"): "metal4::RecordingMachineLearningEncoder::set_pipeline_state",
        ("MTL::LinkedFunctions", "privateFunctions"): "metal::LinkedFunctions::internal_functions",
        ("MTL::LinkedFunctions", "setPrivateFunctions"): "metal::LinkedFunctions::set_internal_functions",
        ("MTL4::StaticLinkingDescriptor", "privateFunctionDescriptors"): "metal4::StaticLinkingDescriptor::internal_functions",
        ("MTL4::StaticLinkingDescriptor", "setPrivateFunctionDescriptors"): "metal4::StaticLinkingDescriptor::set_internal_functions",
        ("MTL4::CommandBuffer", "resolveCounterHeap"): "metal4::RecordingCommandBuffer::resolve_counter_heap",
        ("MTL4::CommandEncoder", "commandBuffer"): "metal4::RecordingCommandBuffer",
        ("MTL4::CommandQueueDescriptor", "feedbackQueue"): "metal4::SubmittedCommandBuffers::wait",
        ("MTL4::CommandQueueDescriptor", "setFeedbackQueue"): "metal4::SubmittedCommandBuffers::wait",
        ("MTL4::CommitFeedback", "error"): "metal4::SubmittedCommandBuffers::wait",
        ("MTL::ArgumentDescriptor", "argumentDescriptor"): "metal::ArgumentDescriptor::new",
        ("MTL::FunctionDescriptor", "binaryArchives"): "metal::FunctionDescriptor::binary_archives_vec",
        ("MTL::FunctionDescriptor", "setBinaryArchives"): "metal::FunctionDescriptor::set_binary_archives_slice",
        ("MTL::FunctionDescriptor", "functionDescriptor"): "metal::FunctionDescriptor::new",
        ("MTL::PipelineBufferDescriptorArray", "object"): "metal::PipelineBufferDescriptorArray::buffer",
        ("MTL::PipelineBufferDescriptorArray", "setObject"): "metal::PipelineBufferDescriptorArray::set_buffer",
        ("MTL::SamplerDescriptor", "rAddressMode"): "metal::SamplerDescriptor::r_address_mode",
        ("MTL::SamplerDescriptor", "setRAddressMode"): "metal::SamplerDescriptor::set_r_address_mode",
        ("MTL::SamplerState", "gpuResourceID"): "metal::SamplerState::gpu_resource_id",
        ("MTL::DepthStencilState", "gpuResourceID"): "metal::DepthStencilState::gpu_resource_id",
        ("MTL::CounterSet", "counters"): "metal::CounterSet::counters_vec",
        ("MTL::CounterSampleBuffer", "resolveCounterRange"): "metal::CounterSampleBuffer::resolve_counter_range",
        ("MTL::DynamicLibrary", "serializeToURL"): "metal::DynamicLibrary::serialize_to_file",
        ("MTL::FunctionHandle", "gpuResourceID"): "metal::FunctionHandle::gpu_resource_id",
        ("MTL::FunctionLogDebugLocation", "URL"): "metal::FunctionLogDebugLocation::source_url",
        ("MTL::FunctionReflection", "bindings"): "metal::FunctionReflection::bindings_vec",
        ("MTL::LinkedFunctions", "linkedFunctions"): "metal::LinkedFunctions::new",
        ("MTL::TensorAuxiliaryPlaneDescriptorMap", "descriptor"): "metal::TensorAuxiliaryPlaneDescriptorMap::descriptor",
        ("MTL::TensorAuxiliaryPlaneDescriptorMap", "setDescriptor"): "metal::TensorAuxiliaryPlaneDescriptorMap::set_descriptor",
        ("MTL::TensorAuxiliaryPlaneDescriptorMap", "reset"): "metal::TensorAuxiliaryPlaneDescriptorMap::reset",
        ("MTL::Tensor", "auxiliaryPlanes"): "metal::Tensor::auxiliary_plane_objects",
        ("MTL::Tensor", "gpuResourceID"): "metal::Tensor::gpu_resource_id",
        ("MTL4::ComputePipelineDescriptor", "requiredThreadsPerThreadgroup"): "metal4::ComputePipelineDescriptor::required_threads_per_threadgroup_safe",
        ("MTL4::ComputePipelineDescriptor", "setRequiredThreadsPerThreadgroup"): "metal4::ComputePipelineDescriptor::set_required_threads_per_threadgroup_safe",
        ("MTL4::ComputePipelineDescriptor", "reset"): "metal4::ComputePipelineDescriptor::reset_pipeline_descriptor",
        ("MTL4::TileRenderPipelineDescriptor", "requiredThreadsPerThreadgroup"): "metal4::TileRenderPipelineDescriptor::required_threads_per_threadgroup_safe",
        ("MTL4::TileRenderPipelineDescriptor", "setRequiredThreadsPerThreadgroup"): "metal4::TileRenderPipelineDescriptor::set_required_threads_per_threadgroup_safe",
        ("MTL4::TileRenderPipelineDescriptor", "reset"): "metal4::TileRenderPipelineDescriptor::reset_pipeline_descriptor",
        ("MTL4::StitchedFunctionDescriptor", "functionDescriptors"): "metal4::StitchedFunctionDescriptor::function_descriptors_vec",
        ("MTL4::StitchedFunctionDescriptor", "setFunctionDescriptors"): "metal4::StitchedFunctionDescriptor::set_function_descriptors_slice",
        ("MTL4::RenderPassDescriptor", "getSamplePositions"): "metal4::RenderPassDescriptor::sample_positions_vec",
        ("MTL4::RenderPassDescriptor", "setSamplePositions"): "metal4::RenderPassDescriptor::set_sample_positions_slice",
        ("MTL4::PipelineDataSetSerializer", "serializeAsArchiveAndFlushToURL"): "metal4::PipelineDataSetSerializer::serialize_archive_to_path",
        ("MTL4::PipelineDataSetSerializer", "serializeAsPipelinesScript"): "metal4::PipelineDataSetSerializer::serialize_pipelines_script",
        ("MTL4::CommandAllocator", "allocatedSize"): "metal4::CommandAllocator::allocated_size_safe",
        ("MTL4::CommandAllocator", "reset"): "metal4::CommandAllocator::reset_safe",
        ("MTL4::CompilerTask", "waitUntilCompleted"): "metal4::CompilerTask::wait_until_completed_safe",
        ("MTL::CommandBufferEncoderInfo", "debugSignposts"): "metal::CommandBufferEncoderInfo::debug_signposts",
        ("MTL::CommandBuffer", "computeCommandEncoder"): "metal::CommandBuffer::compute_encoder",
        ("MTL::CommandBuffer", "renderCommandEncoder"): "metal::CommandBuffer::render_encoder",
        ("MTL::IOScratchBufferAllocator", "newScratchBuffer"): "metal::IoScratchBufferAllocator::new_scratch_buffer",
        ("MTL::Texture", "pixelFormat"): "metal::Texture::pixel_format",
        ("MTL::RasterizationRateMap", "physicalSize"): "metal::RasterizationRateMap::physical_size",
        ("MTL::Library", "reflectionForFunction"): "metal::Library::reflection_for_function",
        ("MTL::FunctionConstantValues", "reset"): "metal::FunctionConstantValues::reset",
        ("MTL::CompileOptions", "libraries"): "metal::CompileOptions::libraries",
        ("MTL::CompileOptions", "setLibraries"): "metal::CompileOptions::set_libraries",
        ("MTL::CompileOptions", "preprocessorMacros"): "metal::CompileOptions::preprocessor_macros",
        ("MTL::CompileOptions", "setPreprocessorMacros"): "metal::CompileOptions::set_preprocessor_macros",
        ("MTL::ComputePipelineState", "newComputePipelineStateWithBinaryFunctions"): "metal::ComputePipelineState::with_metal4_binary_functions",
        ("MTL::ComputePipelineState", "newIntersectionFunctionTable"): "metal::ComputePipelineState::new_intersection_function_table",
        ("MTL::ComputePipelineState", "newVisibleFunctionTable"): "metal::ComputePipelineState::new_visible_function_table",
        ("MTL::RenderPipelineState", "newIntersectionFunctionTable"): "metal::RenderPipelineState::new_intersection_function_table",
        ("MTL::RenderPipelineState", "newRenderPipelineDescriptor"): "metal::RenderPipelineState::new_render_pipeline_descriptor",
        ("MTL::RenderPipelineState", "newRenderPipelineState"): "metal::RenderPipelineState::with_metal4_binary_functions",
        ("MTL::RenderPipelineState", "newVisibleFunctionTable"): "metal::RenderPipelineState::new_visible_function_table",
        ("MTL4::CommandQueue", "updateBufferMappings"): "metal4::CommandQueue::update_buffer_mappings",
        ("MTL4::CommandQueue", "copyBufferMappingsFromBuffer"): "metal4::CommandQueue::copy_buffer_mappings",
        ("MTL4::CommandQueue", "updateTextureMappings"): "metal4::CommandQueue::update_texture_mappings",
        ("MTL4::CommandQueue", "copyTextureMappingsFromTexture"): "metal4::CommandQueue::copy_texture_mappings",
        ("MTL4::RenderCommandEncoder", "dispatchThreadsPerTile"): "metal4::RecordingRenderEncoder::dispatch_threads_per_tile",
        ("MTL4::RenderCommandEncoder", "drawMeshThreads"): "metal4::RecordingRenderEncoder::draw_mesh_threads",
        ("MTL4::RenderCommandEncoder", "drawPrimitives"): "metal4::RecordingRenderEncoder::draw_primitives_indirect",
        ("MTL4::RenderCommandEncoder", "setColorAttachmentMap"): "metal4::RecordingRenderEncoder::set_color_attachment_map",
        ("MTL4::RenderCommandEncoder", "setScissorRect"): "metal4::RecordingRenderEncoder::set_scissor_rect",
        ("MTL4::RenderCommandEncoder", "setScissorRects"): "metal4::RecordingRenderEncoder::set_scissor_rects",
        ("MTL4::RenderCommandEncoder", "setVertexAmplificationCount"): "metal4::RecordingRenderEncoder::set_vertex_amplification",
        ("MTL4::RenderCommandEncoder", "setViewports"): "metal4::RecordingRenderEncoder::set_viewports",
        ("MTL4::RenderCommandEncoder", "tileHeight"): "metal4::RecordingRenderEncoder::tile_height",
        ("MTL4::RenderCommandEncoder", "tileWidth"): "metal4::RecordingRenderEncoder::tile_width",
        ("MTL4::RenderCommandEncoder", "writeTimestamp"): "metal4::RecordingRenderEncoder::write_timestamp",
        ("MTL4::ComputeCommandEncoder", "copyIndirectCommandBuffer"): "metal4::RecordingComputeEncoder::copy_indirect_commands",
        ("MTL4::ComputeCommandEncoder", "fillBuffer"): "metal4::RecordingComputeEncoder::fill_buffer",
        ("MTL4::ComputeCommandEncoder", "generateMipmaps"): "metal4::RecordingComputeEncoder::generate_mipmaps",
        ("MTL4::ComputeCommandEncoder", "optimizeIndirectCommandBuffer"): "metal4::RecordingComputeEncoder::optimize_indirect_commands",
        ("MTL4::ComputeCommandEncoder", "resetCommandsInBuffer"): "metal4::RecordingComputeEncoder::reset_commands",
        ("MTL4::ComputeCommandEncoder", "writeTimestamp"): "metal4::RecordingComputeEncoder::write_timestamp",
        ("MTL4::CounterHeap", "resolveCounterRange"): "metal4::CompletedCommandBuffers::resolve_counters",
        ("MTL::BlitPassSampleBufferAttachmentDescriptorArray", "object"): "metal::BlitPassSampleBufferAttachmentDescriptorArray::attachment",
        ("MTL::BlitPassSampleBufferAttachmentDescriptorArray", "setObject"): "metal::BlitPassSampleBufferAttachmentDescriptorArray::set_attachment",
        ("MTL::BlitPassDescriptor", "blitPassDescriptor"): "metal::BlitPassDescriptor::new",
        ("MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray", "object"): "metal::ResourceStatePassSampleBufferAttachmentDescriptorArray::attachment",
        ("MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray", "setObject"): "metal::ResourceStatePassSampleBufferAttachmentDescriptorArray::set_attachment",
        ("MTL::ResourceStatePassDescriptor", "resourceStatePassDescriptor"): "metal::ResourceStatePassDescriptor::new",
        ("MTL::CommandEncoder", "barrierAfterQueueStages"): "metal::CommandEncoder::barrier_after_queue_stages",
        ("MTL::PrimitiveAccelerationStructureDescriptor", "descriptor"): "metal::PrimitiveAccelerationStructureDescriptor::new",
        ("MTL::AccelerationStructureTriangleGeometryDescriptor", "descriptor"): "metal::AccelerationStructureTriangleGeometryDescriptor::new",
        ("MTL::AccelerationStructureBoundingBoxGeometryDescriptor", "descriptor"): "metal::AccelerationStructureBoundingBoxGeometryDescriptor::new",
        ("MTL::MotionKeyframeData", "data"): "metal::MotionKeyframeData::new",
        ("MTL::AccelerationStructureMotionTriangleGeometryDescriptor", "descriptor"): "metal::AccelerationStructureMotionTriangleGeometryDescriptor::new",
        ("MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor", "descriptor"): "metal::AccelerationStructureMotionBoundingBoxGeometryDescriptor::new",
        ("MTL::AccelerationStructureCurveGeometryDescriptor", "descriptor"): "metal::AccelerationStructureCurveGeometryDescriptor::new",
        ("MTL::AccelerationStructureMotionCurveGeometryDescriptor", "descriptor"): "metal::AccelerationStructureMotionCurveGeometryDescriptor::new",
        ("MTL::InstanceAccelerationStructureDescriptor", "descriptor"): "metal::InstanceAccelerationStructureDescriptor::new",
        ("MTL::IndirectInstanceAccelerationStructureDescriptor", "descriptor"): "metal::IndirectInstanceAccelerationStructureDescriptor::new",
        ("MTL::AccelerationStructurePassDescriptor", "accelerationStructurePassDescriptor"): "metal::AccelerationStructurePassDescriptor::new",
        ("MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray", "object"): "metal::AccelerationStructurePassSampleBufferAttachmentDescriptorArray::attachment",
        ("MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray", "setObject"): "metal::AccelerationStructurePassSampleBufferAttachmentDescriptorArray::set_attachment",
        ("MTL::CaptureDescriptor", "captureObject"): "metal::CaptureDescriptor::capture_target",
        ("MTL::CaptureManager", "alloc"): "metal::CaptureSession",
        ("MTL::CaptureManager", "init"): "metal::CaptureSession",
        ("MTL::VertexBufferLayoutDescriptorArray", "object"): "metal::VertexBufferLayoutDescriptorArray::get",
        ("MTL::VertexBufferLayoutDescriptorArray", "setObject"): "metal::VertexBufferLayoutDescriptorArray::set",
        ("MTL::VertexAttributeDescriptorArray", "object"): "metal::VertexAttributeDescriptorArray::get",
        ("MTL::VertexAttributeDescriptorArray", "setObject"): "metal::VertexAttributeDescriptorArray::set",
        ("MTL::VertexDescriptor", "reset"): "metal::VertexDescriptor::reset_safe",
        ("MTL::VertexDescriptor", "vertexDescriptor"): "metal::VertexDescriptor::default_descriptor",
        ("MTL::BufferLayoutDescriptorArray", "object"): "metal::BufferLayoutDescriptorArray::get",
        ("MTL::BufferLayoutDescriptorArray", "setObject"): "metal::BufferLayoutDescriptorArray::set",
        ("MTL::AttributeDescriptorArray", "object"): "metal::AttributeDescriptorArray::get",
        ("MTL::AttributeDescriptorArray", "setObject"): "metal::AttributeDescriptorArray::set",
        ("MTL::StageInputOutputDescriptor", "reset"): "metal::StageInputOutputDescriptor::reset_safe",
        ("MTL::StageInputOutputDescriptor", "stageInputOutputDescriptor"): "metal::StageInputOutputDescriptor::default_descriptor",
        ("MTL::TensorBufferAttachments", "buffer"): "metal::CheckedTensorBufferAttachments::buffer",
        ("MTL::TensorBufferAttachments", "offset"): "metal::CheckedTensorBufferAttachments::offset",
        ("MTL::TensorBufferAttachments", "setBuffer"): "metal::CheckedTensorBufferAttachments::set_buffer",
        ("MTL::TensorBufferAttachments", "reset"): "metal::CheckedTensorBufferAttachments::reset",
        ("MTL4::CounterHeap", "invalidateCounterRange"): "metal4::TimestampCounterHeap::invalidate_range",
        ("MTL4::CounterHeap", "label"): "metal4::TimestampCounterHeap::label",
        ("MTL4::CounterHeap", "setLabel"): "metal4::TimestampCounterHeap::set_label",
        ("MTL4::CounterHeap", "type"): "metal4::TimestampCounterHeap::heap_type",
        ("MTL::Resource", "isAliasable"): "metal::Resource::is_aliasable",
        ("MTL::Resource", "makeAliasable"): "metal::Resource::make_aliasable",
        ("MTL::Resource", "setOwner"): "metal::Resource::set_owner",
        ("MTL::Resource", "setPurgeableState"): "metal::Resource::set_purgeable_state",
        ("MTL::ResourceViewPool", "baseResourceID"): "metal::ResourceViewPool::base_resource_id",
        ("MTL::ResourceViewPool", "copyResourceViewsFromPool"): "metal::ResourceViewPool::copy_resource_views_from_pool",
        # Command-buffer lifecycle and submission-bound operations.
        ("MTL::CommandBuffer", "encodeSignalEvent"): "metal::CommandBuffer::encode_signal_event",
        ("MTL::CommandBuffer", "encodeWait"): "metal::CommandBuffer::encode_wait",
        ("MTL::CommandBuffer", "enqueue"): "metal::CommandBuffer::enqueue",
        ("MTL::CommandBuffer", "errorOptions"): "metal::CommandBuffer::error_options",
        ("MTL::CommandBuffer", "logs"): "metal::CompletedCommandBuffer::logs",
        ("MTL::CommandBuffer", "useResidencySet"): "metal::CommandBuffer::use_residency_sets",
        ("MTL::CommandBuffer", "useResidencySets"): "metal::CommandBuffer::use_residency_sets",
        ("MTL::CommandBuffer", "waitUntilScheduled"): "metal::SubmittedCommandBuffer::wait_until_scheduled",
        # Render/compute pass descriptors and checked attachment indexing.
        ("MTL::ComputePassDescriptor", "alloc"): "metal::ComputePassDescriptor::new",
        ("MTL::ComputePassDescriptor", "computePassDescriptor"): "metal::ComputePassDescriptor::new",
        ("MTL::ComputePassDescriptor", "dispatchType"): "metal::ComputePassDescriptor::dispatch_type",
        ("MTL::ComputePassDescriptor", "init"): "metal::ComputePassDescriptor::new",
        ("MTL::ComputePassDescriptor", "sampleBufferAttachments"): "metal::ComputePassDescriptor::sample_buffer_attachment",
        ("MTL::ComputePassDescriptor", "setDispatchType"): "metal::ComputePassDescriptor::set_dispatch_type",
        ("MTL::ComputePassSampleBufferAttachmentDescriptorArray", "object"): "metal::ComputePassDescriptor::sample_buffer_attachment",
        ("MTL::ComputePassSampleBufferAttachmentDescriptorArray", "setObject"): "metal::ComputePassDescriptor::set_sample_buffer_attachment",
        ("MTL::RenderPassDescriptor", "colorAttachments"): "metal::RenderPassDescriptor::color_attachment",
        ("MTL::RenderPassDescriptor", "depthAttachment"): "metal::RenderPassDescriptor::depth_attachment",
        ("MTL::RenderPassDescriptor", "rasterizationRateMap"): "metal::RenderPassDescriptor::rasterization_rate_map",
        ("MTL::RenderPassDescriptor", "sampleBufferAttachments"): "metal::RenderPassDescriptor::sample_buffer_attachment",
        ("MTL::RenderPassDescriptor", "setDepthAttachment"): "metal::RenderPassDescriptor::set_depth_attachment",
        ("MTL::RenderPassDescriptor", "setRasterizationRateMap"): "metal::RenderPassDescriptor::set_rasterization_rate_map",
        ("MTL::RenderPassDescriptor", "setStencilAttachment"): "metal::RenderPassDescriptor::set_stencil_attachment",
        ("MTL::RenderPassDescriptor", "stencilAttachment"): "metal::RenderPassDescriptor::stencil_attachment",
        ("MTL::RenderPassColorAttachmentDescriptor", "clearColor"): "metal::RenderPassDescriptor::color_attachment_clear_color",
        ("MTL::RenderPassColorAttachmentDescriptor", "setClearColor"): "metal::RenderPassDescriptor::set_color_attachment_clear_color",
        ("MTL::RenderPassColorAttachmentDescriptorArray", "object"): "metal::RenderPassDescriptor::color_attachment",
        ("MTL::RenderPassColorAttachmentDescriptorArray", "setObject"): "metal::RenderPassDescriptor::set_color_attachment_descriptor",
        ("MTL::RenderPassSampleBufferAttachmentDescriptorArray", "object"): "metal::RenderPassDescriptor::sample_buffer_attachment",
        ("MTL::RenderPassSampleBufferAttachmentDescriptorArray", "setObject"): "metal::RenderPassDescriptor::set_sample_buffer_attachment",
        # Capture owns the Objective-C target and turns begin/end into a scoped guard.
        ("MTL::CaptureManager", "defaultCaptureScope"): "metal::CaptureSession::default_scope",
        ("MTL::CaptureManager", "isCapturing"): "metal::CaptureSession::is_capturing",
        ("MTL::CaptureManager", "setDefaultCaptureScope"): "metal::CaptureSession::set_default_scope",
        ("MTL::CaptureManager", "stopCapture"): "metal::CaptureSession::finish",
        ("MTL::CaptureManager", "supportsDestination"): "metal::CaptureSession::supports_destination",
        ("MTL::CaptureDescriptor", "destination"): "metal::CaptureDescriptor::destination",
        ("MTL::CaptureDescriptor", "outputURL"): "metal::CaptureDescriptor::output_path",
        ("MTL::CaptureDescriptor", "setCaptureObject"): "metal::CaptureDescriptor::set_capture_device",
        ("MTL::CaptureDescriptor", "setDestination"): "metal::CaptureDescriptor::set_destination",
        ("MTL::CaptureDescriptor", "setOutputURL"): "metal::CaptureDescriptor::set_capture_output",
        ("MTL::CaptureScope", "beginScope"): "metal::CaptureScope::with_scope",
        ("MTL::CaptureScope", "endScope"): "metal::CaptureScope::with_scope",
        # Rust-owned shader metadata and selector-gated pipeline helpers.
        ("MTL::Library", "functionNames"): "metal::Library::function_names",
        ("MTL::Function", "functionConstantsDictionary"): "metal::Function::function_constant_names",
        ("MTL::Function", "stageInputAttributes"): "metal::Function::stage_input_attribute_names",
        ("MTL::Function", "vertexAttributes"): "metal::Function::vertex_attribute_names",
        ("MTL::CompileOptions", "floatingPointConversionRoundingMode"): "metal::CompileOptions::floating_point_conversion_rounding_mode",
        ("MTL::CompileOptions", "setFloatingPointConversionRoundingMode"): "metal::CompileOptions::set_floating_point_conversion_rounding_mode",
        ("MTL::RenderPipelineState", "gpuResourceID"): "metal::RenderPipelineState::gpu_resource_id",
        ("MTL::RenderPipelineState", "imageblockMemoryLength"): "metal::RenderPipelineState::imageblock_memory_length",
        ("MTL::RenderPipelineState", "maxTotalThreadgroupsPerMeshGrid"): "metal::RenderPipelineState::max_total_threadgroups_per_mesh_grid",
        ("MTL::RenderPipelineState", "maxTotalThreadsPerMeshThreadgroup"): "metal::RenderPipelineState::max_total_threads_per_mesh_threadgroup",
        ("MTL::RenderPipelineState", "maxTotalThreadsPerObjectThreadgroup"): "metal::RenderPipelineState::max_total_threads_per_object_threadgroup",
        ("MTL::RenderPipelineState", "meshThreadExecutionWidth"): "metal::RenderPipelineState::mesh_thread_execution_width",
        ("MTL::RenderPipelineState", "objectThreadExecutionWidth"): "metal::RenderPipelineState::object_thread_execution_width",
        ("MTL::RenderPipelineState", "reflection"): "metal::RenderPipelineState::reflection",
        ("MTL::ComputePipelineState", "gpuResourceID"): "metal::ComputePipelineState::gpu_resource_id",
        ("MTL::ComputePipelineState", "imageblockMemoryLength"): "metal::ComputePipelineState::imageblock_memory_length",
        ("MTL::ComputePipelineState", "reflection"): "metal::ComputePipelineState::reflection",
        # Texture/resource identity and safe CPU writes.
        ("MTL::TextureDescriptor", "swizzle"): "metal::TextureDescriptor::swizzle",
        ("MTL::TextureDescriptor", "setSwizzle"): "metal::TextureDescriptor::set_swizzle",
        ("MTL::Texture", "gpuResourceID"): "metal::Texture::gpu_resource_id",
        ("MTL::Texture", "iosurface"): "metal::Texture::iosurface",
        ("MTL::Texture", "iosurfacePlane"): "metal::Texture::iosurface_plane",
        ("MTL::Texture", "newRemoteTextureViewForDevice"): "metal::Texture::new_remote_view",
        ("MTL::Texture", "newSharedTextureHandle"): "metal::Texture::new_shared_texture_handle",
        ("MTL::Texture", "remoteStorageTexture"): "metal::Texture::remote_storage_texture",
        ("MTL::Texture", "rootResource"): "metal::Texture::root_resource",
        ("MTL::Texture", "swizzle"): "metal::Texture::swizzle",
        # Rasterization-rate, heap and residency abstractions.
        ("MTL::Heap", "maxAvailableSize"): "metal::Heap::max_available_size",
        ("MTL::Heap", "setPurgeableState"): "metal::Heap::set_purgeable_state",
        ("MTL::RasterizationRateLayerDescriptor", "maxSampleCount"): "metal::RasterizationRateLayerDescriptor::max_sample_count",
        ("MTL::RasterizationRateLayerDescriptor", "sampleCount"): "metal::RasterizationRateLayerDescriptor::sample_count",
        ("MTL::RasterizationRateLayerDescriptor", "setSampleCount"): "metal::RasterizationRateLayerDescriptor::set_sample_count",
        ("MTL::RasterizationRateLayerDescriptor", "horizontalSampleStorage"): "metal::RasterizationRateLayerDescriptor::horizontal_samples",
        ("MTL::RasterizationRateLayerDescriptor", "verticalSampleStorage"): "metal::RasterizationRateLayerDescriptor::vertical_samples",
        ("MTL::RasterizationRateSampleArray", "object"): "metal::RasterizationRateLayerDescriptor::horizontal_samples",
        ("MTL::RasterizationRateSampleArray", "setObject"): "metal::RasterizationRateLayerDescriptor::set_horizontal_sample",
        ("MTL::RasterizationRateLayerArray", "object"): "metal::RasterizationRateMapDescriptor::layer",
        ("MTL::RasterizationRateLayerArray", "setObject"): "metal::RasterizationRateMapDescriptor::set_layer",
        ("MTL::RasterizationRateMapDescriptor", "layer"): "metal::RasterizationRateMapDescriptor::layer",
        ("MTL::RasterizationRateMapDescriptor", "layers"): "metal::RasterizationRateMapDescriptor::layer_vec",
        ("MTL::RasterizationRateMapDescriptor", "screenSize"): "metal::RasterizationRateMapDescriptor::screen_size",
        ("MTL::RasterizationRateMapDescriptor", "setScreenSize"): "metal::RasterizationRateMapDescriptor::set_screen_size",
        ("MTL::RasterizationRateMapDescriptor", "setLayer"): "metal::RasterizationRateMapDescriptor::set_layer",
        ("MTL::RasterizationRateMap", "copyParameterDataToBuffer"): "metal::RasterizationRateMap::copy_parameter_data_to_buffer",
        ("MTL::RasterizationRateMap", "mapPhysicalToScreenCoordinates"): "metal::RasterizationRateMap::map_physical_to_screen_coordinates",
        ("MTL::RasterizationRateMap", "mapScreenToPhysicalCoordinates"): "metal::RasterizationRateMap::map_screen_to_physical_coordinates",
        ("MTL::RasterizationRateMap", "parameterBufferSizeAndAlign"): "metal::RasterizationRateMap::parameter_buffer_size_and_align",
        ("MTL::RasterizationRateMap", "physicalGranularity"): "metal::RasterizationRateMap::physical_granularity",
        ("MTL::RasterizationRateMap", "screenSize"): "metal::RasterizationRateMap::screen_size",
        ("MTL::ResidencySet", "addAllocation"): "metal::ResidencySet::add_allocation",
        ("MTL::ResidencySet", "addAllocations"): "metal::ResidencySet::add_allocations",
        ("MTL::ResidencySet", "allAllocations"): "metal::ResidencySet::allocation_vec",
        ("MTL::ResidencySet", "commit"): "metal::ResidencySet::commit",
        ("MTL::ResidencySet", "containsAllocation"): "metal::ResidencySet::contains_allocation",
        ("MTL::ResidencySet", "endResidency"): "metal::ResidencySet::end_residency",
        ("MTL::ResidencySet", "removeAllAllocations"): "metal::ResidencySet::remove_all_allocations",
        ("MTL::ResidencySet", "removeAllocation"): "metal::ResidencySet::remove_allocation",
        ("MTL::ResidencySet", "removeAllocations"): "metal::ResidencySet::remove_allocations",
        ("MTL::ResidencySet", "requestResidency"): "metal::ResidencySet::request_residency",
    }
)

ACTUAL_METHOD_SIGNATURES: dict[tuple[str, str, str], str] = {}

VALUE_HELPER_SUBSTITUTE_METHODS = {
    ("MTL::PackedFloat3", "PackedFloat3"): "metal::PackedFloat3",
    ("MTL::PackedFloat3", "operator[]"): "metal::PackedFloat3",
    ("MTL::PackedFloat4x3", "PackedFloat4x3"): "metal::PackedFloat4x3",
    ("MTL::PackedFloat4x3", "operator[]"): "metal::PackedFloat4x3",
    ("MTL::PackedFloatQuaternion", "PackedFloatQuaternion"): "metal::PackedFloatQuaternion",
    ("MTL::PackedFloatQuaternion", "operator[]"): "metal::PackedFloatQuaternion",
    ("MTL::AxisAlignedBoundingBox", "AxisAlignedBoundingBox"): "metal::AxisAlignedBoundingBox",
    ("MTL::TextureSwizzleChannels", "TextureSwizzleChannels"): "metal::TextureSwizzleChannels",
    ("MTL::TextureSwizzleChannels", "Default"): "metal::TextureSwizzleChannels",
    ("MTL::TextureSwizzleChannels", "Make"): "metal::TextureSwizzleChannels",
    ("MTL::SamplePosition", "SamplePosition"): "metal::SamplePosition",
    ("MTL::SamplePosition", "Make"): "metal::SamplePosition",
    ("MTL4::BufferRange", "BufferRange"): "metal4::BufferRange",
    ("MTL4::BufferRange", "Make"): "metal4::BufferRange",
}
ACTUAL_METHODS.update(VALUE_HELPER_SUBSTITUTE_METHODS)

ACTUAL_METHODS.update(
    {
        ("MTL::IndirectCommandBuffer", "gpuResourceID"): "metal::IndirectCommandBuffer::gpu_resource_id",
        ("MTL::IndirectCommandBuffer", "indirectComputeCommand"): "metal::IndirectCommandBuffer::with_indirect_compute_command",
        ("MTL::IndirectCommandBuffer", "indirectRenderCommand"): "metal::IndirectCommandBuffer::with_indirect_render_command",
        ("MTL::IndirectCommandBuffer", "reset"): "metal::IndirectCommandBuffer::reset_commands",
        ("MTL4::MeshRenderPipelineDescriptor", "requiredThreadsPerMeshThreadgroup"): "metal4::MeshRenderPipelineDescriptor::required_threads_per_mesh_threadgroup_safe",
        ("MTL4::MeshRenderPipelineDescriptor", "requiredThreadsPerObjectThreadgroup"): "metal4::MeshRenderPipelineDescriptor::required_threads_per_object_threadgroup_safe",
        ("MTL4::MeshRenderPipelineDescriptor", "reset"): "metal4::MeshRenderPipelineDescriptor::reset_safe",
        ("MTL4::MeshRenderPipelineDescriptor", "setRequiredThreadsPerMeshThreadgroup"): "metal4::MeshRenderPipelineDescriptor::set_required_threads_per_mesh_threadgroup_safe",
        ("MTL4::MeshRenderPipelineDescriptor", "setRequiredThreadsPerObjectThreadgroup"): "metal4::MeshRenderPipelineDescriptor::set_required_threads_per_object_threadgroup_safe",
        ("MTL4::MachineLearningPipelineDescriptor", "inputDimensionsAtBufferIndex"): "metal4::MachineLearningPipelineDescriptor::input_dimensions",
        ("MTL4::MachineLearningPipelineDescriptor", "reset"): "metal4::MachineLearningPipelineDescriptor::reset_safe",
        ("MTL4::MachineLearningPipelineReflection", "bindings"): "metal4::MachineLearningPipelineReflection::bindings_vec",
    }
)

ACTUAL_METHOD_SIGNATURES.update(
    {
        ("MTL4::ComputeCommandEncoder", "copyFromTensor", "void copyFromTensor(const MTL::Tensor* sourceTensor, const MTL::TensorExtents* sourceOrigin, const MTL::TensorExtents* sourceDimensions, const MTL::Tensor* destinationTensor, const MTL::TensorExtents* destinationOrigin, const MTL::TensorExtents* destinationDimensions);"): "metal4::RecordingComputeEncoder::copy_tensor",
        ("MTL4::ComputeCommandEncoder", "copyFromTensor", "void copyFromTensor(const MTL::Tensor* sourceTensor, const MTL::TensorExtents* sourceOrigin, const MTL::TensorExtents* sourceDimensions, MTL::TensorPlaneType sourcePlane, const MTL::Tensor* destinationTensor, const MTL::TensorExtents* destinationOrigin, const MTL::TensorExtents* destinationDimensions, MTL::TensorPlaneType destinationPlane);"): "metal4::RecordingComputeEncoder::copy_tensor",
        ("MTL::DepthStencilDescriptor", "deprecated", "[[deprecated( )]] bool depthWriteEnabled() const;"): "metal::DepthStencilDescriptor::depth_write_enabled",
        ("MTL::Function", "newArgumentEncoder", "ArgumentEncoder* newArgumentEncoder(NS::UInteger bufferIndex);"): "metal::Function::new_argument_encoder",
        ("MTL::Function", "newArgumentEncoder", "ArgumentEncoder* newArgumentEncoder(NS::UInteger bufferIndex, const MTL::AutoreleasedArgument* reflection);"): "metal::Function::new_argument_encoder_with_reflection",
        ("MTL::ArgumentEncoder", "constantData", "void* constantData(NS::UInteger index);"): "metal::ArgumentEncoder::with_constant_data",
        ("MTL::IndirectRenderCommand", "drawIndexedPatches", "void drawIndexedPatches(NS::UInteger numberOfPatchControlPoints, NS::UInteger patchStart, NS::UInteger patchCount, const MTL::Buffer* patchIndexBuffer, NS::UInteger patchIndexBufferOffset, const MTL::Buffer* controlPointIndexBuffer, NS::UInteger controlPointIndexBufferOffset, NS::UInteger instanceCount, NS::UInteger baseInstance, const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger instanceStride);"): "metal::IndirectRenderCommandRecording::draw_indexed_patches",
        ("MTL::IndirectRenderCommand", "drawPatches", "void drawPatches(NS::UInteger numberOfPatchControlPoints, NS::UInteger patchStart, NS::UInteger patchCount, const MTL::Buffer* patchIndexBuffer, NS::UInteger patchIndexBufferOffset, NS::UInteger instanceCount, NS::UInteger baseInstance, const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger instanceStride);"): "metal::IndirectRenderCommandRecording::draw_patches",
        ("MTL::Tensor", "getBytes", "void getBytes(void* bytes, const MTL::TensorExtents* strides, const MTL::TensorExtents* sliceOrigin, const MTL::TensorExtents* sliceDimensions);"): "metal::Tensor::read_slice",
        ("MTL::Tensor", "getBytes", "void getBytes(void* bytes, const MTL::TensorExtents* strides, const MTL::TensorExtents* sliceOrigin, const MTL::TensorExtents* sliceDimensions, MTL::TensorPlaneType plane);"): "metal::Tensor::read_plane_slice",
        ("MTL::Tensor", "replaceSliceOrigin", "void replaceSliceOrigin(const MTL::TensorExtents* sliceOrigin, const MTL::TensorExtents* sliceDimensions, const void* bytes, const MTL::TensorExtents* strides);"): "metal::Tensor::write_slice",
        ("MTL::Tensor", "replaceSliceOrigin", "void replaceSliceOrigin(const MTL::TensorExtents* sliceOrigin, const MTL::TensorExtents* sliceDimensions, MTL::TensorPlaneType plane, const void* bytes, const MTL::TensorExtents* strides);"): "metal::Tensor::write_plane_slice",
        ("MTL4::ComputeCommandEncoder", "buildAccelerationStructure", "void buildAccelerationStructure(const MTL::AccelerationStructure* accelerationStructure, const MTL4::AccelerationStructureDescriptor* descriptor, const MTL4::BufferRange scratchBuffer);"): "metal4::RecordingComputeEncoder::build_acceleration_structure",
        ("MTL4::ComputeCommandEncoder", "copyAccelerationStructure", "void copyAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructure* destinationAccelerationStructure);"): "metal4::RecordingComputeEncoder::copy_acceleration_structure",
        ("MTL4::ComputeCommandEncoder", "copyAndCompactAccelerationStructure", "void copyAndCompactAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructure* destinationAccelerationStructure);"): "metal4::RecordingComputeEncoder::copy_and_compact_acceleration_structure",
        ("MTL4::ComputeCommandEncoder", "refitAccelerationStructure", "void refitAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL4::AccelerationStructureDescriptor* descriptor, const MTL::AccelerationStructure* destinationAccelerationStructure, const MTL4::BufferRange scratchBuffer);"): "metal4::RecordingComputeEncoder::refit_acceleration_structure",
        ("MTL4::ComputeCommandEncoder", "refitAccelerationStructure", "void refitAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL4::AccelerationStructureDescriptor* descriptor, const MTL::AccelerationStructure* destinationAccelerationStructure, const MTL4::BufferRange scratchBuffer, MTL::AccelerationStructureRefitOptions options);"): "metal4::RecordingComputeEncoder::refit_acceleration_structure",
        ("MTL4::ComputeCommandEncoder", "writeCompactedAccelerationStructureSize", "void writeCompactedAccelerationStructureSize(const MTL::AccelerationStructure* accelerationStructure, const MTL4::BufferRange buffer);"): "metal4::RecordingComputeEncoder::write_compacted_acceleration_structure_size",
        ("MTL::TextureViewPool", "setTextureView", "ResourceID setTextureView(const MTL::Texture* texture, NS::UInteger index);"): "metal::TextureViewPool::set_texture_view",
        ("MTL::TextureViewPool", "setTextureView", "ResourceID setTextureView(const MTL::Texture* texture, const MTL::TextureViewDescriptor* descriptor, NS::UInteger index);"): "metal::TextureViewPool::set_texture_view_with_descriptor",
        ("MTL::TextureViewPool", "setTextureViewFromBuffer", "ResourceID setTextureViewFromBuffer(const MTL::Buffer* buffer, const MTL::TextureDescriptor* descriptor, NS::UInteger offset, NS::UInteger bytesPerRow, NS::UInteger index);"): "metal::TextureViewPool::set_texture_view_from_buffer",
        ("MTL::VertexAttribute", "deprecated", "[[deprecated( )]] bool active() const;"): "metal::VertexAttribute::is_active",
        ("MTL::VertexAttribute", "deprecated", "[[deprecated( )]] bool patchControlPointData() const;"): "metal::VertexAttribute::is_patch_control_point_data",
        ("MTL::VertexAttribute", "deprecated", "[[deprecated( )]] bool patchData() const;"): "metal::VertexAttribute::is_patch_data",
        ("MTL::Attribute", "deprecated", "[[deprecated( )]] bool active() const;"): "metal::Attribute::is_active",
        ("MTL::Attribute", "deprecated", "[[deprecated( )]] bool patchControlPointData() const;"): "metal::Attribute::is_patch_control_point_data",
        ("MTL::Attribute", "deprecated", "[[deprecated( )]] bool patchData() const;"): "metal::Attribute::is_patch_data",
        ("MTL4::ComputeCommandEncoder", "copyFromBuffer", "void copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin);"): "metal4::RecordingComputeEncoder::copy_buffer_to_texture",
        ("MTL4::ComputeCommandEncoder", "copyFromBuffer", "void copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin, MTL::BlitOption options);"): "metal4::RecordingComputeEncoder::copy_buffer_to_texture",
        ("MTL4::ComputeCommandEncoder", "copyFromTexture", "void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin);"): "metal4::RecordingComputeEncoder::copy_texture_region",
        ("MTL4::ComputeCommandEncoder", "copyFromTexture", "void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage);"): "metal4::RecordingComputeEncoder::copy_texture_to_buffer",
        ("MTL4::ComputeCommandEncoder", "copyFromTexture", "void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage, MTL::BlitOption options);"): "metal4::RecordingComputeEncoder::copy_texture_to_buffer",
        ("MTL::LogState", "addLogHandler", "void addLogHandler(void (^block)(NS::String*, NS::String*, MTL::LogLevel, NS::String*));"): "metal::LogState::add_log_handler",
        ("MTL::LogState", "addLogHandler", "void addLogHandler(const MTL::LogHandlerFunction& handler);"): "metal::LogState::add_log_handler",
        ("MTL4::CommitOptions", "addFeedbackHandler", "void addFeedbackHandler(const MTL4::CommitFeedbackHandler block);"): "metal4::SubmittedCommandBuffers::wait",
        ("MTL4::CommitOptions", "addFeedbackHandler", "void addFeedbackHandler(const MTL4::CommitFeedbackHandlerFunction& function);"): "metal4::SubmittedCommandBuffers::wait",
        ("MTL::Device", "newLibrary", "Library* newLibrary(const dispatch_data_t data, NS::Error** error);"): "metal::Device::new_library_from_bytes",
        ("MTL::Device", "newDefaultLibrary", "Library* newDefaultLibrary(const NS::Bundle* bundle, NS::Error** error);"): "metal::Device::new_default_library_from_bundle",
        ("MTL::Device", "newTexture", "Texture* newTexture(const MTL::TextureDescriptor* descriptor, const IOSurfaceRef iosurface, NS::UInteger plane);"): "metal::Device::new_texture_from_iosurface",
        ("MTL::Library", "newFunction", "void newFunction(const NS::String* name, const MTL::FunctionConstantValues* constantValues, void (^completionHandler)(MTL::Function*, NS::Error*));"): "metal::Library::specialized_function_async",
        ("MTL::Library", "newFunction", "void newFunction(const MTL::FunctionDescriptor* descriptor, void (^completionHandler)(MTL::Function*, NS::Error*));"): "metal::Library::function_with_descriptor_async",
        ("MTL::Library", "newFunction", "void newFunction(const NS::String* pFunctionName, const MTL::FunctionConstantValues* pConstantValues, const MTL::FunctionCompletionHandlerFunction& completionHandler);"): "metal::Library::specialized_function_async",
        ("MTL::Library", "newFunction", "void newFunction(const MTL::FunctionDescriptor* pDescriptor, const MTL::FunctionCompletionHandlerFunction& completionHandler);"): "metal::Library::function_with_descriptor_async",
        ("MTL::Library", "newIntersectionFunction", "void newIntersectionFunction(const MTL::IntersectionFunctionDescriptor* descriptor, void (^completionHandler)(MTL::Function*, NS::Error*));"): "metal::Library::intersection_function_with_descriptor_async",
        ("MTL::Library", "newIntersectionFunction", "void newIntersectionFunction(const MTL::IntersectionFunctionDescriptor* pDescriptor, const MTL::FunctionCompletionHandlerFunction& completionHandler);"): "metal::Library::intersection_function_with_descriptor_async",
        ("MTL::FunctionConstantValues", "setConstantValue", "void setConstantValue(const void* value, MTL::DataType type, NS::UInteger index);"): "metal::FunctionConstantValues::set_constant_at_index",
        ("MTL::FunctionConstantValues", "setConstantValue", "void setConstantValue(const void* value, MTL::DataType type, const NS::String* name);"): "metal::FunctionConstantValues::set_constant_named",
        ("MTL::FunctionConstantValues", "setConstantValues", "void setConstantValues(const void* values, MTL::DataType type, NS::Range range);"): "metal::FunctionConstantValues::set_constants",
        ("MTL::ComputePipelineState", "functionHandle", "FunctionHandle* functionHandle(const MTL4::BinaryFunction* function);"): "metal::ComputePipelineState::function_handle_for_binary_function",
        ("MTL::ComputePipelineState", "functionHandle", "FunctionHandle* functionHandle(const MTL::Function* function);"): "metal::ComputePipelineState::function_handle_for_function",
        ("MTL::RenderPipelineState", "functionHandle", "FunctionHandle* functionHandle(const MTL4::BinaryFunction* function, MTL::RenderStages stage);"): "metal::RenderPipelineState::function_handle_for_binary_function",
        ("MTL::RenderPipelineState", "functionHandle", "FunctionHandle* functionHandle(const MTL::Function* function, MTL::RenderStages stage);"): "metal::RenderPipelineState::function_handle_for_function",
        ("MTL4::RenderCommandEncoder", "drawIndexedPrimitives", "void drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, MTL::GPUAddress indexBuffer, NS::UInteger indexBufferLength);"): "metal4::RecordingRenderEncoder::draw_indexed_primitives",
        ("MTL4::RenderCommandEncoder", "drawIndexedPrimitives", "void drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, MTL::GPUAddress indexBuffer, NS::UInteger indexBufferLength, NS::UInteger instanceCount);"): "metal4::RecordingRenderEncoder::draw_indexed_primitives_instanced",
        ("MTL4::RenderCommandEncoder", "drawIndexedPrimitives", "void drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, MTL::GPUAddress indexBuffer, NS::UInteger indexBufferLength, NS::UInteger instanceCount, NS::Integer baseVertex, NS::UInteger baseInstance);"): "metal4::RecordingRenderEncoder::draw_indexed_primitives_base",
        ("MTL4::RenderCommandEncoder", "drawIndexedPrimitives", "void drawIndexedPrimitives(MTL::PrimitiveType primitiveType, MTL::IndexType indexType, MTL::GPUAddress indexBuffer, NS::UInteger indexBufferLength, MTL::GPUAddress indirectBuffer);"): "metal4::RecordingRenderEncoder::draw_indexed_primitives_indirect",
        ("MTL4::RenderCommandEncoder", "drawMeshThreadgroups", "void drawMeshThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerObjectThreadgroup, MTL::Size threadsPerMeshThreadgroup);"): "metal4::RecordingRenderEncoder::draw_mesh_threadgroups",
        ("MTL4::RenderCommandEncoder", "drawMeshThreadgroups", "void drawMeshThreadgroups(MTL::GPUAddress indirectBuffer, MTL::Size threadsPerObjectThreadgroup, MTL::Size threadsPerMeshThreadgroup);"): "metal4::RecordingRenderEncoder::draw_mesh_threadgroups_indirect",
        ("MTL4::RenderCommandEncoder", "executeCommandsInBuffer", "void executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range executionRange);"): "metal4::RecordingRenderEncoder::execute_commands",
        ("MTL4::RenderCommandEncoder", "executeCommandsInBuffer", "void executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, MTL::GPUAddress indirectRangeBuffer);"): "metal4::RecordingRenderEncoder::execute_commands_indirect",
        ("MTL4::ComputeCommandEncoder", "copyFromBuffer", "void copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger size);"): "metal4::RecordingComputeEncoder::copy_buffer",
        ("MTL4::ComputeCommandEncoder", "copyFromTexture", "void copyFromTexture(const MTL::Texture* sourceTexture, const MTL::Texture* destinationTexture);"): "metal4::RecordingComputeEncoder::copy_texture",
        ("MTL4::ComputeCommandEncoder", "copyFromTexture", "void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, NS::UInteger sliceCount, NS::UInteger levelCount);"): "metal4::RecordingComputeEncoder::copy_texture_levels",
        ("MTL4::ComputeCommandEncoder", "dispatchThreadgroups", "void dispatchThreadgroups(MTL::GPUAddress indirectBuffer, MTL::Size threadsPerThreadgroup);"): "metal4::RecordingComputeEncoder::dispatch_threadgroups_indirect",
        ("MTL4::ComputeCommandEncoder", "dispatchThreads", "void dispatchThreads(MTL::GPUAddress indirectBuffer);"): "metal4::RecordingComputeEncoder::dispatch_threads_indirect",
        ("MTL4::ComputeCommandEncoder", "executeCommandsInBuffer", "void executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range executionRange);"): "metal4::RecordingComputeEncoder::execute_commands",
        ("MTL4::ComputeCommandEncoder", "executeCommandsInBuffer", "void executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandbuffer, MTL::GPUAddress indirectRangeBuffer);"): "metal4::RecordingComputeEncoder::execute_commands_indirect",
        ("MTL4::ComputeCommandEncoder", "optimizeContentsForCPUAccess", "void optimizeContentsForCPUAccess(const MTL::Texture* texture);"): "metal4::RecordingComputeEncoder::optimize_texture_for_cpu",
        ("MTL4::ComputeCommandEncoder", "optimizeContentsForCPUAccess", "void optimizeContentsForCPUAccess(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level);"): "metal4::RecordingComputeEncoder::optimize_texture_level_for_cpu",
        ("MTL4::ComputeCommandEncoder", "optimizeContentsForGPUAccess", "void optimizeContentsForGPUAccess(const MTL::Texture* texture);"): "metal4::RecordingComputeEncoder::optimize_texture_for_gpu",
        ("MTL4::ComputeCommandEncoder", "optimizeContentsForGPUAccess", "void optimizeContentsForGPUAccess(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level);"): "metal4::RecordingComputeEncoder::optimize_texture_level_for_gpu",
        ("MTL::CaptureManager", "newCaptureScope", "CaptureScope* newCaptureScope(const MTL4::CommandQueue* commandQueue);"): "metal::CaptureSession::new_scope_for_mtl4_command_queue",
        ("MTL::Device", "functionHandle", "FunctionHandle* functionHandle(const MTL4::BinaryFunction* function);"): "metal::Device::function_handle_from_binary",
        ("MTL::Device", "newArchive", "MTL4::Archive* newArchive(const NS::URL* url, NS::Error** error);"): "metal::Device::new_mtl4_archive_from_path",
        ("MTL::Device", "newCommandAllocator", "MTL4::CommandAllocator* newCommandAllocator();"): "metal::Device::new_mtl4_command_allocator",
        ("MTL::Device", "newCommandAllocator", "MTL4::CommandAllocator* newCommandAllocator(const MTL4::CommandAllocatorDescriptor* descriptor, NS::Error** error);"): "metal::Device::new_mtl4_command_allocator_from_descriptor",
        ("MTL::Device", "newCompiler", "MTL4::Compiler* newCompiler(const MTL4::CompilerDescriptor* descriptor, NS::Error** error);"): "metal::Device::new_mtl4_compiler",
        ("MTL::Device", "newMTL4CommandQueue", "MTL4::CommandQueue* newMTL4CommandQueue(const MTL4::CommandQueueDescriptor* descriptor, NS::Error** error);"): "metal::Device::new_mtl4_command_queue_from_descriptor",
        ("MTL::Device", "newPipelineDataSetSerializer", "MTL4::PipelineDataSetSerializer* newPipelineDataSetSerializer(const MTL4::PipelineDataSetSerializerDescriptor* descriptor);"): "metal::Device::new_pipeline_data_set_serializer",
        ("MTL::Device", "newResidencySet", "ResidencySet* newResidencySet(const MTL::ResidencySetDescriptor* desc, NS::Error** error);"): "metal::Device::new_residency_set",
        ("MTL::Device", "newTensor", "Tensor* newTensor(const MTL::TensorDescriptor* descriptor, NS::Error** error);"): "metal::Device::new_tensor",
        ("MTL::Device", "newTensor", "Tensor* newTensor(const MTL::TensorDescriptor* descriptor, const MTL::TensorBufferAttachments* attachments, NS::Error** error);"): "metal::Device::new_tensor_with_attachments",
        ("MTL::Device", "newTextureViewPool", "TextureViewPool* newTextureViewPool(const MTL::ResourceViewPoolDescriptor* descriptor, NS::Error** error);"): "metal::Device::new_texture_view_pool",
        ("MTL::Device", "sizeOfCounterHeapEntry", "NS::UInteger sizeOfCounterHeapEntry(MTL4::CounterHeapType type);"): "metal::Device::size_of_counter_heap_entry",
        ("MTL::Device", "tensorSizeAndAlign", "SizeAndAlign tensorSizeAndAlign(const MTL::TensorDescriptor* descriptor);"): "metal::Device::tensor_size_and_align",
        ("MTL::PackedFloat3", "PackedFloat3", "PackedFloat3();"): "metal::PackedFloat3::default",
        ("MTL::PackedFloat3", "PackedFloat3", "PackedFloat3(float x, float y, float z);"): "metal::PackedFloat3::from_components",
        ("MTL::PackedFloat3", "operator[]", "float& operator[](int idx);"): "metal::PackedFloat3::index_mut",
        ("MTL::PackedFloat3", "operator[]", "float operator[](int idx) const;"): "metal::PackedFloat3::index",
        ("MTL::PackedFloat4x3", "PackedFloat4x3", "PackedFloat4x3();"): "metal::PackedFloat4x3::default",
        ("MTL::PackedFloat4x3", "PackedFloat4x3", "PackedFloat4x3(const PackedFloat3& col0, const PackedFloat3& col1, const PackedFloat3& col2, const PackedFloat3& col3);"): "metal::PackedFloat4x3::new",
        ("MTL::PackedFloat4x3", "operator[]", "PackedFloat3& operator[](int idx);"): "metal::PackedFloat4x3::index_mut",
        ("MTL::PackedFloat4x3", "operator[]", "const PackedFloat3& operator[](int idx) const;"): "metal::PackedFloat4x3::index",
        ("MTL::PackedFloatQuaternion", "PackedFloatQuaternion", "PackedFloatQuaternion();"): "metal::PackedFloatQuaternion::default",
        ("MTL::PackedFloatQuaternion", "PackedFloatQuaternion", "PackedFloatQuaternion(float x, float y, float z, float w);"): "metal::PackedFloatQuaternion::from_components",
        ("MTL::PackedFloatQuaternion", "operator[]", "float& operator[](int idx);"): "metal::PackedFloatQuaternion::index_mut",
        ("MTL::PackedFloatQuaternion", "operator[]", "const float& operator[](int idx) const;"): "metal::PackedFloatQuaternion::index",
        ("MTL::BlitCommandEncoder", "copyFromBuffer", "void copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin, MTL::BlitOption options);"): "metal::BlitCommandEncoder::copy_buffer_to_texture_with_options",
        ("MTL::BlitCommandEncoder", "copyFromTensor", "void copyFromTensor(const MTL::Tensor* sourceTensor, const MTL::TensorExtents* sourceOrigin, const MTL::TensorExtents* sourceDimensions, const MTL::Tensor* destinationTensor, const MTL::TensorExtents* destinationOrigin, const MTL::TensorExtents* destinationDimensions);"): "metal::BlitCommandEncoder::copy_tensor",
        ("MTL::BlitCommandEncoder", "copyFromTensor", "void copyFromTensor(const MTL::Tensor* sourceTensor, const MTL::TensorExtents* sourceOrigin, const MTL::TensorExtents* sourceDimensions, MTL::TensorPlaneType sourcePlane, const MTL::Tensor* destinationTensor, const MTL::TensorExtents* destinationOrigin, const MTL::TensorExtents* destinationDimensions, MTL::TensorPlaneType destinationPlane);"): "metal::BlitCommandEncoder::copy_tensor_plane",
        ("MTL::BlitCommandEncoder", "copyFromTexture", "void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage, MTL::BlitOption options);"): "metal::BlitCommandEncoder::copy_texture_to_buffer_with_options",
        ("MTL::BlitCommandEncoder", "getTextureAccessCounters", "void getTextureAccessCounters(const MTL::Texture* texture, MTL::Region region, NS::UInteger mipLevel, NS::UInteger slice, bool resetCounters, const MTL::Buffer* countersBuffer, NS::UInteger countersBufferOffset);"): "metal::BlitCommandEncoder::read_texture_access_counters",
        ("MTL::BlitCommandEncoder", "resolveCounters", "void resolveCounters(const MTL::CounterSampleBuffer* sampleBuffer, NS::Range range, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset);"): "metal::BlitCommandEncoder::read_counters",
        ("MTL::BlitCommandEncoder", "synchronizeResource", "void synchronizeResource(const MTL::Resource* resource);"): "metal::BlitCommandEncoder::synchronize_buffer",
        (
            "MTL4::MachineLearningPipelineDescriptor",
            "setInputDimensions",
            "void setInputDimensions(const MTL::TensorExtents* dimensions, NS::Integer bufferIndex);",
        ): "metal4::MachineLearningPipelineDescriptor::set_input_dimensions",
        (
            "MTL4::MachineLearningPipelineDescriptor",
            "setInputDimensions",
            "void setInputDimensions(const NS::Array* dimensions, NS::Range range);",
        ): "metal4::MachineLearningPipelineDescriptor::set_input_dimensions_slice",
    }
)

PIPELINE_DESCRIPTOR_METHODS = {
    "MTL::ComputePipelineReflection": {
        "arguments": "arguments_vec",
        "bindings": "bindings_vec",
    },
    "MTL::ComputePipelineDescriptor": {
        "binaryArchives": "binary_archives_vec",
        "insertLibraries": "insert_libraries_vec",
        "preloadedLibraries": "preloaded_libraries_vec",
        "requiredThreadsPerThreadgroup": "required_threads_per_threadgroup_safe",
        "reset": "reset_safe",
        "setBinaryArchives": "set_binary_archives_slice",
        "setInsertLibraries": "set_insert_libraries_slice",
        "setPreloadedLibraries": "set_preloaded_libraries_slice",
        "setRequiredThreadsPerThreadgroup": "set_required_threads_per_threadgroup_safe",
    },
    "MTL::LogicalToPhysicalColorAttachmentMap": {
        "getPhysicalIndex": "physical_index",
        "reset": "reset_safe",
        "setPhysicalIndex": "set_physical_index",
    },
    "MTL::RenderPipelineReflection": {
        "fragmentArguments": "fragment_arguments_vec",
        "fragmentBindings": "fragment_bindings_vec",
        "meshBindings": "mesh_bindings_vec",
        "objectBindings": "object_bindings_vec",
        "tileArguments": "tile_arguments_vec",
        "tileBindings": "tile_bindings_vec",
        "vertexArguments": "vertex_arguments_vec",
        "vertexBindings": "vertex_bindings_vec",
    },
    "MTL::RenderPipelineDescriptor": {
        "binaryArchives": "binary_archives_vec",
        "colorAttachments": "color_attachments_safe",
        "fragmentBuffers": "fragment_buffers_safe",
        "fragmentLinkedFunctions": "fragment_linked_functions_safe",
        "fragmentPreloadedLibraries": "fragment_preloaded_libraries_vec",
        "setBinaryArchives": "set_binary_archives_slice",
        "setFragmentLinkedFunctions": "set_fragment_linked_functions_safe",
        "setFragmentPreloadedLibraries": "set_fragment_preloaded_libraries_slice",
        "setVertexDescriptor": "set_vertex_descriptor_safe",
        "setVertexLinkedFunctions": "set_vertex_linked_functions_safe",
        "setVertexPreloadedLibraries": "set_vertex_preloaded_libraries_slice",
        "vertexBuffers": "vertex_buffers_safe",
        "vertexDescriptor": "vertex_descriptor_safe",
        "vertexLinkedFunctions": "vertex_linked_functions_safe",
        "vertexPreloadedLibraries": "vertex_preloaded_libraries_vec",
    },
    "MTL::RenderPipelineFunctionsDescriptor": {
        "fragmentAdditionalBinaryFunctions": "fragment_additional_binary_functions_vec",
        "setFragmentAdditionalBinaryFunctions": "set_fragment_additional_binary_functions_slice",
        "setTileAdditionalBinaryFunctions": "set_tile_additional_binary_functions_slice",
        "setVertexAdditionalBinaryFunctions": "set_vertex_additional_binary_functions_slice",
        "tileAdditionalBinaryFunctions": "tile_additional_binary_functions_vec",
        "vertexAdditionalBinaryFunctions": "vertex_additional_binary_functions_vec",
    },
    "MTL::RenderPipelineColorAttachmentDescriptorArray": {"object": "get", "setObject": "set"},
    "MTL::TileRenderPipelineColorAttachmentDescriptorArray": {"object": "get", "setObject": "set"},
    "MTL::TileRenderPipelineDescriptor": {
        "binaryArchives": "binary_archives_vec",
        "preloadedLibraries": "preloaded_libraries_vec",
        "requiredThreadsPerThreadgroup": "required_threads_per_threadgroup_safe",
        "reset": "reset_safe",
        "setBinaryArchives": "set_binary_archives_slice",
        "setPreloadedLibraries": "set_preloaded_libraries_slice",
        "setRequiredThreadsPerThreadgroup": "set_required_threads_per_threadgroup_safe",
    },
    "MTL::MeshRenderPipelineDescriptor": {
        "binaryArchives": "binary_archives_vec",
        "requiredThreadsPerMeshThreadgroup": "required_threads_per_mesh_threadgroup_safe",
        "requiredThreadsPerObjectThreadgroup": "required_threads_per_object_threadgroup_safe",
        "reset": "reset_safe",
        "setBinaryArchives": "set_binary_archives_slice",
        "setRequiredThreadsPerMeshThreadgroup": "set_required_threads_per_mesh_threadgroup_safe",
        "setRequiredThreadsPerObjectThreadgroup": "set_required_threads_per_object_threadgroup_safe",
    },
    "MTL::LinkedFunctions": {
        "binaryFunctions": "binary_functions_vec",
        "functions": "functions_vec",
        "groups": "groups_map",
        "setBinaryFunctions": "set_binary_functions_slice",
        "setFunctions": "set_functions_slice",
        "setGroups": "set_groups_map",
    },
}

for _parent, _methods in PIPELINE_DESCRIPTOR_METHODS.items():
    _rust_parent = _parent.rsplit("::", 1)[-1]
    for _cpp_name, _rust_name in _methods.items():
        ACTUAL_METHODS[(_parent, _cpp_name)] = f"metal::{_rust_parent}::{_rust_name}"

ACTUAL_METHOD_SIGNATURES.update(
    {
        ("MTL::RenderPipelineColorAttachmentDescriptor", "deprecated", "[[deprecated( )]] bool blendingEnabled() const;"): "metal::RenderPipelineColorAttachmentDescriptor::is_blending_enabled",
        ("MTL::MeshRenderPipelineDescriptor", "deprecated", "[[deprecated( )]] bool alphaToCoverageEnabled() const;"): "metal::MeshRenderPipelineDescriptor::is_alpha_to_coverage_enabled",
        ("MTL::MeshRenderPipelineDescriptor", "deprecated", "[[deprecated( )]] bool alphaToOneEnabled() const;"): "metal::MeshRenderPipelineDescriptor::is_alpha_to_one_enabled",
        ("MTL::MeshRenderPipelineDescriptor", "deprecated", "[[deprecated( )]] bool rasterizationEnabled() const;"): "metal::MeshRenderPipelineDescriptor::is_rasterization_enabled",
        ("MTL4::MeshRenderPipelineDescriptor", "deprecated", "[[deprecated( )]] bool rasterizationEnabled() const;"): "metal4::MeshRenderPipelineDescriptor::is_rasterization_enabled",
        ("MTL4::RenderPipelineDescriptor", "deprecated", "[[deprecated( )]] bool rasterizationEnabled() const;"): "metal4::RenderPipelineDescriptor::is_rasterization_enabled",
    }
)

# Device pipeline and library overloads converge on owned reflection tuples and
# panic-isolated Rust callbacks. Exact signatures keep unrelated overloads out.
ACTUAL_METHOD_SIGNATURES.update(
    {
        ("MTL::Device", "newComputePipelineState", "ComputePipelineState* newComputePipelineState(const MTL::Function* computeFunction, MTL::PipelineOption options, const MTL::AutoreleasedComputePipelineReflection* reflection, NS::Error** error);"): "metal::Device::new_compute_pipeline_with_reflection",
        ("MTL::Device", "newComputePipelineState", "void newComputePipelineState(const MTL::Function* computeFunction, const MTL::NewComputePipelineStateCompletionHandler completionHandler);"): "metal::Device::new_compute_pipeline_async",
        ("MTL::Device", "newComputePipelineState", "void newComputePipelineState(const MTL::Function* computeFunction, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandler completionHandler);"): "metal::Device::new_compute_pipeline_with_reflection_async",
        ("MTL::Device", "newComputePipelineState", "ComputePipelineState* newComputePipelineState(const MTL::ComputePipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedComputePipelineReflection* reflection, NS::Error** error);"): "metal::Device::new_compute_pipeline_from_descriptor",
        ("MTL::Device", "newComputePipelineState", "void newComputePipelineState(const MTL::ComputePipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandler completionHandler);"): "metal::Device::new_compute_pipeline_from_descriptor_async",
        ("MTL::Device", "newComputePipelineState", "void newComputePipelineState(const MTL::Function* pFunction, const MTL::NewComputePipelineStateCompletionHandlerFunction& completionHandler);"): "metal::Device::new_compute_pipeline_async",
        ("MTL::Device", "newComputePipelineState", "void newComputePipelineState(const MTL::Function* pFunction, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandlerFunction& completionHandler);"): "metal::Device::new_compute_pipeline_with_reflection_async",
        ("MTL::Device", "newComputePipelineState", "void newComputePipelineState(const MTL::ComputePipelineDescriptor* pDescriptor, MTL::PipelineOption options, const MTL::NewComputePipelineStateWithReflectionCompletionHandlerFunction& completionHandler);"): "metal::Device::new_compute_pipeline_from_descriptor_async",
        ("MTL::Device", "newRenderPipelineState", "RenderPipelineState* newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error);"): "metal::Device::new_render_pipeline_with_reflection",
        ("MTL::Device", "newRenderPipelineState", "void newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, const MTL::NewRenderPipelineStateCompletionHandler completionHandler);"): "metal::Device::new_render_pipeline_async",
        ("MTL::Device", "newRenderPipelineState", "void newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler);"): "metal::Device::new_render_pipeline_with_reflection_async",
        ("MTL::Device", "newRenderPipelineState", "RenderPipelineState* newRenderPipelineState(const MTL::TileRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error);"): "metal::Device::new_tile_render_pipeline_with_reflection",
        ("MTL::Device", "newRenderPipelineState", "void newRenderPipelineState(const MTL::TileRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler);"): "metal::Device::new_tile_render_pipeline_with_reflection_async",
        ("MTL::Device", "newRenderPipelineState", "RenderPipelineState* newRenderPipelineState(const MTL::MeshRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::AutoreleasedRenderPipelineReflection* reflection, NS::Error** error);"): "metal::Device::new_mesh_render_pipeline_with_reflection",
        ("MTL::Device", "newRenderPipelineState", "void newRenderPipelineState(const MTL::MeshRenderPipelineDescriptor* descriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandler completionHandler);"): "metal::Device::new_mesh_render_pipeline_with_reflection_async",
        ("MTL::Device", "newRenderPipelineState", "void newRenderPipelineState(const MTL::RenderPipelineDescriptor* pDescriptor, const MTL::NewRenderPipelineStateCompletionHandlerFunction& completionHandler);"): "metal::Device::new_render_pipeline_async",
        ("MTL::Device", "newRenderPipelineState", "void newRenderPipelineState(const MTL::RenderPipelineDescriptor* pDescriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandlerFunction& completionHandler);"): "metal::Device::new_render_pipeline_with_reflection_async",
        ("MTL::Device", "newRenderPipelineState", "void newRenderPipelineState(const MTL::TileRenderPipelineDescriptor* pDescriptor, MTL::PipelineOption options, const MTL::NewRenderPipelineStateWithReflectionCompletionHandlerFunction& completionHandler);"): "metal::Device::new_tile_render_pipeline_with_reflection_async",
        ("MTL::Device", "newLibrary", "Library* newLibrary(const NS::String* filepath, NS::Error** error);"): "metal::Device::new_library_from_path",
        ("MTL::Device", "newLibrary", "Library* newLibrary(const NS::URL* url, NS::Error** error);"): "metal::Device::new_library_from_path",
        ("MTL::Device", "newLibrary", "void newLibrary(const NS::String* source, const MTL::CompileOptions* options, const MTL::NewLibraryCompletionHandler completionHandler);"): "metal::Device::new_library_from_source_async",
        ("MTL::Device", "newLibrary", "Library* newLibrary(const MTL::StitchedLibraryDescriptor* descriptor, NS::Error** error);"): "metal::Device::new_stitched_library",
        ("MTL::Device", "newLibrary", "void newLibrary(const MTL::StitchedLibraryDescriptor* descriptor, const MTL::NewLibraryCompletionHandler completionHandler);"): "metal::Device::new_stitched_library_async",
        ("MTL::Device", "newLibrary", "void newLibrary(const NS::String* pSource, const MTL::CompileOptions* pOptions, const MTL::NewLibraryCompletionHandlerFunction& completionHandler);"): "metal::Device::new_library_from_source_async",
        ("MTL::Device", "newLibrary", "void newLibrary(const MTL::StitchedLibraryDescriptor* pDescriptor, const MTL::NewLibraryCompletionHandlerFunction& completionHandler);"): "metal::Device::new_stitched_library_async",
        ("MTL::Device", "newDynamicLibrary", "DynamicLibrary* newDynamicLibrary(const NS::URL* url, NS::Error** error);"): "metal::Device::new_dynamic_library_from_path",
        ("MTL::Device", "newLogState", "LogState* newLogState(const MTL::LogStateDescriptor* descriptor, NS::Error** error);"): "metal::Device::new_log_state",
        ("MTL::Device", "newCounterHeap", "MTL4::CounterHeap* newCounterHeap(const MTL4::CounterHeapDescriptor* descriptor, NS::Error** error);"): "metal::Device::new_timestamp_counter_heap",
        ("MTL::Device", "newBuffer", "Buffer* newBuffer(const void* pointer, NS::UInteger length, MTL::ResourceOptions options, void (^deallocator)(void*, NS::UInteger));"): "metal::Device::new_buffer_with_bytes",
    }
)

# Metal 4 archive lookup and argument-table bindings are selector gated.  The
# argument-table facade deliberately accepts typed resources instead of raw
# GPU addresses or ResourceID values.
ACTUAL_METHOD_SIGNATURES.update(
    {
        (
            "MTL::Device",
            "newArgumentTable",
            "MTL4::ArgumentTable* newArgumentTable(const MTL4::ArgumentTableDescriptor* descriptor, NS::Error** error);",
        ): "metal::Device::new_mtl4_argument_table",
        (
            "MTL4::Archive",
            "newBinaryFunction",
            "BinaryFunction* newBinaryFunction(const MTL4::BinaryFunctionDescriptor* descriptor, NS::Error** error);",
        ): "metal4::Archive::new_binary_function",
        (
            "MTL4::Archive",
            "newComputePipelineState",
            "MTL::ComputePipelineState* newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, NS::Error** error);",
        ): "metal4::Archive::new_compute_pipeline_state",
        (
            "MTL4::Archive",
            "newComputePipelineState",
            "MTL::ComputePipelineState* newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::PipelineStageDynamicLinkingDescriptor* dynamicLinkingDescriptor, NS::Error** error);",
        ): "metal4::Archive::new_compute_pipeline_state",
        (
            "MTL4::Archive",
            "newRenderPipelineState",
            "MTL::RenderPipelineState* newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, NS::Error** error);",
        ): "metal4::Archive::new_render_pipeline_state",
        (
            "MTL4::Archive",
            "newRenderPipelineState",
            "MTL::RenderPipelineState* newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::RenderPipelineDynamicLinkingDescriptor* dynamicLinkingDescriptor, NS::Error** error);",
        ): "metal4::Archive::new_render_pipeline_state",
        (
            "MTL4::ArgumentTable",
            "setAddress",
            "void setAddress(MTL::GPUAddress gpuAddress, NS::UInteger bindingIndex);",
        ): "metal4::ArgumentTable::set_buffer",
        (
            "MTL4::ArgumentTable",
            "setAddress",
            "void setAddress(MTL::GPUAddress gpuAddress, NS::UInteger stride, NS::UInteger bindingIndex);",
        ): "metal4::ArgumentTable::set_buffer_with_stride",
        (
            "MTL4::ArgumentTable",
            "setResource",
            "void setResource(MTL::ResourceID resourceID, NS::UInteger bindingIndex);",
        ): "metal4::ArgumentTable::set_resource",
        (
            "MTL4::ArgumentTable",
            "setSamplerState",
            "void setSamplerState(MTL::ResourceID resourceID, NS::UInteger bindingIndex);",
        ): "metal4::ArgumentTable::set_sampler_state",
        (
            "MTL4::ArgumentTable",
            "setTexture",
            "void setTexture(MTL::ResourceID resourceID, NS::UInteger bindingIndex);",
        ): "metal4::ArgumentTable::set_texture",
    }
)

ACTUAL_METHODS.update(
    {
        ("MTL::StructMember", "arrayType"): "metal::StructMember::array_type",
        ("MTL::StructMember", "pointerType"): "metal::StructMember::pointer_type",
        ("MTL::StructMember", "structType"): "metal::StructMember::struct_type",
        ("MTL::StructMember", "tensorReferenceType"): "metal::StructMember::tensor_reference_type",
        ("MTL::StructMember", "textureReferenceType"): "metal::StructMember::texture_reference_type",
        ("MTL::StructType", "memberByName"): "metal::StructType::member_by_name",
        ("MTL::StructType", "members"): "metal::StructType::members",
        ("MTL::ArrayType", "elementArrayType"): "metal::ArrayType::element_array_type",
        ("MTL::ArrayType", "elementPointerType"): "metal::ArrayType::element_pointer_type",
        ("MTL::ArrayType", "elementStructType"): "metal::ArrayType::element_struct_type",
        ("MTL::ArrayType", "elementTensorReferenceType"): "metal::ArrayType::element_tensor_reference_type",
        ("MTL::ArrayType", "elementTextureReferenceType"): "metal::ArrayType::element_texture_reference_type",
        ("MTL::PointerType", "elementArrayType"): "metal::PointerType::element_array_type",
        ("MTL::PointerType", "elementStructType"): "metal::PointerType::element_struct_type",
        ("MTL::TensorReferenceType", "auxiliaryPlanes"): "metal::TensorReferenceType::auxiliary_planes",
        ("MTL::TensorBinding", "auxiliaryPlanes"): "metal::TensorBinding::auxiliary_planes",
        ("MTL::TextureViewDescriptor", "levelRange"): "metal::TextureViewDescriptor::level_range",
        ("MTL::TextureViewDescriptor", "setLevelRange"): "metal::TextureViewDescriptor::set_level_range",
        ("MTL::TextureViewDescriptor", "sliceRange"): "metal::TextureViewDescriptor::slice_range",
        ("MTL::TextureViewDescriptor", "setSliceRange"): "metal::TextureViewDescriptor::set_slice_range",
        ("MTL::TextureViewDescriptor", "swizzle"): "metal::TextureViewDescriptor::swizzle",
        ("MTL::TextureViewDescriptor", "setSwizzle"): "metal::TextureViewDescriptor::set_swizzle",
    }
)

ACTUAL_METHOD_SIGNATURES.update(
    {
        ("MTL::Argument", "deprecated", "[[deprecated( )]] bool active() const;"): "metal::Argument::is_active",
        ("MTL::Binding", "deprecated", "[[deprecated( )]] bool argument() const;"): "metal::Binding::is_argument",
        ("MTL::Binding", "deprecated", "[[deprecated( )]] bool used() const;"): "metal::Binding::is_used",
        ("MTL::TextureBinding", "deprecated", "[[deprecated( )]] bool depthTexture() const;"): "metal::TextureBinding::is_depth_texture",
    }
)

ACTUAL_METHODS.update(
    {
        ("MTL4::CompilerTaskOptions", "lookupArchives"): "metal4::CompilerTaskOptions::lookup_archives_vec",
        ("MTL4::CompilerTaskOptions", "setLookupArchives"): "metal4::CompilerTaskOptions::set_lookup_archives_slice",
        ("MTL4::StaticLinkingDescriptor", "functionDescriptors"): "metal4::StaticLinkingDescriptor::function_descriptors_vec",
        ("MTL4::StaticLinkingDescriptor", "setFunctionDescriptors"): "metal4::StaticLinkingDescriptor::set_function_descriptors_slice",
        ("MTL4::StaticLinkingDescriptor", "groups"): "metal4::StaticLinkingDescriptor::groups_map",
        ("MTL4::StaticLinkingDescriptor", "setGroups"): "metal4::StaticLinkingDescriptor::set_groups_map",
        ("MTL4::PipelineStageDynamicLinkingDescriptor", "binaryLinkedFunctions"): "metal4::PipelineStageDynamicLinkingDescriptor::binary_linked_functions_vec",
        ("MTL4::PipelineStageDynamicLinkingDescriptor", "setBinaryLinkedFunctions"): "metal4::PipelineStageDynamicLinkingDescriptor::set_binary_linked_functions_slice",
        ("MTL4::PipelineStageDynamicLinkingDescriptor", "preloadedLibraries"): "metal4::PipelineStageDynamicLinkingDescriptor::preloaded_libraries_vec",
        ("MTL4::PipelineStageDynamicLinkingDescriptor", "setPreloadedLibraries"): "metal4::PipelineStageDynamicLinkingDescriptor::set_preloaded_libraries_slice",
        ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "fragmentAdditionalBinaryFunctions"): "metal4::RenderPipelineBinaryFunctionsDescriptor::fragment_additional_binary_functions_vec",
        ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "setFragmentAdditionalBinaryFunctions"): "metal4::RenderPipelineBinaryFunctionsDescriptor::set_fragment_additional_binary_functions_slice",
        ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "meshAdditionalBinaryFunctions"): "metal4::RenderPipelineBinaryFunctionsDescriptor::mesh_additional_binary_functions_vec",
        ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "setMeshAdditionalBinaryFunctions"): "metal4::RenderPipelineBinaryFunctionsDescriptor::set_mesh_additional_binary_functions_slice",
        ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "objectAdditionalBinaryFunctions"): "metal4::RenderPipelineBinaryFunctionsDescriptor::object_additional_binary_functions_vec",
        ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "setObjectAdditionalBinaryFunctions"): "metal4::RenderPipelineBinaryFunctionsDescriptor::set_object_additional_binary_functions_slice",
        ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "tileAdditionalBinaryFunctions"): "metal4::RenderPipelineBinaryFunctionsDescriptor::tile_additional_binary_functions_vec",
        ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "setTileAdditionalBinaryFunctions"): "metal4::RenderPipelineBinaryFunctionsDescriptor::set_tile_additional_binary_functions_slice",
        ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "vertexAdditionalBinaryFunctions"): "metal4::RenderPipelineBinaryFunctionsDescriptor::vertex_additional_binary_functions_vec",
        ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "setVertexAdditionalBinaryFunctions"): "metal4::RenderPipelineBinaryFunctionsDescriptor::set_vertex_additional_binary_functions_slice",
        ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "reset"): "metal4::RenderPipelineBinaryFunctionsDescriptor::reset_safe",
        ("MTL4::RenderPipelineColorAttachmentDescriptor", "reset"): "metal4::RenderPipelineColorAttachmentDescriptor::reset_safe",
        ("MTL4::RenderPipelineColorAttachmentDescriptorArray", "object"): "metal4::RenderPipelineColorAttachmentDescriptorArray::attachment",
        ("MTL4::RenderPipelineColorAttachmentDescriptorArray", "setObject"): "metal4::RenderPipelineColorAttachmentDescriptorArray::set_attachment",
        ("MTL4::RenderPipelineColorAttachmentDescriptorArray", "reset"): "metal4::RenderPipelineColorAttachmentDescriptorArray::reset_safe",
        ("MTL4::RenderPipelineDescriptor", "reset"): "metal4::RenderPipelineDescriptor::reset_safe",
    }
)

ACTUAL_METHODS.update(
    {
        ("MTL::Drawable", "drawableID"): "metal::Drawable::drawable_id",
        ("MTL::Drawable", "present"): "metal::Drawable::present",
        ("MTL::Drawable", "presentAfterMinimumDuration"): "metal::Drawable::present_after_minimum_duration",
        ("MTL::Drawable", "presentAtTime"): "metal::Drawable::present_at_time",
        ("MTL::Drawable", "presentedTime"): "metal::Drawable::validated_presented_time",
        ("MTL::SharedEvent", "newSharedEventHandle"): "metal::SharedEvent::new_shared_event_handle",
        ("MTL::SharedEvent", "waitUntilSignaledValue"): "metal::SharedEvent::wait_until_signaled_value",
        ("MTL::SharedEventListener", "alloc"): "metal::SharedEventListener::new",
        ("MTL::SharedEventListener", "dispatchQueue"): "metal::SharedEventListener::shared",
        ("MTL::SharedEventListener", "sharedListener"): "metal::SharedEventListener::shared",
    }
)

ACTUAL_METHOD_SIGNATURES.update(
    {
        ("MTL::Drawable", "addPresentedHandler", "void addPresentedHandler(const MTL::DrawablePresentedHandler block);"): "metal::Drawable::on_presented",
        ("MTL::Drawable", "addPresentedHandler", "void addPresentedHandler(const MTL::DrawablePresentedHandlerFunction& function);"): "metal::Drawable::on_presented",
        ("MTL::SharedEvent", "notifyListener", "void notifyListener(const MTL::SharedEventListener* listener, uint64_t value, const MTL::SharedEventNotificationBlock block);"): "metal::SharedEvent::notify_at",
        ("MTL::SharedEvent", "notifyListener", "void notifyListener(const MTL::SharedEventListener* listener, uint64_t value, const MTL::SharedEventNotificationFunction& function);"): "metal::SharedEvent::notify_at",
        ("MTL::SharedEventListener", "init", "SharedEventListener* init();"): "metal::SharedEventListener::new",
        ("MTL::SharedEventListener", "init", "SharedEventListener* init(const dispatch_queue_t dispatchQueue);"): "metal::SharedEventListener::new",
    }
)

ACTUAL_METHODS.update(
    {
        ("MTL4::CommandQueue", "label"): "metal4::CommandQueue::label",
        ("MTL4::CommandQueue", "addResidencySet"): "metal4::CommandQueue::add_residency_set",
        ("MTL4::CommandQueue", "addResidencySets"): "metal4::CommandQueue::add_residency_sets",
        ("MTL4::CommandQueue", "removeResidencySet"): "metal4::CommandQueue::remove_residency_set",
        ("MTL4::CommandQueue", "removeResidencySets"): "metal4::CommandQueue::remove_residency_sets",
        ("MTL4::CommandQueue", "signalEvent"): "metal4::CommandQueue::signal_event",
        ("MTL4::CommandQueue", "signalDrawable"): "metal4::CommandQueue::signal_drawable",
        ("MTL4::CommandBuffer", "computeCommandEncoder"): "metal4::RecordingCommandBuffer::compute_encoder",
        ("MTL4::CommandBuffer", "device"): "metal4::AvailableCommandBuffer::device",
        ("MTL4::CommandBuffer", "endCommandBuffer"): "metal4::RecordingCommandBuffer::end",
        ("MTL4::CommandBuffer", "label"): "metal4::AvailableCommandBuffer::label",
        ("MTL4::CommandBuffer", "machineLearningCommandEncoder"): "metal4::RecordingCommandBuffer::machine_learning_encoder",
        ("MTL4::CommandBuffer", "popDebugGroup"): "metal4::RecordingCommandBuffer::pop_debug_group",
        ("MTL4::CommandBuffer", "pushDebugGroup"): "metal4::RecordingCommandBuffer::push_debug_group",
        ("MTL4::CommandBuffer", "setLabel"): "metal4::AvailableCommandBuffer::set_label",
        ("MTL4::CommandBuffer", "useResidencySet"): "metal4::RecordingCommandBuffer::use_residency_set",
        ("MTL4::CommandBuffer", "useResidencySets"): "metal4::RecordingCommandBuffer::use_residency_sets",
        ("MTL4::CommandEncoder", "barrierAfterEncoderStages"): "metal4::RecordingComputeEncoder::barrier_after_encoder_stages",
        ("MTL4::CommandEncoder", "barrierAfterQueueStages"): "metal4::RecordingComputeEncoder::barrier_after_queue_stages",
        ("MTL4::CommandEncoder", "barrierAfterStages"): "metal4::RecordingComputeEncoder::barrier_after_stages",
        ("MTL4::CommandEncoder", "endEncoding"): "metal4::RecordingComputeEncoder::end",
        ("MTL4::CommandEncoder", "insertDebugSignpost"): "metal4::RecordingComputeEncoder::insert_debug_signpost",
        ("MTL4::CommandEncoder", "label"): "metal4::RecordingComputeEncoder::label",
        ("MTL4::CommandEncoder", "popDebugGroup"): "metal4::RecordingComputeEncoder::pop_debug_group",
        ("MTL4::CommandEncoder", "pushDebugGroup"): "metal4::RecordingComputeEncoder::push_debug_group",
        ("MTL4::CommandEncoder", "setLabel"): "metal4::RecordingComputeEncoder::set_label",
        ("MTL4::CommandEncoder", "updateFence"): "metal4::RecordingComputeEncoder::update_fence",
        ("MTL4::CommandEncoder", "waitForFence"): "metal4::RecordingComputeEncoder::wait_for_fence",
        ("MTL4::RenderCommandEncoder", "setArgumentTable"): "metal4::RecordingRenderEncoder::set_argument_table",
        ("MTL4::RenderCommandEncoder", "setBlendColor"): "metal4::RecordingRenderEncoder::set_blend_color",
        ("MTL4::RenderCommandEncoder", "setColorStoreAction"): "metal4::RecordingRenderEncoder::set_color_store_action",
        ("MTL4::RenderCommandEncoder", "setCullMode"): "metal4::RecordingRenderEncoder::set_cull_mode",
        ("MTL4::RenderCommandEncoder", "setDepthBias"): "metal4::RecordingRenderEncoder::set_depth_bias",
        ("MTL4::RenderCommandEncoder", "setDepthClipMode"): "metal4::RecordingRenderEncoder::set_depth_clip_mode",
        ("MTL4::RenderCommandEncoder", "setDepthStencilState"): "metal4::RecordingRenderEncoder::set_depth_stencil_state",
        ("MTL4::RenderCommandEncoder", "setDepthStoreAction"): "metal4::RecordingRenderEncoder::set_depth_store_action",
        ("MTL4::RenderCommandEncoder", "setDepthTestBounds"): "metal4::RecordingRenderEncoder::set_depth_test_bounds",
        ("MTL4::RenderCommandEncoder", "setFrontFacingWinding"): "metal4::RecordingRenderEncoder::set_front_facing_winding",
        ("MTL4::RenderCommandEncoder", "setObjectThreadgroupMemoryLength"): "metal4::RecordingRenderEncoder::set_object_threadgroup_memory_length",
        ("MTL4::RenderCommandEncoder", "setRenderPipelineState"): "metal4::RecordingRenderEncoder::set_render_pipeline_state",
        ("MTL4::RenderCommandEncoder", "setStencilReferenceValue"): "metal4::RecordingRenderEncoder::set_stencil_reference_value",
        ("MTL4::RenderCommandEncoder", "setStencilReferenceValues"): "metal4::RecordingRenderEncoder::set_stencil_reference_values",
        ("MTL4::RenderCommandEncoder", "setStencilStoreAction"): "metal4::RecordingRenderEncoder::set_stencil_store_action",
        ("MTL4::RenderCommandEncoder", "setThreadgroupMemoryLength"): "metal4::RecordingRenderEncoder::set_threadgroup_memory_length",
        ("MTL4::RenderCommandEncoder", "setTriangleFillMode"): "metal4::RecordingRenderEncoder::set_triangle_fill_mode",
        ("MTL4::RenderCommandEncoder", "setViewport"): "metal4::RecordingRenderEncoder::set_viewport",
        ("MTL4::RenderCommandEncoder", "setVisibilityResultMode"): "metal4::RecordingRenderEncoder::set_visibility_result_mode",
        ("MTL4::ComputeCommandEncoder", "setArgumentTable"): "metal4::RecordingComputeEncoder::set_argument_table",
        ("MTL4::ComputeCommandEncoder", "setComputePipelineState"): "metal4::RecordingComputeEncoder::set_compute_pipeline_state",
        ("MTL4::ComputeCommandEncoder", "setImageblockWidth"): "metal4::RecordingComputeEncoder::set_imageblock_size",
        ("MTL4::ComputeCommandEncoder", "setThreadgroupMemoryLength"): "metal4::RecordingComputeEncoder::set_threadgroup_memory_length",
        ("MTL4::ComputeCommandEncoder", "stages"): "metal4::RecordingComputeEncoder::stages",
    }
)

ACTUAL_METHOD_SIGNATURES.update(
    {
        ("MTL4::CommandQueue", "commit", "void commit(const MTL4::CommandBuffer* const commandBuffers[], NS::UInteger count);"): "metal4::CommandQueue::submit",
        ("MTL4::CommandQueue", "commit", "void commit(const MTL4::CommandBuffer* const commandBuffers[], NS::UInteger count, const MTL4::CommitOptions* options);"): "metal4::CommandQueue::submit",
        ("MTL4::CommandQueue", "wait", "void wait(const MTL::Event* event, uint64_t value);"): "metal4::CommandQueue::wait_for_event",
        ("MTL4::CommandQueue", "wait", "void wait(const MTL::Drawable* drawable);"): "metal4::CommandQueue::wait_for_drawable",
        ("MTL4::CommandBuffer", "beginCommandBuffer", "void beginCommandBuffer(const MTL4::CommandAllocator* allocator);"): "metal4::AvailableCommandBuffer::begin",
        ("MTL4::CommandBuffer", "beginCommandBuffer", "void beginCommandBuffer(const MTL4::CommandAllocator* allocator, const MTL4::CommandBufferOptions* options);"): "metal4::AvailableCommandBuffer::begin",
        ("MTL4::CommandBuffer", "renderCommandEncoder", "RenderCommandEncoder* renderCommandEncoder(const MTL4::RenderPassDescriptor* descriptor);"): "metal4::RecordingCommandBuffer::render_encoder",
        ("MTL4::CommandBuffer", "renderCommandEncoder", "RenderCommandEncoder* renderCommandEncoder(const MTL4::RenderPassDescriptor* descriptor, MTL4::RenderEncoderOptions options);"): "metal4::RecordingCommandBuffer::render_encoder",
        ("MTL4::RenderCommandEncoder", "drawPrimitives", "void drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount);"): "metal4::RecordingRenderEncoder::draw_primitives",
        ("MTL4::RenderCommandEncoder", "drawPrimitives", "void drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount, NS::UInteger instanceCount);"): "metal4::RecordingRenderEncoder::draw_primitives_instanced",
        ("MTL4::RenderCommandEncoder", "drawPrimitives", "void drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount, NS::UInteger instanceCount, NS::UInteger baseInstance);"): "metal4::RecordingRenderEncoder::draw_primitives_instanced_base_instance",
        ("MTL4::ComputeCommandEncoder", "dispatchThreadgroups", "void dispatchThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerThreadgroup);"): "metal4::RecordingComputeEncoder::dispatch_threadgroups",
        ("MTL4::ComputeCommandEncoder", "dispatchThreads", "void dispatchThreads(MTL::Size threadsPerGrid, MTL::Size threadsPerThreadgroup);"): "metal4::RecordingComputeEncoder::dispatch_threads",
        ("MTL::Device", "newCommandBuffer", "MTL4::CommandBuffer* newCommandBuffer();"): "metal::Device::new_mtl4_command_buffer",
        ("MTL::Device", "newMTL4CommandQueue", "MTL4::CommandQueue* newMTL4CommandQueue();"): "metal::Device::new_mtl4_command_queue",
    }
)

ACTUAL_METHOD_SIGNATURES.update(
    {
        ("MTL4::Compiler", "newBinaryFunction", "BinaryFunction* newBinaryFunction(const MTL4::BinaryFunctionDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error);"): "metal4::Compiler::new_binary_function",
        ("MTL4::Compiler", "newBinaryFunction", "CompilerTask* newBinaryFunction(const MTL4::BinaryFunctionDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL4::NewBinaryFunctionCompletionHandler completionHandler);"): "metal4::Compiler::new_binary_function_async",
        ("MTL4::Compiler", "newComputePipelineState", "MTL::ComputePipelineState* newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error);"): "metal4::Compiler::new_compute_pipeline",
        ("MTL4::Compiler", "newComputePipelineState", "MTL::ComputePipelineState* newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::PipelineStageDynamicLinkingDescriptor* dynamicLinkingDescriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error);"): "metal4::Compiler::new_compute_pipeline",
        ("MTL4::Compiler", "newComputePipelineState", "CompilerTask* newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL::NewComputePipelineStateCompletionHandler completionHandler);"): "metal4::Compiler::new_compute_pipeline_async",
        ("MTL4::Compiler", "newComputePipelineState", "CompilerTask* newComputePipelineState(const MTL4::ComputePipelineDescriptor* descriptor, const MTL4::PipelineStageDynamicLinkingDescriptor* dynamicLinkingDescriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL::NewComputePipelineStateCompletionHandler completionHandler);"): "metal4::Compiler::new_compute_pipeline_linked_async",
        ("MTL4::Compiler", "newComputePipelineState", "CompilerTask* newComputePipelineState(const MTL4::ComputePipelineDescriptor* pDescriptor, const MTL4::CompilerTaskOptions* options, const MTL4::NewComputePipelineStateCompletionHandlerFunction& function);"): "metal4::Compiler::new_compute_pipeline_async",
        ("MTL4::Compiler", "newDynamicLibrary", "MTL::DynamicLibrary* newDynamicLibrary(const MTL::Library* library, NS::Error** error);"): "metal4::Compiler::new_dynamic_library",
        ("MTL4::Compiler", "newDynamicLibrary", "MTL::DynamicLibrary* newDynamicLibrary(const NS::URL* url, NS::Error** error);"): "metal4::Compiler::new_dynamic_library_from_path",
        ("MTL4::Compiler", "newDynamicLibrary", "CompilerTask* newDynamicLibrary(const MTL::Library* library, const MTL::NewDynamicLibraryCompletionHandler completionHandler);"): "metal4::Compiler::new_dynamic_library_async",
        ("MTL4::Compiler", "newDynamicLibrary", "CompilerTask* newDynamicLibrary(const NS::URL* url, const MTL::NewDynamicLibraryCompletionHandler completionHandler);"): "metal4::Compiler::new_dynamic_library_from_path_async",
        ("MTL4::Compiler", "newDynamicLibrary", "CompilerTask* newDynamicLibrary(const MTL::Library* pLibrary, const MTL::NewDynamicLibraryCompletionHandlerFunction& function);"): "metal4::Compiler::new_dynamic_library_async",
        ("MTL4::Compiler", "newDynamicLibrary", "CompilerTask* newDynamicLibrary(const NS::URL* pURL, const MTL::NewDynamicLibraryCompletionHandlerFunction& function);"): "metal4::Compiler::new_dynamic_library_from_path_async",
        ("MTL4::Compiler", "newLibrary", "MTL::Library* newLibrary(const MTL4::LibraryDescriptor* descriptor, NS::Error** error);"): "metal4::Compiler::new_library",
        ("MTL4::Compiler", "newLibrary", "CompilerTask* newLibrary(const MTL4::LibraryDescriptor* descriptor, const MTL::NewLibraryCompletionHandler completionHandler);"): "metal4::Compiler::new_library_async",
        ("MTL4::Compiler", "newLibrary", "CompilerTask* newLibrary(const MTL4::LibraryDescriptor* pDescriptor, const MTL::NewLibraryCompletionHandlerFunction& function);"): "metal4::Compiler::new_library_async",
        ("MTL4::Compiler", "newMachineLearningPipelineState", "MachineLearningPipelineState* newMachineLearningPipelineState(const MTL4::MachineLearningPipelineDescriptor* descriptor, NS::Error** error);"): "metal4::Compiler::new_machine_learning_pipeline",
        ("MTL4::Compiler", "newMachineLearningPipelineState", "CompilerTask* newMachineLearningPipelineState(const MTL4::MachineLearningPipelineDescriptor* descriptor, const MTL4::NewMachineLearningPipelineStateCompletionHandler completionHandler);"): "metal4::Compiler::new_machine_learning_pipeline_async",
        ("MTL4::Compiler", "newMachineLearningPipelineState", "CompilerTask* newMachineLearningPipelineState(const MTL4::MachineLearningPipelineDescriptor* pDescriptor, const MTL4::NewMachineLearningPipelineStateCompletionHandlerFunction& function);"): "metal4::Compiler::new_machine_learning_pipeline_async",
        ("MTL4::Compiler", "newRenderPipelineState", "MTL::RenderPipelineState* newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error);"): "metal4::Compiler::new_render_pipeline",
        ("MTL4::Compiler", "newRenderPipelineState", "MTL::RenderPipelineState* newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::RenderPipelineDynamicLinkingDescriptor* dynamicLinkingDescriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, NS::Error** error);"): "metal4::Compiler::new_render_pipeline",
        ("MTL4::Compiler", "newRenderPipelineState", "CompilerTask* newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL::NewRenderPipelineStateCompletionHandler completionHandler);"): "metal4::Compiler::new_render_pipeline_async",
        ("MTL4::Compiler", "newRenderPipelineState", "CompilerTask* newRenderPipelineState(const MTL4::PipelineDescriptor* descriptor, const MTL4::RenderPipelineDynamicLinkingDescriptor* dynamicLinkingDescriptor, const MTL4::CompilerTaskOptions* compilerTaskOptions, const MTL::NewRenderPipelineStateCompletionHandler completionHandler);"): "metal4::Compiler::new_render_pipeline_linked_async",
        ("MTL4::Compiler", "newRenderPipelineState", "CompilerTask* newRenderPipelineState(const MTL4::PipelineDescriptor* pDescriptor, const MTL4::CompilerTaskOptions* options, const MTL4::NewRenderPipelineStateCompletionHandlerFunction& function);"): "metal4::Compiler::new_render_pipeline_async",
        ("MTL4::Compiler", "newRenderPipelineStateBySpecialization", "MTL::RenderPipelineState* newRenderPipelineStateBySpecialization(const MTL4::PipelineDescriptor* descriptor, const MTL::RenderPipelineState* pipeline, NS::Error** error);"): "metal4::Compiler::specialize_render_pipeline",
        ("MTL4::Compiler", "newRenderPipelineStateBySpecialization", "CompilerTask* newRenderPipelineStateBySpecialization(const MTL4::PipelineDescriptor* descriptor, const MTL::RenderPipelineState* pipeline, const MTL::NewRenderPipelineStateCompletionHandler completionHandler);"): "metal4::Compiler::specialize_render_pipeline_async",
        ("MTL4::Compiler", "newRenderPipelineStateBySpecialization", "CompilerTask* newRenderPipelineStateBySpecialization(const MTL4::PipelineDescriptor* pDescriptor, const MTL::RenderPipelineState* pPipeline, const MTL4::NewRenderPipelineStateCompletionHandlerFunction& function);"): "metal4::Compiler::specialize_render_pipeline_async",
    }
)

METAL4_ACCELERATION_BUFFER_PROPERTIES = (
    ("MTL4::AccelerationStructureGeometryDescriptor", "primitiveDataBuffer", "primitive_data_buffer"),
    ("MTL4::AccelerationStructureTriangleGeometryDescriptor", "indexBuffer", "index_buffer"),
    ("MTL4::AccelerationStructureTriangleGeometryDescriptor", "transformationMatrixBuffer", "transformation_matrix_buffer"),
    ("MTL4::AccelerationStructureTriangleGeometryDescriptor", "vertexBuffer", "vertex_buffer"),
    ("MTL4::AccelerationStructureBoundingBoxGeometryDescriptor", "boundingBoxBuffer", "bounding_box_buffer"),
    ("MTL4::AccelerationStructureMotionTriangleGeometryDescriptor", "indexBuffer", "index_buffer"),
    ("MTL4::AccelerationStructureMotionTriangleGeometryDescriptor", "transformationMatrixBuffer", "transformation_matrix_buffer"),
    ("MTL4::AccelerationStructureMotionTriangleGeometryDescriptor", "vertexBuffers", "vertex_buffers"),
    ("MTL4::AccelerationStructureMotionBoundingBoxGeometryDescriptor", "boundingBoxBuffers", "bounding_box_buffers"),
    ("MTL4::AccelerationStructureCurveGeometryDescriptor", "controlPointBuffer", "control_point_buffer"),
    ("MTL4::AccelerationStructureCurveGeometryDescriptor", "indexBuffer", "index_buffer"),
    ("MTL4::AccelerationStructureCurveGeometryDescriptor", "radiusBuffer", "radius_buffer"),
    ("MTL4::AccelerationStructureMotionCurveGeometryDescriptor", "controlPointBuffers", "control_point_buffers"),
    ("MTL4::AccelerationStructureMotionCurveGeometryDescriptor", "indexBuffer", "index_buffer"),
    ("MTL4::AccelerationStructureMotionCurveGeometryDescriptor", "radiusBuffers", "radius_buffers"),
    ("MTL4::InstanceAccelerationStructureDescriptor", "instanceDescriptorBuffer", "instance_descriptor_buffer"),
    ("MTL4::InstanceAccelerationStructureDescriptor", "motionTransformBuffer", "motion_transform_buffer"),
    ("MTL4::IndirectInstanceAccelerationStructureDescriptor", "instanceCountBuffer", "instance_count_buffer"),
    ("MTL4::IndirectInstanceAccelerationStructureDescriptor", "instanceDescriptorBuffer", "instance_descriptor_buffer"),
    ("MTL4::IndirectInstanceAccelerationStructureDescriptor", "motionTransformBuffer", "motion_transform_buffer"),
    ("MTL4::IndirectInstanceAccelerationStructureDescriptor", "motionTransformCountBuffer", "motion_transform_count_buffer"),
)

for _parent, _cpp_name, _rust_name in METAL4_ACCELERATION_BUFFER_PROPERTIES:
    _rust_parent = _parent.rsplit("::", 1)[-1]
    ACTUAL_METHODS[(_parent, _cpp_name)] = f"metal4::{_rust_parent}::{_rust_name}"
    ACTUAL_METHODS[(_parent, f"set{_cpp_name[0].upper()}{_cpp_name[1:]}")] = (
        f"metal4::{_rust_parent}::set_{_rust_name}"
    )

ACTUAL_METHODS.update(
    {
        ("MTL4::PrimitiveAccelerationStructureDescriptor", "geometryDescriptors"): "metal4::PrimitiveAccelerationStructureDescriptor::geometry_descriptor_vec",
        ("MTL4::PrimitiveAccelerationStructureDescriptor", "setGeometryDescriptors"): "metal4::PrimitiveAccelerationStructureDescriptor::set_geometry_descriptor_slice",
    }
)

ACTUAL_METHODS.update(
    {
        ("MTL::RenderCommandEncoder", cpp_name): f"metal::RenderCommandEncoder::{rust_name}"
        for cpp_name, rust_name in {
            "dispatchThreadsPerTile": "dispatch_threads_per_tile",
            "drawMeshThreads": "draw_mesh_threads",
            "sampleCountersInBuffer": "sample_counters",
            "setColorAttachmentMap": "set_color_attachment_map",
            "setColorStoreAction": "set_color_store_action",
            "setColorStoreActionOptions": "set_color_store_action_options",
            "setDepthStencilState": "set_depth_stencil_state",
            "setDepthStoreAction": "set_depth_store_action",
            "setDepthStoreActionOptions": "set_depth_store_action_options",
            "setFragmentAccelerationStructure": "set_fragment_acceleration_structure",
            "setFragmentBufferOffset": "set_fragment_buffer_offset",
            "setFragmentBuffers": "set_fragment_buffers",
            "setFragmentIntersectionFunctionTable": "set_fragment_intersection_function_table",
            "setFragmentIntersectionFunctionTables": "set_fragment_intersection_function_tables",
            "setFragmentTextures": "set_fragment_textures",
            "setFragmentVisibleFunctionTable": "set_fragment_visible_function_table",
            "setFragmentVisibleFunctionTables": "set_fragment_visible_function_tables",
            "setMeshBuffer": "set_mesh_buffer",
            "setMeshBufferOffset": "set_mesh_buffer_offset",
            "setMeshBuffers": "set_mesh_buffers",
            "setMeshBytes": "set_mesh_bytes",
            "setMeshTexture": "set_mesh_texture",
            "setMeshTextures": "set_mesh_textures",
            "setObjectBuffer": "set_object_buffer",
            "setObjectBufferOffset": "set_object_buffer_offset",
            "setObjectBuffers": "set_object_buffers",
            "setObjectBytes": "set_object_bytes",
            "setObjectTexture": "set_object_texture",
            "setObjectTextures": "set_object_textures",
            "setObjectThreadgroupMemoryLength": "set_object_threadgroup_memory_length",
            "setScissorRects": "set_scissor_rects",
            "setStencilStoreAction": "set_stencil_store_action",
            "setStencilStoreActionOptions": "set_stencil_store_action_options",
            "setTessellationFactorBuffer": "set_tessellation_factor_buffer",
            "setTessellationFactorScale": "set_tessellation_factor_scale",
            "setThreadgroupMemoryLength": "set_threadgroup_memory_length",
            "setTileAccelerationStructure": "set_tile_acceleration_structure",
            "setTileBuffer": "set_tile_buffer",
            "setTileBufferOffset": "set_tile_buffer_offset",
            "setTileBuffers": "set_tile_buffers",
            "setTileBytes": "set_tile_bytes",
            "setTileIntersectionFunctionTable": "set_tile_intersection_function_table",
            "setTileIntersectionFunctionTables": "set_tile_intersection_function_tables",
            "setTileTexture": "set_tile_texture",
            "setTileTextures": "set_tile_textures",
            "setTileVisibleFunctionTable": "set_tile_visible_function_table",
            "setTileVisibleFunctionTables": "set_tile_visible_function_tables",
            "setVertexAccelerationStructure": "set_vertex_acceleration_structure",
            "setVertexAmplificationCount": "set_vertex_amplification",
            "setVertexIntersectionFunctionTable": "set_vertex_intersection_function_table",
            "setVertexIntersectionFunctionTables": "set_vertex_intersection_function_tables",
            "setVertexTextures": "set_vertex_textures",
            "setVertexVisibleFunctionTable": "set_vertex_visible_function_table",
            "setVertexVisibleFunctionTables": "set_vertex_visible_function_tables",
            "setViewports": "set_viewports",
            "setVisibilityResultMode": "set_visibility_result_mode",
            "updateFence": "update_fence",
            "useResource": "use_resource",
            "useResources": "use_resources",
            "waitForFence": "wait_for_fence",
        }.items()
    }
)

ACTUAL_METHOD_SIGNATURES.update({
    ("MTL::RenderCommandEncoder", "drawPrimitives", "void drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount);"): "metal::RenderCommandEncoder::draw_primitives",
    ("MTL::RenderCommandEncoder", "setVertexBuffer", "void setVertexBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index);"): "metal::RenderCommandEncoder::set_vertex_buffer",
    ("MTL::RenderCommandEncoder", "setVertexBytes", "void setVertexBytes(const void* bytes, NS::UInteger length, NS::UInteger index);"): "metal::RenderCommandEncoder::set_vertex_bytes",
    ("MTL::ComputeCommandEncoder", "setBuffer", "void setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index);"): "metal::ComputeCommandEncoder::set_buffer",
    ("MTL::ComputeCommandEncoder", "setBuffer", "void setBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index);"): "metal::ComputeCommandEncoder::set_buffer_with_stride",
    ("MTL::ComputeCommandEncoder", "setBytes", "void setBytes(const void* bytes, NS::UInteger length, NS::UInteger index);"): "metal::ComputeCommandEncoder::set_bytes",
    ("MTL::ComputeCommandEncoder", "setBytes", "void setBytes(const void* bytes, NS::UInteger length, NS::UInteger stride, NS::UInteger index);"): "metal::ComputeCommandEncoder::set_bytes_with_stride",
    ("MTL::ComputeCommandEncoder", "dispatchThreadgroups", "void dispatchThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerThreadgroup);"): "metal::ComputeCommandEncoder::dispatch_threadgroups",
    ("MTL::ComputeCommandEncoder", "dispatchThreadgroups", "void dispatchThreadgroups(const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset, MTL::Size threadsPerThreadgroup);"): "metal::ComputeCommandEncoder::dispatch_threadgroups_indirect",
    ("MTL::ComputeCommandEncoder", "setBufferOffset", "void setBufferOffset(NS::UInteger offset, NS::UInteger index);"): "metal::ComputeCommandEncoder::set_buffer_offset",
    ("MTL::ComputeCommandEncoder", "setBufferOffset", "void setBufferOffset(NS::UInteger offset, NS::UInteger stride, NS::UInteger index);"): "metal::ComputeCommandEncoder::set_buffer_offset_with_stride",
    ("MTL::ComputeCommandEncoder", "setBuffers", "void setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range);"): "metal::ComputeCommandEncoder::set_buffers",
    ("MTL::ComputeCommandEncoder", "setBuffers", "void setBuffers(const MTL::Buffer* const buffers[], const NS::UInteger* offsets, const NS::UInteger* strides, NS::Range range);"): "metal::ComputeCommandEncoder::set_buffers_with_strides",
    ("MTL::ComputeCommandEncoder", "setStageInRegion", "void setStageInRegion(MTL::Region region);"): "metal::ComputeCommandEncoder::set_stage_in_region",
    ("MTL::ComputeCommandEncoder", "setStageInRegion", "void setStageInRegion(const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset);"): "metal::ComputeCommandEncoder::set_stage_in_region_indirect",
    ("MTL::Device", "deprecated", "[[deprecated( )]] bool barycentricCoordsSupported() const;"): "metal::Device::capability",
    ("MTL::Device", "deprecated", "[[deprecated( )]] bool programmableSamplePositionsSupported() const;"): "metal::Device::capability",
    ("MTL::Device", "deprecated", "[[deprecated( )]] bool rasterOrderGroupsSupported() const;"): "metal::Device::capability",
    ("MTL::Device", "deprecated", "[[deprecated( )]] bool depth24Stencil8PixelFormatSupported() const;"): "metal::Device::capability",
    ("MTL::Device", "deprecated", "[[deprecated( )]] bool headless() const;"): "metal::Device::capability",
    ("MTL::Device", "deprecated", "[[deprecated( )]] bool lowPower() const;"): "metal::Device::capability",
    ("MTL::Device", "deprecated", "[[deprecated( )]] bool removable() const;"): "metal::Device::capability",
    ("MTL::Texture", "deprecated", "[[deprecated( )]] bool framebufferOnly() const;"): "metal::Texture::is_framebuffer_only",
    ("MTL::Texture", "deprecated", "[[deprecated( )]] bool shareable() const;"): "metal::Texture::is_shareable",
    ("MTL::RenderPipelineDescriptor", "deprecated", "[[deprecated( )]] bool alphaToCoverageEnabled() const;"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "deprecated", "[[deprecated( )]] bool alphaToOneEnabled() const;"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "deprecated", "[[deprecated( )]] bool rasterizationEnabled() const;"): "metal::RenderPipelineDescriptor::options",
    ("MTL::RenderPipelineDescriptor", "deprecated", "[[deprecated( )]] bool tessellationFactorScaleEnabled() const;"): "metal::RenderPipelineDescriptor::options",
    ("MTL::Origin", "Origin", "Origin() = default;"): "metal::Origin::default",
    ("MTL::Origin", "Origin", "Origin(NS::UInteger x, NS::UInteger y, NS::UInteger z);"): "metal::Origin::new",
    ("MTL::Origin", "Make", "static Origin Make(NS::UInteger x, NS::UInteger y, NS::UInteger z);"): "metal::Origin::new",
    ("MTL::Size", "Size", "Size() = default;"): "metal::Size::default",
    ("MTL::Size", "Size", "Size(NS::UInteger width, NS::UInteger height, NS::UInteger depth);"): "metal::Size::new",
    ("MTL::Size", "Make", "static Size Make(NS::UInteger width, NS::UInteger height, NS::UInteger depth);"): "metal::Size::new",
    ("MTL::Region", "Region", "Region() = default;"): "metal::Region::default",
    ("MTL::Region", "Region", "Region(NS::UInteger x, NS::UInteger width);"): "metal::Region::new_1d",
    ("MTL::Region", "Region", "Region(NS::UInteger x, NS::UInteger y, NS::UInteger width, NS::UInteger height);"): "metal::Region::new_2d",
    ("MTL::Region", "Region", "Region(NS::UInteger x, NS::UInteger y, NS::UInteger z, NS::UInteger width, NS::UInteger height, NS::UInteger depth);"): "metal::Region::new_3d",
    ("MTL::Region", "Make1D", "static Region Make1D(NS::UInteger x, NS::UInteger width);"): "metal::Region::new_1d",
    ("MTL::Region", "Make2D", "static Region Make2D(NS::UInteger x, NS::UInteger y, NS::UInteger width, NS::UInteger height);"): "metal::Region::new_2d",
    ("MTL::Region", "Make3D", "static Region Make3D(NS::UInteger x, NS::UInteger y, NS::UInteger z, NS::UInteger width, NS::UInteger height, NS::UInteger depth);"): "metal::Region::new_3d",
    ("MTL::ClearColor", "ClearColor", "ClearColor() = default;"): "metal::ClearColor::default",
    ("MTL::ClearColor", "ClearColor", "ClearColor(double red, double green, double blue, double alpha);"): "metal::ClearColor::new",
    ("MTL::ClearColor", "Make", "static ClearColor Make(double red, double green, double blue, double alpha);"): "metal::ClearColor::new",
    (
        "MTL::CommandBuffer",
        "blitCommandEncoder",
        "BlitCommandEncoder* blitCommandEncoder();",
    ): "metal::CommandBuffer::blit_encoder",
    (
        "MTL::CommandQueue",
        "commandBuffer",
        "CommandBuffer* commandBuffer();",
    ): "metal::CommandQueue::command_buffer",
    (
        "MTL::Device",
        "newCommandQueue",
        "CommandQueue* newCommandQueue();",
    ): "metal::Device::new_command_queue",
    (
        "MTL::Device",
        "newCommandQueue",
        "CommandQueue* newCommandQueue(NS::UInteger maxCommandBufferCount);",
    ): "metal::Device::new_command_queue",
    (
        "MTL::Device",
        "newBuffer",
        "Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options);",
    ): "metal::Device::new_buffer",
    (
        "MTL::Device",
        "newTexture",
        "Texture* newTexture(const MTL::TextureDescriptor* descriptor);",
    ): "metal::Device::new_texture",
    (
        "MTL::Device",
        "newLibrary",
        "Library* newLibrary(const NS::String* source, const MTL::CompileOptions* options, NS::Error** error);",
    ): "metal::Device::new_library_from_source",
    (
        "MTL::Device",
        "newRenderPipelineState",
        "RenderPipelineState* newRenderPipelineState(const MTL::RenderPipelineDescriptor* descriptor, NS::Error** error);",
    ): "metal::Device::new_render_pipeline",
    (
        "MTL::Device",
        "newComputePipelineState",
        "ComputePipelineState* newComputePipelineState(const MTL::Function* computeFunction, NS::Error** error);",
    ): "metal::Device::new_compute_pipeline",
    (
        "MTL::Library",
        "newFunction",
        "Function* newFunction(const NS::String* functionName);",
    ): "metal::Library::function",
    (
        "MTL::Texture",
        "newTextureView",
        "Texture* newTextureView(MTL::PixelFormat pixelFormat);",
    ): "metal::Texture::view_with_pixel_format",
    (
        "MTL::Device",
        "heapAccelerationStructureSizeAndAlign",
        "SizeAndAlign heapAccelerationStructureSizeAndAlign(NS::UInteger size);",
    ): "metal::Device::heap_acceleration_structure_size_and_align",
    (
        "MTL::RenderCommandEncoder",
        "drawPrimitives",
        "void drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount, NS::UInteger instanceCount);",
    ): "metal::RenderCommandEncoder::draw_primitives_instanced",
    (
        "MTL::RenderCommandEncoder",
        "drawPrimitives",
        "void drawPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger vertexStart, NS::UInteger vertexCount, NS::UInteger instanceCount, NS::UInteger baseInstance);",
    ): "metal::RenderCommandEncoder::draw_primitives_instanced",
    (
        "MTL::BlitCommandEncoder",
        "copyFromBuffer",
        "void copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger size);",
    ): "metal::BlitCommandEncoder::copy_buffer",
    (
        "MTL::BlitCommandEncoder",
        "copyFromTexture",
        "void copyFromTexture(const MTL::Texture* sourceTexture, const MTL::Texture* destinationTexture);",
    ): "metal::BlitCommandEncoder::copy_texture",
    (
        "MTL::BlitCommandEncoder",
        "optimizeContentsForCPUAccess",
        "void optimizeContentsForCPUAccess(const MTL::Texture* texture);",
    ): "metal::BlitCommandEncoder::optimize_texture_for_cpu",
    (
        "MTL::BlitCommandEncoder",
        "optimizeContentsForGPUAccess",
        "void optimizeContentsForGPUAccess(const MTL::Texture* texture);",
    ): "metal::BlitCommandEncoder::optimize_texture_for_gpu",
    (
        "MTLFX::TemporalScalerBase",
        "deprecated",
        "[[deprecated( )]] MTL::TextureUsage reactiveTextureUsage() const;",
    ): "metal_fx::TemporalScaler::reactive_texture_usage",
    (
        "MTLFX::TemporalDenoisedScalerBase",
        "deprecated",
        "[[deprecated( )]] MTL::TextureUsage reactiveTextureUsage() const;",
    ): "metal_fx::TemporalDenoisedScalerBase::reactive_mask_texture_usage",
})

ACTUAL_METHOD_SIGNATURES.update(
    {
        # Command queue/buffer overloads are deliberately signature-pinned so
        # encoder factories that do not yet preserve typestate stay uncovered.
        (
            "MTL::CommandQueue",
            "commandBuffer",
            "CommandBuffer* commandBuffer(const MTL::CommandBufferDescriptor* descriptor);",
        ): "metal::CommandQueue::command_buffer_with_descriptor",
        (
            "MTL::CommandBuffer",
            "computeCommandEncoder",
            "ComputeCommandEncoder* computeCommandEncoder();",
        ): "metal::CommandBuffer::compute_encoder_default",
        (
            "MTL::CommandBuffer",
            "computeCommandEncoder",
            "ComputeCommandEncoder* computeCommandEncoder(MTL::DispatchType dispatchType);",
        ): "metal::CommandBuffer::compute_encoder_with_dispatch_type",
        (
            "MTL::CommandBuffer",
            "blitCommandEncoder",
            "BlitCommandEncoder* blitCommandEncoder(const MTL::BlitPassDescriptor* blitPassDescriptor);",
        ): "metal::CommandBuffer::blit_encoder_with_descriptor",
        # Capture target overloads.  The MTL4 queue overload remains uncovered
        # until its canonical command-queue wrapper is available.
        (
            "MTL::CaptureManager",
            "newCaptureScope",
            "CaptureScope* newCaptureScope(const MTL::Device* device);",
        ): "metal::CaptureSession::new_scope_for_device",
        (
            "MTL::CaptureManager",
            "newCaptureScope",
            "CaptureScope* newCaptureScope(const MTL::CommandQueue* commandQueue);",
        ): "metal::CaptureSession::new_scope_for_command_queue",
        (
            "MTL::CaptureManager",
            "startCapture",
            "bool startCapture(const MTL::CaptureDescriptor* descriptor, NS::Error** error);",
        ): "metal::CaptureSession::start_descriptor",
        (
            "MTL::CaptureManager",
            "startCapture",
            "void startCapture(const MTL::Device* device);",
        ): "metal::CaptureSession::start_for_device",
        (
            "MTL::CaptureManager",
            "startCapture",
            "void startCapture(const MTL::CommandQueue* commandQueue);",
        ): "metal::CaptureSession::start_for_command_queue",
        (
            "MTL::CaptureManager",
            "startCapture",
            "void startCapture(const MTL::CaptureScope* captureScope);",
        ): "metal::CaptureSession::start_for_scope",
        # Shader specialization and derived pipeline creation.
        (
            "MTL::Library",
            "newFunction",
            "Function* newFunction(const NS::String* name, const MTL::FunctionConstantValues* constantValues, NS::Error** error);",
        ): "metal::Library::specialized_function",
        (
            "MTL::Library",
            "newFunction",
            "Function* newFunction(const MTL::FunctionDescriptor* descriptor, NS::Error** error);",
        ): "metal::Library::function_with_descriptor",
        (
            "MTL::Library",
            "newIntersectionFunction",
            "Function* newIntersectionFunction(const MTL::IntersectionFunctionDescriptor* descriptor, NS::Error** error);",
        ): "metal::Library::intersection_function_with_descriptor",
        (
            "MTL::RenderPipelineState",
            "functionHandle",
            "FunctionHandle* functionHandle(const NS::String* name, MTL::RenderStages stage);",
        ): "metal::RenderPipelineState::function_handle_by_name",
        (
            "MTL::RenderPipelineState",
            "newRenderPipelineState",
            "RenderPipelineState* newRenderPipelineState(const MTL::RenderPipelineFunctionsDescriptor* additionalBinaryFunctions, NS::Error** error);",
        ): "metal::RenderPipelineState::with_additional_binary_functions",
        (
            "MTL::ComputePipelineState",
            "functionHandle",
            "FunctionHandle* functionHandle(const NS::String* name);",
        ): "metal::ComputePipelineState::function_handle_by_name",
        (
            "MTL::ComputePipelineState",
            "newComputePipelineState",
            "ComputePipelineState* newComputePipelineState(const NS::Array* functions, NS::Error** error);",
        ): "metal::ComputePipelineState::with_additional_functions",
        # Safe texture factories, views, and owned CPU source slices.
        (
            "MTL::TextureDescriptor",
            "texture2DDescriptor",
            "static TextureDescriptor* texture2DDescriptor(MTL::PixelFormat pixelFormat, NS::UInteger width, NS::UInteger height, bool mipmapped);",
        ): "metal::TextureDescriptor::texture_2d",
        (
            "MTL::TextureDescriptor",
            "textureCubeDescriptor",
            "static TextureDescriptor* textureCubeDescriptor(MTL::PixelFormat pixelFormat, NS::UInteger size, bool mipmapped);",
        ): "metal::TextureDescriptor::texture_cube",
        (
            "MTL::TextureDescriptor",
            "textureBufferDescriptor",
            "static TextureDescriptor* textureBufferDescriptor(MTL::PixelFormat pixelFormat, NS::UInteger width, MTL::ResourceOptions resourceOptions, MTL::TextureUsage usage);",
        ): "metal::TextureDescriptor::texture_buffer",
        (
            "MTL::Texture",
            "newTextureView",
            "Texture* newTextureView(MTL::PixelFormat pixelFormat, MTL::TextureType textureType, NS::Range levelRange, NS::Range sliceRange);",
        ): "metal::Texture::view",
        (
            "MTL::Texture",
            "newTextureView",
            "Texture* newTextureView(const MTL::TextureViewDescriptor* descriptor);",
        ): "metal::Texture::view_with_descriptor",
        (
            "MTL::Texture",
            "newTextureView",
            "Texture* newTextureView(MTL::PixelFormat pixelFormat, MTL::TextureType textureType, NS::Range levelRange, NS::Range sliceRange, MTL::TextureSwizzleChannels swizzle);",
        ): "metal::Texture::view_with_swizzle",
        (
            "MTL::Texture",
            "replaceRegion",
            "void replaceRegion(MTL::Region region, NS::UInteger level, const void* pixelBytes, NS::UInteger bytesPerRow);",
        ): "metal::Texture::replace_region_2d",
        (
            "MTL::Texture",
            "replaceRegion",
            "void replaceRegion(MTL::Region region, NS::UInteger level, NS::UInteger slice, const void* pixelBytes, NS::UInteger bytesPerRow, NS::UInteger bytesPerImage);",
        ): "metal::Texture::replace_region",
        # Heap overloads retain size/descriptor and explicit-offset distinctions.
        (
            "MTL::Heap",
            "newBuffer",
            "Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options);",
        ): "metal::Heap::new_buffer",
        (
            "MTL::Heap",
            "newBuffer",
            "Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options, NS::UInteger offset);",
        ): "metal::Heap::new_buffer_at_offset",
        (
            "MTL::Heap",
            "newTexture",
            "Texture* newTexture(const MTL::TextureDescriptor* descriptor);",
        ): "metal::Heap::new_texture",
        (
            "MTL::Heap",
            "newTexture",
            "Texture* newTexture(const MTL::TextureDescriptor* descriptor, NS::UInteger offset);",
        ): "metal::Heap::new_texture_at_offset",
        (
            "MTL::Heap",
            "newAccelerationStructure",
            "AccelerationStructure* newAccelerationStructure(NS::UInteger size);",
        ): "metal::Heap::new_acceleration_structure",
        (
            "MTL::Heap",
            "newAccelerationStructure",
            "AccelerationStructure* newAccelerationStructure(const MTL::AccelerationStructureDescriptor* descriptor);",
        ): "metal::Heap::new_acceleration_structure_with_descriptor",
        (
            "MTL::Heap",
            "newAccelerationStructure",
            "AccelerationStructure* newAccelerationStructure(NS::UInteger size, NS::UInteger offset);",
        ): "metal::Heap::new_acceleration_structure_at_offset",
        (
            "MTL::Heap",
            "newAccelerationStructure",
            "AccelerationStructure* newAccelerationStructure(const MTL::AccelerationStructureDescriptor* descriptor, NS::UInteger offset);",
        ): "metal::Heap::new_acceleration_structure_with_descriptor_at_offset",
        # Rasterization-rate constructors preserve which sample arrays are supplied.
        (
            "MTL::RasterizationRateLayerDescriptor",
            "init",
            "RasterizationRateLayerDescriptor* init(MTL::Size sampleCount);",
        ): "metal::RasterizationRateLayerDescriptor::with_sample_count",
        (
            "MTL::RasterizationRateLayerDescriptor",
            "init",
            "RasterizationRateLayerDescriptor* init(MTL::Size sampleCount, const float* horizontal, const float* vertical);",
        ): "metal::RasterizationRateLayerDescriptor::with_samples",
        (
            "MTL::RasterizationRateMapDescriptor",
            "rasterizationRateMapDescriptor",
            "static RasterizationRateMapDescriptor* rasterizationRateMapDescriptor(MTL::Size screenSize);",
        ): "metal::RasterizationRateMapDescriptor::with_screen_size",
        (
            "MTL::RasterizationRateMapDescriptor",
            "rasterizationRateMapDescriptor",
            "static RasterizationRateMapDescriptor* rasterizationRateMapDescriptor(MTL::Size screenSize, const MTL::RasterizationRateLayerDescriptor* layer);",
        ): "metal::RasterizationRateMapDescriptor::with_layer",
        (
            "MTL::RasterizationRateMapDescriptor",
            "rasterizationRateMapDescriptor",
            "static RasterizationRateMapDescriptor* rasterizationRateMapDescriptor(MTL::Size screenSize, NS::UInteger layerCount, const MTL::RasterizationRateLayerDescriptor* const* layers);",
        ): "metal::RasterizationRateMapDescriptor::with_layers",
    }
)

ACTUAL_METHOD_SIGNATURES.update(
    {
        ("MTL::RenderCommandEncoder", "drawIndexedPatches", "void drawIndexedPatches(NS::UInteger numberOfPatchControlPoints, NS::UInteger patchStart, NS::UInteger patchCount, const MTL::Buffer* patchIndexBuffer, NS::UInteger patchIndexBufferOffset, const MTL::Buffer* controlPointIndexBuffer, NS::UInteger controlPointIndexBufferOffset, NS::UInteger instanceCount, NS::UInteger baseInstance);"): "metal::RenderCommandEncoder::draw_indexed_patches",
        ("MTL::RenderCommandEncoder", "drawIndexedPatches", "void drawIndexedPatches(NS::UInteger numberOfPatchControlPoints, const MTL::Buffer* patchIndexBuffer, NS::UInteger patchIndexBufferOffset, const MTL::Buffer* controlPointIndexBuffer, NS::UInteger controlPointIndexBufferOffset, const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset);"): "metal::RenderCommandEncoder::draw_indexed_patches_indirect",
        ("MTL::RenderCommandEncoder", "drawIndexedPrimitives", "void drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, const MTL::Buffer* indexBuffer, NS::UInteger indexBufferOffset, NS::UInteger instanceCount);"): "metal::RenderCommandEncoder::draw_indexed_primitives",
        ("MTL::RenderCommandEncoder", "drawIndexedPrimitives", "void drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, const MTL::Buffer* indexBuffer, NS::UInteger indexBufferOffset);"): "metal::RenderCommandEncoder::draw_indexed_primitives",
        ("MTL::RenderCommandEncoder", "drawIndexedPrimitives", "void drawIndexedPrimitives(MTL::PrimitiveType primitiveType, NS::UInteger indexCount, MTL::IndexType indexType, const MTL::Buffer* indexBuffer, NS::UInteger indexBufferOffset, NS::UInteger instanceCount, NS::Integer baseVertex, NS::UInteger baseInstance);"): "metal::RenderCommandEncoder::draw_indexed_primitives",
        ("MTL::RenderCommandEncoder", "drawIndexedPrimitives", "void drawIndexedPrimitives(MTL::PrimitiveType primitiveType, MTL::IndexType indexType, const MTL::Buffer* indexBuffer, NS::UInteger indexBufferOffset, const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset);"): "metal::RenderCommandEncoder::draw_indexed_primitives_indirect",
        ("MTL::RenderCommandEncoder", "drawMeshThreadgroups", "void drawMeshThreadgroups(MTL::Size threadgroupsPerGrid, MTL::Size threadsPerObjectThreadgroup, MTL::Size threadsPerMeshThreadgroup);"): "metal::RenderCommandEncoder::draw_mesh_threadgroups",
        ("MTL::RenderCommandEncoder", "drawMeshThreadgroups", "void drawMeshThreadgroups(const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset, MTL::Size threadsPerObjectThreadgroup, MTL::Size threadsPerMeshThreadgroup);"): "metal::RenderCommandEncoder::draw_mesh_threadgroups_indirect",
        ("MTL::RenderCommandEncoder", "drawPatches", "void drawPatches(NS::UInteger numberOfPatchControlPoints, NS::UInteger patchStart, NS::UInteger patchCount, const MTL::Buffer* patchIndexBuffer, NS::UInteger patchIndexBufferOffset, NS::UInteger instanceCount, NS::UInteger baseInstance);"): "metal::RenderCommandEncoder::draw_patches",
        ("MTL::RenderCommandEncoder", "drawPatches", "void drawPatches(NS::UInteger numberOfPatchControlPoints, const MTL::Buffer* patchIndexBuffer, NS::UInteger patchIndexBufferOffset, const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset);"): "metal::RenderCommandEncoder::draw_patches_indirect",
        ("MTL::RenderCommandEncoder", "drawPrimitives", "void drawPrimitives(MTL::PrimitiveType primitiveType, const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset);"): "metal::RenderCommandEncoder::draw_primitives_indirect",
        ("MTL::RenderCommandEncoder", "executeCommandsInBuffer", "void executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range executionRange);"): "metal::RenderCommandEncoder::execute_commands",
        ("MTL::RenderCommandEncoder", "executeCommandsInBuffer", "void executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandbuffer, const MTL::Buffer* indirectRangeBuffer, NS::UInteger indirectBufferOffset);"): "metal::RenderCommandEncoder::execute_commands_indirect",
        ("MTL::RenderCommandEncoder", "memoryBarrier", "void memoryBarrier(MTL::BarrierScope scope, MTL::RenderStages after, MTL::RenderStages before);"): "metal::RenderCommandEncoder::memory_barrier",
        ("MTL::RenderCommandEncoder", "memoryBarrier", "void memoryBarrier(const MTL::Resource* const resources[], NS::UInteger count, MTL::RenderStages after, MTL::RenderStages before);"): "metal::RenderCommandEncoder::memory_barriers",
        ("MTL::RenderCommandEncoder", "setFragmentSamplerState", "void setFragmentSamplerState(const MTL::SamplerState* sampler, NS::UInteger index);"): "metal::RenderCommandEncoder::set_fragment_sampler",
        ("MTL::RenderCommandEncoder", "setFragmentSamplerState", "void setFragmentSamplerState(const MTL::SamplerState* sampler, float lodMinClamp, float lodMaxClamp, NS::UInteger index);"): "metal::RenderCommandEncoder::set_fragment_sampler",
        ("MTL::RenderCommandEncoder", "setFragmentSamplerStates", "void setFragmentSamplerStates(const MTL::SamplerState* const samplers[], NS::Range range);"): "metal::RenderCommandEncoder::set_fragment_samplers",
        ("MTL::RenderCommandEncoder", "setFragmentSamplerStates", "void setFragmentSamplerStates(const MTL::SamplerState* const samplers[], const float lodMinClamps[], const float lodMaxClamps[], NS::Range range);"): "metal::RenderCommandEncoder::set_fragment_samplers_with_lod_clamps",
        ("MTL::RenderCommandEncoder", "setMeshSamplerState", "void setMeshSamplerState(const MTL::SamplerState* sampler, NS::UInteger index);"): "metal::RenderCommandEncoder::set_mesh_sampler",
        ("MTL::RenderCommandEncoder", "setMeshSamplerState", "void setMeshSamplerState(const MTL::SamplerState* sampler, float lodMinClamp, float lodMaxClamp, NS::UInteger index);"): "metal::RenderCommandEncoder::set_mesh_sampler",
        ("MTL::RenderCommandEncoder", "setMeshSamplerStates", "void setMeshSamplerStates(const MTL::SamplerState* const samplers[], NS::Range range);"): "metal::RenderCommandEncoder::set_mesh_samplers",
        ("MTL::RenderCommandEncoder", "setMeshSamplerStates", "void setMeshSamplerStates(const MTL::SamplerState* const samplers[], const float* lodMinClamps, const float* lodMaxClamps, NS::Range range);"): "metal::RenderCommandEncoder::set_mesh_samplers_with_lod_clamps",
        ("MTL::RenderCommandEncoder", "setObjectSamplerState", "void setObjectSamplerState(const MTL::SamplerState* sampler, NS::UInteger index);"): "metal::RenderCommandEncoder::set_object_sampler",
        ("MTL::RenderCommandEncoder", "setObjectSamplerState", "void setObjectSamplerState(const MTL::SamplerState* sampler, float lodMinClamp, float lodMaxClamp, NS::UInteger index);"): "metal::RenderCommandEncoder::set_object_sampler",
        ("MTL::RenderCommandEncoder", "setObjectSamplerStates", "void setObjectSamplerStates(const MTL::SamplerState* const samplers[], NS::Range range);"): "metal::RenderCommandEncoder::set_object_samplers",
        ("MTL::RenderCommandEncoder", "setObjectSamplerStates", "void setObjectSamplerStates(const MTL::SamplerState* const samplers[], const float* lodMinClamps, const float* lodMaxClamps, NS::Range range);"): "metal::RenderCommandEncoder::set_object_samplers_with_lod_clamps",
        ("MTL::RenderCommandEncoder", "setTileSamplerState", "void setTileSamplerState(const MTL::SamplerState* sampler, NS::UInteger index);"): "metal::RenderCommandEncoder::set_tile_sampler",
        ("MTL::RenderCommandEncoder", "setTileSamplerState", "void setTileSamplerState(const MTL::SamplerState* sampler, float lodMinClamp, float lodMaxClamp, NS::UInteger index);"): "metal::RenderCommandEncoder::set_tile_sampler",
        ("MTL::RenderCommandEncoder", "setTileSamplerStates", "void setTileSamplerStates(const MTL::SamplerState* const samplers[], NS::Range range);"): "metal::RenderCommandEncoder::set_tile_samplers",
        ("MTL::RenderCommandEncoder", "setTileSamplerStates", "void setTileSamplerStates(const MTL::SamplerState* const samplers[], const float lodMinClamps[], const float lodMaxClamps[], NS::Range range);"): "metal::RenderCommandEncoder::set_tile_samplers_with_lod_clamps",
        ("MTL::RenderCommandEncoder", "setVertexBuffer", "void setVertexBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index);"): "metal::RenderCommandEncoder::set_vertex_buffer_with_stride",
        ("MTL::RenderCommandEncoder", "setVertexBufferOffset", "void setVertexBufferOffset(NS::UInteger offset, NS::UInteger index);"): "metal::RenderCommandEncoder::set_vertex_buffer_offset",
        ("MTL::RenderCommandEncoder", "setVertexBufferOffset", "void setVertexBufferOffset(NS::UInteger offset, NS::UInteger stride, NS::UInteger index);"): "metal::RenderCommandEncoder::set_vertex_buffer_offset_with_stride",
        ("MTL::RenderCommandEncoder", "setVertexBuffers", "void setVertexBuffers(const MTL::Buffer* const buffers[], const NS::UInteger offsets[], NS::Range range);"): "metal::RenderCommandEncoder::set_vertex_buffers",
        ("MTL::RenderCommandEncoder", "setVertexBuffers", "void setVertexBuffers(const MTL::Buffer* const buffers[], const NS::UInteger* offsets, const NS::UInteger* strides, NS::Range range);"): "metal::RenderCommandEncoder::set_vertex_buffers_with_strides",
        ("MTL::RenderCommandEncoder", "setVertexBytes", "void setVertexBytes(const void* bytes, NS::UInteger length, NS::UInteger stride, NS::UInteger index);"): "metal::RenderCommandEncoder::set_vertex_bytes_with_stride",
        ("MTL::RenderCommandEncoder", "setVertexSamplerState", "void setVertexSamplerState(const MTL::SamplerState* sampler, NS::UInteger index);"): "metal::RenderCommandEncoder::set_vertex_sampler",
        ("MTL::RenderCommandEncoder", "setVertexSamplerState", "void setVertexSamplerState(const MTL::SamplerState* sampler, float lodMinClamp, float lodMaxClamp, NS::UInteger index);"): "metal::RenderCommandEncoder::set_vertex_sampler",
        ("MTL::RenderCommandEncoder", "setVertexSamplerStates", "void setVertexSamplerStates(const MTL::SamplerState* const samplers[], NS::Range range);"): "metal::RenderCommandEncoder::set_vertex_samplers",
        ("MTL::RenderCommandEncoder", "setVertexSamplerStates", "void setVertexSamplerStates(const MTL::SamplerState* const samplers[], const float lodMinClamps[], const float lodMaxClamps[], NS::Range range);"): "metal::RenderCommandEncoder::set_vertex_samplers_with_lod_clamps",
        ("MTL::RenderCommandEncoder", "useHeap", "void useHeap(const MTL::Heap* heap);"): "metal::RenderCommandEncoder::use_heap",
        ("MTL::RenderCommandEncoder", "useHeap", "void useHeap(const MTL::Heap* heap, MTL::RenderStages stages);"): "metal::RenderCommandEncoder::use_heap",
        ("MTL::RenderCommandEncoder", "useHeaps", "void useHeaps(const MTL::Heap* const heaps[], NS::UInteger count);"): "metal::RenderCommandEncoder::use_heaps",
        ("MTL::RenderCommandEncoder", "useHeaps", "void useHeaps(const MTL::Heap* const heaps[], NS::UInteger count, MTL::RenderStages stages);"): "metal::RenderCommandEncoder::use_heaps",
        ("MTL::RenderCommandEncoder", "deprecated", "[[deprecated( )]] void useResource(const MTL::Resource* resource, MTL::ResourceUsage usage);"): "metal::RenderCommandEncoder::use_resource",
        ("MTL::RenderCommandEncoder", "deprecated", "[[deprecated( )]] void useResources(const MTL::Resource* const resources[], NS::UInteger count, MTL::ResourceUsage usage);"): "metal::RenderCommandEncoder::use_resources",
    }
)

ACTUAL_METHODS.update(
    {
        # Compute encoder resource bindings and synchronization.
        ("MTL::ComputeCommandEncoder", "setSamplerStates"): "metal::ComputeCommandEncoder::set_sampler_states",
        ("MTL::ComputeCommandEncoder", "setVisibleFunctionTable"): "metal::ComputeCommandEncoder::set_visible_function_table",
        ("MTL::ComputeCommandEncoder", "setVisibleFunctionTables"): "metal::ComputeCommandEncoder::set_visible_function_tables",
        ("MTL::ComputeCommandEncoder", "setIntersectionFunctionTable"): "metal::ComputeCommandEncoder::set_intersection_function_table",
        ("MTL::ComputeCommandEncoder", "setIntersectionFunctionTables"): "metal::ComputeCommandEncoder::set_intersection_function_tables",
        ("MTL::ComputeCommandEncoder", "setAccelerationStructure"): "metal::ComputeCommandEncoder::set_acceleration_structure",
        ("MTL::ComputeCommandEncoder", "waitForFence"): "metal::ComputeCommandEncoder::wait_for_fence",
        ("MTL::ComputeCommandEncoder", "updateFence"): "metal::ComputeCommandEncoder::update_fence",
        ("MTL::ComputeCommandEncoder", "useHeap"): "metal::ComputeCommandEncoder::use_heap",
        ("MTL::ComputeCommandEncoder", "useHeaps"): "metal::ComputeCommandEncoder::use_heaps",
        ("MTL::ComputeCommandEncoder", "useResource"): "metal::ComputeCommandEncoder::use_resource",
        ("MTL::ComputeCommandEncoder", "useResources"): "metal::ComputeCommandEncoder::use_resources",
        ("MTL::ComputeCommandEncoder", "sampleCountersInBuffer"): "metal::ComputeCommandEncoder::sample_counters",
        # Blit methods whose inventory name is not overloaded.
        ("MTL::BlitCommandEncoder", "copyIndirectCommandBuffer"): "metal::BlitCommandEncoder::copy_indirect_commands",
        ("MTL::BlitCommandEncoder", "optimizeIndirectCommandBuffer"): "metal::BlitCommandEncoder::optimize_indirect_commands",
        ("MTL::BlitCommandEncoder", "resetCommandsInBuffer"): "metal::BlitCommandEncoder::reset_indirect_commands",
        ("MTL::BlitCommandEncoder", "resetTextureAccessCounters"): "metal::BlitCommandEncoder::reset_texture_access_counters",
        ("MTL::BlitCommandEncoder", "sampleCountersInBuffer"): "metal::BlitCommandEncoder::sample_counters",
        ("MTL::BlitCommandEncoder", "synchronizeBuffer"): "metal::BlitCommandEncoder::synchronize_buffer",
        ("MTL::BlitCommandEncoder", "updateFence"): "metal::BlitCommandEncoder::update_fence",
        ("MTL::BlitCommandEncoder", "waitForFence"): "metal::BlitCommandEncoder::wait_for_fence",
        # Argument encoder safe slice bindings.
        ("MTL::ArgumentEncoder", "newArgumentEncoder"): "metal::ArgumentEncoder::new_argument_encoder",
        ("MTL::ArgumentEncoder", "setBuffer"): "metal::ArgumentEncoder::set_buffer",
        ("MTL::ArgumentEncoder", "setBuffers"): "metal::ArgumentEncoder::set_buffers",
        ("MTL::ArgumentEncoder", "setTexture"): "metal::ArgumentEncoder::set_texture",
        ("MTL::ArgumentEncoder", "setTextures"): "metal::ArgumentEncoder::set_textures",
        ("MTL::ArgumentEncoder", "setAccelerationStructure"): "metal::ArgumentEncoder::set_acceleration_structure",
        ("MTL::ArgumentEncoder", "setComputePipelineState"): "metal::ArgumentEncoder::set_compute_pipeline_state",
        ("MTL::ArgumentEncoder", "setComputePipelineStates"): "metal::ArgumentEncoder::set_compute_pipeline_states",
        ("MTL::ArgumentEncoder", "setDepthStencilState"): "metal::ArgumentEncoder::set_depth_stencil_state",
        ("MTL::ArgumentEncoder", "setDepthStencilStates"): "metal::ArgumentEncoder::set_depth_stencil_states",
        ("MTL::ArgumentEncoder", "setIndirectCommandBuffer"): "metal::ArgumentEncoder::set_indirect_command_buffer",
        ("MTL::ArgumentEncoder", "setIndirectCommandBuffers"): "metal::ArgumentEncoder::set_indirect_command_buffers",
        ("MTL::ArgumentEncoder", "setIntersectionFunctionTable"): "metal::ArgumentEncoder::set_intersection_function_table",
        ("MTL::ArgumentEncoder", "setIntersectionFunctionTables"): "metal::ArgumentEncoder::set_intersection_function_tables",
        ("MTL::ArgumentEncoder", "setRenderPipelineState"): "metal::ArgumentEncoder::set_render_pipeline_state",
        ("MTL::ArgumentEncoder", "setRenderPipelineStates"): "metal::ArgumentEncoder::set_render_pipeline_states",
        ("MTL::ArgumentEncoder", "setSamplerState"): "metal::ArgumentEncoder::set_sampler_state",
        ("MTL::ArgumentEncoder", "setSamplerStates"): "metal::ArgumentEncoder::set_sampler_states",
        ("MTL::ArgumentEncoder", "setVisibleFunctionTable"): "metal::ArgumentEncoder::set_visible_function_table",
        ("MTL::ArgumentEncoder", "setVisibleFunctionTables"): "metal::ArgumentEncoder::set_visible_function_tables",
        # Indirect render/compute command state. Unsafe tessellation pointer
        # overloads intentionally remain absent.
        ("MTL::IndirectRenderCommand", "clearBarrier"): "metal::IndirectRenderCommand::clear_barrier",
        ("MTL::IndirectRenderCommand", "reset"): "metal::IndirectRenderCommand::reset",
        ("MTL::IndirectRenderCommand", "setBarrier"): "metal::IndirectRenderCommand::set_barrier",
        ("MTL::IndirectRenderCommand", "setCullMode"): "metal::IndirectRenderCommand::set_cull_mode",
        ("MTL::IndirectRenderCommand", "setDepthBias"): "metal::IndirectRenderCommand::set_depth_bias",
        ("MTL::IndirectRenderCommand", "setDepthClipMode"): "metal::IndirectRenderCommand::set_depth_clip_mode",
        ("MTL::IndirectRenderCommand", "setDepthStencilState"): "metal::IndirectRenderCommand::set_depth_stencil_state",
        ("MTL::IndirectRenderCommand", "setFragmentBuffer"): "metal::IndirectRenderCommand::set_fragment_buffer",
        ("MTL::IndirectRenderCommand", "setFrontFacingWinding"): "metal::IndirectRenderCommand::set_front_facing_winding",
        ("MTL::IndirectRenderCommand", "setMeshBuffer"): "metal::IndirectRenderCommand::set_mesh_buffer",
        ("MTL::IndirectRenderCommand", "setObjectBuffer"): "metal::IndirectRenderCommand::set_object_buffer",
        ("MTL::IndirectRenderCommand", "setObjectThreadgroupMemoryLength"): "metal::IndirectRenderCommand::set_object_threadgroup_memory_length",
        ("MTL::IndirectRenderCommand", "setRenderPipelineState"): "metal::IndirectRenderCommand::set_render_pipeline_state",
        ("MTL::IndirectRenderCommand", "setTriangleFillMode"): "metal::IndirectRenderCommand::set_triangle_fill_mode",
        ("MTL::IndirectRenderCommand", "drawPrimitives"): "metal::IndirectRenderCommand::draw_primitives",
        ("MTL::IndirectRenderCommand", "drawIndexedPrimitives"): "metal::IndirectRenderCommand::draw_indexed_primitives",
        ("MTL::IndirectRenderCommand", "drawMeshThreadgroups"): "metal::IndirectRenderCommand::draw_mesh_threadgroups",
        ("MTL::IndirectRenderCommand", "drawMeshThreads"): "metal::IndirectRenderCommand::draw_mesh_threads",
        ("MTL::IndirectComputeCommand", "clearBarrier"): "metal::IndirectComputeCommand::clear_barrier",
        ("MTL::IndirectComputeCommand", "reset"): "metal::IndirectComputeCommand::reset",
        ("MTL::IndirectComputeCommand", "setBarrier"): "metal::IndirectComputeCommand::set_barrier",
        ("MTL::IndirectComputeCommand", "setComputePipelineState"): "metal::IndirectComputeCommand::set_compute_pipeline_state",
        ("MTL::IndirectComputeCommand", "setImageblockWidth"): "metal::IndirectComputeCommand::set_imageblock_size",
        ("MTL::IndirectComputeCommand", "setStageInRegion"): "metal::IndirectComputeCommand::set_stage_in_region",
        ("MTL::IndirectComputeCommand", "setThreadgroupMemoryLength"): "metal::IndirectComputeCommand::set_threadgroup_memory_length",
        ("MTL::IndirectComputeCommand", "concurrentDispatchThreadgroups"): "metal::IndirectComputeCommand::concurrent_dispatch_threadgroups",
        ("MTL::IndirectComputeCommand", "concurrentDispatchThreads"): "metal::IndirectComputeCommand::concurrent_dispatch_threads",
        # Metal IO typestate, callbacks, and checked file/resource ranges.
        ("MTL::IOCommandQueue", "commandBuffer"): "metal::IoCommandQueue::command_buffer",
        ("MTL::IOCommandQueue", "commandBufferWithUnretainedReferences"): "metal::IoCommandQueue::command_buffer",
        ("MTL::IOCommandQueue", "enqueueBarrier"): "metal::IoCommandQueue::enqueue_barrier",
        ("MTL::IOCommandQueue", "label"): "metal::IoCommandQueue::label",
        ("MTL::IOCommandQueue", "setLabel"): "metal::IoCommandQueue::set_label",
        ("MTL::IOCommandBuffer", "addBarrier"): "metal::IoCommandBuffer::add_barrier",
        ("MTL::IOCommandBuffer", "addCompletedHandler"): "metal::IoCommandBuffer::on_complete",
        ("MTL::IOCommandBuffer", "commit"): "metal::IoCommandBuffer::commit",
        ("MTL::IOCommandBuffer", "copyStatusToBuffer"): "metal::IoCommandBuffer::copy_status_to_buffer",
        ("MTL::IOCommandBuffer", "enqueue"): "metal::IoCommandBuffer::enqueue",
        ("MTL::IOCommandBuffer", "error"): "metal::IoCommandBuffer::error",
        ("MTL::IOCommandBuffer", "label"): "metal::IoCommandBuffer::label",
        ("MTL::IOCommandBuffer", "loadBuffer"): "metal::IoCommandBuffer::load_buffer",
        ("MTL::IOCommandBuffer", "loadBytes"): "metal::IoCommandQueue::read_bytes",
        ("MTL::IOCommandBuffer", "loadTexture"): "metal::IoCommandBuffer::load_texture",
        ("MTL::IOCommandBuffer", "popDebugGroup"): "metal::IoCommandBuffer::pop_debug_group",
        ("MTL::IOCommandBuffer", "pushDebugGroup"): "metal::IoCommandBuffer::push_debug_group",
        ("MTL::IOCommandBuffer", "setLabel"): "metal::IoCommandBuffer::set_label",
        ("MTL::IOCommandBuffer", "signalEvent"): "metal::IoCommandBuffer::signal_event",
        ("MTL::IOCommandBuffer", "status"): "metal::IoCommandBuffer::status",
        ("MTL::IOCommandBuffer", "tryCancel"): "metal::SubmittedIoCommandBuffer::try_cancel",
        ("MTL::IOCommandBuffer", "wait"): "metal::IoCommandBuffer::wait_for_event",
        ("MTL::IOCommandBuffer", "waitUntilCompleted"): "metal::SubmittedIoCommandBuffer::wait",
        ("MTL::IOFileHandle", "label"): "metal::IoFileHandle::label",
        ("MTL::IOFileHandle", "setLabel"): "metal::IoFileHandle::set_label",
        # Acceleration-structure descriptors and command encoding.
        ("MTL::AccelerationStructure", "gpuResourceID"): "metal::AccelerationStructure::gpu_resource_id",
        ("MTL::PrimitiveAccelerationStructureDescriptor", "geometryDescriptors"): "metal::PrimitiveAccelerationStructureDescriptor::geometry_descriptors_vec",
        ("MTL::PrimitiveAccelerationStructureDescriptor", "setGeometryDescriptors"): "metal::PrimitiveAccelerationStructureDescriptor::set_geometry_descriptors_slice",
        ("MTL::AccelerationStructureMotionTriangleGeometryDescriptor", "vertexBuffers"): "metal::AccelerationStructureMotionTriangleGeometryDescriptor::vertex_buffers_vec",
        ("MTL::AccelerationStructureMotionTriangleGeometryDescriptor", "setVertexBuffers"): "metal::AccelerationStructureMotionTriangleGeometryDescriptor::set_vertex_buffers_slice",
        ("MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor", "boundingBoxBuffers"): "metal::AccelerationStructureMotionBoundingBoxGeometryDescriptor::bounding_box_buffers_vec",
        ("MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor", "setBoundingBoxBuffers"): "metal::AccelerationStructureMotionBoundingBoxGeometryDescriptor::set_bounding_box_buffers_slice",
        ("MTL::AccelerationStructureMotionCurveGeometryDescriptor", "controlPointBuffers"): "metal::AccelerationStructureMotionCurveGeometryDescriptor::control_point_buffers_vec",
        ("MTL::AccelerationStructureMotionCurveGeometryDescriptor", "setControlPointBuffers"): "metal::AccelerationStructureMotionCurveGeometryDescriptor::set_control_point_buffers_slice",
        ("MTL::AccelerationStructureMotionCurveGeometryDescriptor", "radiusBuffers"): "metal::AccelerationStructureMotionCurveGeometryDescriptor::radius_buffers_vec",
        ("MTL::AccelerationStructureMotionCurveGeometryDescriptor", "setRadiusBuffers"): "metal::AccelerationStructureMotionCurveGeometryDescriptor::set_radius_buffers_slice",
        ("MTL::InstanceAccelerationStructureDescriptor", "instancedAccelerationStructures"): "metal::InstanceAccelerationStructureDescriptor::instanced_acceleration_structures_vec",
        ("MTL::InstanceAccelerationStructureDescriptor", "setInstancedAccelerationStructures"): "metal::InstanceAccelerationStructureDescriptor::set_instanced_acceleration_structures_slice",
        ("MTL::AccelerationStructureCommandEncoder", "buildAccelerationStructure"): "metal::AccelerationStructureEncoder::build",
        ("MTL::AccelerationStructureCommandEncoder", "copyAccelerationStructure"): "metal::AccelerationStructureEncoder::copy",
        ("MTL::AccelerationStructureCommandEncoder", "copyAndCompactAccelerationStructure"): "metal::AccelerationStructureEncoder::copy_and_compact",
        ("MTL::AccelerationStructureCommandEncoder", "sampleCountersInBuffer"): "metal::AccelerationStructureEncoder::sample_counters",
        ("MTL::AccelerationStructureCommandEncoder", "updateFence"): "metal::AccelerationStructureEncoder::update_fence",
        ("MTL::AccelerationStructureCommandEncoder", "useHeap"): "metal::AccelerationStructureEncoder::use_heap",
        ("MTL::AccelerationStructureCommandEncoder", "useHeaps"): "metal::AccelerationStructureEncoder::use_heaps",
        ("MTL::AccelerationStructureCommandEncoder", "useResource"): "metal::AccelerationStructureEncoder::use_resource",
        ("MTL::AccelerationStructureCommandEncoder", "useResources"): "metal::AccelerationStructureEncoder::use_resources",
        ("MTL::AccelerationStructureCommandEncoder", "waitForFence"): "metal::AccelerationStructureEncoder::wait_for_fence",
        # Device value queries and unique-name factories.
        ("MTL::Device", "architecture"): "metal::Device::architecture",
        ("MTL::Device", "counterSets"): "metal::Device::counter_sets",
        ("MTL::Device", "accelerationStructureSizes"): "metal::Device::acceleration_structure_sizes",
        ("MTL::Device", "convertSparsePixelRegions"): "metal::Device::sparse_pixel_regions_to_tiles",
        ("MTL::Device", "convertSparseTileRegions"): "metal::Device::sparse_tile_regions_to_pixels",
        ("MTL::Device", "newBinaryArchive"): "metal::Device::new_binary_archive",
        ("MTL::Device", "newCounterSampleBuffer"): "metal::Device::new_counter_sample_buffer",
        ("MTL::Device", "newDepthStencilState"): "metal::Device::new_depth_stencil_state",
        ("MTL::Device", "newEvent"): "metal::Device::new_event",
        ("MTL::Device", "newFence"): "metal::Device::new_fence",
        ("MTL::Device", "newHeap"): "metal::Device::new_heap",
        ("MTL::Device", "newIndirectCommandBuffer"): "metal::Device::new_indirect_command_buffer",
        ("MTL::Device", "newRasterizationRateMap"): "metal::Device::new_rasterization_rate_map",
        ("MTL::Device", "newSamplerState"): "metal::Device::new_sampler_state",
        # Binary archives, function stitching, and function tables.
        ("MTL::BinaryArchiveDescriptor", "alloc"): "metal::BinaryArchiveDescriptor::new",
        ("MTL::BinaryArchiveDescriptor", "init"): "metal::BinaryArchiveDescriptor::new",
        ("MTL::BinaryArchiveDescriptor", "setUrl"): "metal::BinaryArchiveDescriptor::set_file_path",
        ("MTL::BinaryArchiveDescriptor", "url"): "metal::BinaryArchiveDescriptor::file_path",
        ("MTL::BinaryArchive", "addComputePipelineFunctions"): "metal::BinaryArchive::add_compute_pipeline_functions",
        ("MTL::BinaryArchive", "addFunction"): "metal::BinaryArchive::add_function",
        ("MTL::BinaryArchive", "addLibrary"): "metal::BinaryArchive::add_stitched_library",
        ("MTL::BinaryArchive", "addMeshRenderPipelineFunctions"): "metal::BinaryArchive::add_mesh_render_pipeline_functions",
        ("MTL::BinaryArchive", "addRenderPipelineFunctions"): "metal::BinaryArchive::add_render_pipeline_functions",
        ("MTL::BinaryArchive", "addTileRenderPipelineFunctions"): "metal::BinaryArchive::add_tile_render_pipeline_functions",
        ("MTL::BinaryArchive", "serializeToURL"): "metal::BinaryArchive::serialize_to_file",
        ("MTL::BinaryArchive", "setLabel"): "metal::BinaryArchive::set_optional_label",
        ("MTL::FunctionStitchingInputNode", "alloc"): "metal::FunctionStitchingInputNode::new",
        ("MTL::FunctionStitchingFunctionNode", "alloc"): "metal::FunctionStitchingFunctionNode::new",
        ("MTL::FunctionStitchingFunctionNode", "arguments"): "metal::FunctionStitchingFunctionNode::arguments_vec",
        ("MTL::FunctionStitchingFunctionNode", "controlDependencies"): "metal::FunctionStitchingFunctionNode::control_dependencies_vec",
        ("MTL::FunctionStitchingFunctionNode", "setArguments"): "metal::FunctionStitchingFunctionNode::set_arguments_slice",
        ("MTL::FunctionStitchingFunctionNode", "setControlDependencies"): "metal::FunctionStitchingFunctionNode::set_control_dependencies_slice",
        ("MTL::FunctionStitchingGraph", "alloc"): "metal::FunctionStitchingGraph::new",
        ("MTL::FunctionStitchingGraph", "attributes"): "metal::FunctionStitchingGraph::attributes_vec",
        ("MTL::FunctionStitchingGraph", "nodes"): "metal::FunctionStitchingGraph::nodes_vec",
        ("MTL::FunctionStitchingGraph", "setAttributes"): "metal::FunctionStitchingGraph::set_attributes_slice",
        ("MTL::FunctionStitchingGraph", "setNodes"): "metal::FunctionStitchingGraph::set_nodes_slice",
        ("MTL::StitchedLibraryDescriptor", "alloc"): "metal::StitchedLibraryDescriptor::new",
        ("MTL::StitchedLibraryDescriptor", "init"): "metal::StitchedLibraryDescriptor::new",
        ("MTL::StitchedLibraryDescriptor", "binaryArchives"): "metal::StitchedLibraryDescriptor::binary_archives_vec",
        ("MTL::StitchedLibraryDescriptor", "functionGraphs"): "metal::StitchedLibraryDescriptor::function_graphs_vec",
        ("MTL::StitchedLibraryDescriptor", "functions"): "metal::StitchedLibraryDescriptor::functions_vec",
        ("MTL::StitchedLibraryDescriptor", "setBinaryArchives"): "metal::StitchedLibraryDescriptor::set_binary_archives_slice",
        ("MTL::StitchedLibraryDescriptor", "setFunctionGraphs"): "metal::StitchedLibraryDescriptor::set_function_graphs_slice",
        ("MTL::StitchedLibraryDescriptor", "setFunctions"): "metal::StitchedLibraryDescriptor::set_functions_slice",
        ("MTL::VisibleFunctionTableDescriptor", "alloc"): "metal::VisibleFunctionTableDescriptor::new",
        ("MTL::VisibleFunctionTableDescriptor", "init"): "metal::VisibleFunctionTableDescriptor::new",
        ("MTL::VisibleFunctionTableDescriptor", "visibleFunctionTableDescriptor"): "metal::VisibleFunctionTableDescriptor::new",
        ("MTL::IntersectionFunctionTableDescriptor", "alloc"): "metal::IntersectionFunctionTableDescriptor::new",
        ("MTL::IntersectionFunctionTableDescriptor", "init"): "metal::IntersectionFunctionTableDescriptor::new",
        ("MTL::IntersectionFunctionTableDescriptor", "intersectionFunctionTableDescriptor"): "metal::IntersectionFunctionTableDescriptor::new",
        ("MTL::VisibleFunctionTable", "gpuResourceID"): "metal::VisibleFunctionTable::gpu_resource_id",
        ("MTL::VisibleFunctionTable", "setFunction"): "metal::VisibleFunctionTable::set_function",
        ("MTL::VisibleFunctionTable", "setFunctions"): "metal::VisibleFunctionTable::set_functions",
        ("MTL::IntersectionFunctionTable", "gpuResourceID"): "metal::IntersectionFunctionTable::gpu_resource_id",
        ("MTL::IntersectionFunctionTable", "setBuffer"): "metal::IntersectionFunctionTable::set_buffer",
        ("MTL::IntersectionFunctionTable", "setBuffers"): "metal::IntersectionFunctionTable::set_buffers",
        ("MTL::IntersectionFunctionTable", "setFunction"): "metal::IntersectionFunctionTable::set_function",
        ("MTL::IntersectionFunctionTable", "setFunctions"): "metal::IntersectionFunctionTable::set_functions",
        ("MTL::IntersectionFunctionTable", "setVisibleFunctionTable"): "metal::IntersectionFunctionTable::set_visible_function_table",
        ("MTL::IntersectionFunctionTable", "setVisibleFunctionTables"): "metal::IntersectionFunctionTable::set_visible_function_tables",
        # Tensor pointer/configuration APIs collapse into checked Rust layouts.
        ("MTL::TensorExtents", "alloc"): "metal::CheckedTensorExtents::new",
        ("MTL::TensorExtents", "extentAtDimensionIndex"): "metal::CheckedTensorExtents::get",
        ("MTL::TensorExtents", "rank"): "metal::CheckedTensorExtents::rank",
        ("MTL::TensorDescriptor", "dimensions"): "metal::CheckedTensorDescriptor::new",
        ("MTL::TensorDescriptor", "setDimensions"): "metal::CheckedTensorDescriptor::new",
        ("MTL::TensorDescriptor", "strides"): "metal::CheckedTensorDescriptor::new",
        ("MTL::TensorDescriptor", "setStrides"): "metal::CheckedTensorDescriptor::new",
        ("MTL::TensorDescriptor", "dataType"): "metal::CheckedTensorDescriptor::new",
        ("MTL::TensorDescriptor", "setDataType"): "metal::CheckedTensorDescriptor::new",
        ("MTL::TensorDescriptor", "usage"): "metal::CheckedTensorDescriptor::new",
        ("MTL::TensorDescriptor", "setUsage"): "metal::CheckedTensorDescriptor::new",
        ("MTL::TensorDescriptor", "resourceOptions"): "metal::CheckedTensorDescriptor::new",
        ("MTL::TensorDescriptor", "setResourceOptions"): "metal::CheckedTensorDescriptor::new",
        # Auxiliary encoders preserve the CommandBuffer exclusive borrow.
        ("MTL::ParallelRenderCommandEncoder", "renderCommandEncoder"): "metal::ParallelRenderCommandEncoder::render_encoder",
        ("MTL::ParallelRenderCommandEncoder", "setColorStoreAction"): "metal::ParallelRenderCommandEncoder::set_color_store_action",
        ("MTL::ParallelRenderCommandEncoder", "setColorStoreActionOptions"): "metal::ParallelRenderCommandEncoder::set_color_store_action_options",
        ("MTL::ParallelRenderCommandEncoder", "setDepthStoreAction"): "metal::ParallelRenderCommandEncoder::set_depth_store_action",
        ("MTL::ParallelRenderCommandEncoder", "setDepthStoreActionOptions"): "metal::ParallelRenderCommandEncoder::set_depth_store_action_options",
        ("MTL::ParallelRenderCommandEncoder", "setStencilStoreAction"): "metal::ParallelRenderCommandEncoder::set_stencil_store_action",
        ("MTL::ParallelRenderCommandEncoder", "setStencilStoreActionOptions"): "metal::ParallelRenderCommandEncoder::set_stencil_store_action_options",
        ("MTL::ResourceStateCommandEncoder", "moveTextureMappingsFromTexture"): "metal::ResourceStateCommandEncoder::move_texture_mappings",
        ("MTL::ResourceStateCommandEncoder", "updateFence"): "metal::ResourceStateCommandEncoder::update_fence",
        ("MTL::ResourceStateCommandEncoder", "updateTextureMappings"): "metal::ResourceStateCommandEncoder::update_texture_mappings",
        ("MTL::ResourceStateCommandEncoder", "waitForFence"): "metal::ResourceStateCommandEncoder::wait_for_fence",
    }
)

ACTUAL_METHOD_SIGNATURES.update(
    {
        ("MTL::ComputeCommandEncoder", "setSamplerState", "void setSamplerState(const MTL::SamplerState* sampler, NS::UInteger index);"): "metal::ComputeCommandEncoder::set_sampler_state",
        ("MTL::ComputeCommandEncoder", "setSamplerState", "void setSamplerState(const MTL::SamplerState* sampler, float lodMinClamp, float lodMaxClamp, NS::UInteger index);"): "metal::ComputeCommandEncoder::set_sampler_state_with_lod",
        ("MTL::ComputeCommandEncoder", "setSamplerStates", "void setSamplerStates(const MTL::SamplerState* const samplers[], const float lodMinClamps[], const float lodMaxClamps[], NS::Range range);"): "metal::ComputeCommandEncoder::set_sampler_states_with_lod",
        ("MTL::ComputeCommandEncoder", "memoryBarrier", "void memoryBarrier(MTL::BarrierScope scope);"): "metal::ComputeCommandEncoder::memory_barrier",
        ("MTL::ComputeCommandEncoder", "memoryBarrier", "void memoryBarrier(const MTL::Resource* const resources[], NS::UInteger count);"): "metal::ComputeCommandEncoder::memory_barriers",
        ("MTL::ComputeCommandEncoder", "executeCommandsInBuffer", "void executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandBuffer, NS::Range executionRange);"): "metal::ComputeCommandEncoder::execute_commands",
        ("MTL::ComputeCommandEncoder", "executeCommandsInBuffer", "void executeCommandsInBuffer(const MTL::IndirectCommandBuffer* indirectCommandbuffer, const MTL::Buffer* indirectRangeBuffer, NS::UInteger indirectBufferOffset);"): "metal::ComputeCommandEncoder::execute_commands_indirect",
        ("MTL::ArgumentEncoder", "setArgumentBuffer", "void setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger offset);"): "metal::ArgumentEncoder::set_argument_buffer",
        ("MTL::ArgumentEncoder", "setArgumentBuffer", "void setArgumentBuffer(const MTL::Buffer* argumentBuffer, NS::UInteger startOffset, NS::UInteger arrayElement);"): "metal::ArgumentEncoder::set_argument_buffer_element",
        ("MTL::IndirectRenderCommand", "setVertexBuffer", "void setVertexBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index);"): "metal::IndirectRenderCommand::set_vertex_buffer",
        ("MTL::IndirectRenderCommand", "setVertexBuffer", "void setVertexBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index);"): "metal::IndirectRenderCommand::set_vertex_buffer_with_stride",
        ("MTL::IndirectComputeCommand", "setKernelBuffer", "void setKernelBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger index);"): "metal::IndirectComputeCommand::set_kernel_buffer",
        ("MTL::IndirectComputeCommand", "setKernelBuffer", "void setKernelBuffer(const MTL::Buffer* buffer, NS::UInteger offset, NS::UInteger stride, NS::UInteger index);"): "metal::IndirectComputeCommand::set_kernel_buffer_with_stride",
        ("MTL::BlitCommandEncoder", "copyFromBuffer", "void copyFromBuffer(const MTL::Buffer* sourceBuffer, NS::UInteger sourceOffset, NS::UInteger sourceBytesPerRow, NS::UInteger sourceBytesPerImage, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin);"): "metal::BlitCommandEncoder::copy_buffer_to_texture",
        ("MTL::BlitCommandEncoder", "copyFromTexture", "void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, MTL::Origin destinationOrigin);"): "metal::BlitCommandEncoder::copy_texture_region",
        ("MTL::BlitCommandEncoder", "copyFromTexture", "void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, MTL::Origin sourceOrigin, MTL::Size sourceSize, const MTL::Buffer* destinationBuffer, NS::UInteger destinationOffset, NS::UInteger destinationBytesPerRow, NS::UInteger destinationBytesPerImage);"): "metal::BlitCommandEncoder::copy_texture_to_buffer",
        ("MTL::BlitCommandEncoder", "copyFromTexture", "void copyFromTexture(const MTL::Texture* sourceTexture, NS::UInteger sourceSlice, NS::UInteger sourceLevel, const MTL::Texture* destinationTexture, NS::UInteger destinationSlice, NS::UInteger destinationLevel, NS::UInteger sliceCount, NS::UInteger levelCount);"): "metal::BlitCommandEncoder::copy_texture_subresources",
        ("MTL::BlitCommandEncoder", "optimizeContentsForCPUAccess", "void optimizeContentsForCPUAccess(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level);"): "metal::BlitCommandEncoder::optimize_texture_slice_for_cpu",
        ("MTL::BlitCommandEncoder", "optimizeContentsForGPUAccess", "void optimizeContentsForGPUAccess(const MTL::Texture* texture, NS::UInteger slice, NS::UInteger level);"): "metal::BlitCommandEncoder::optimize_texture_slice_for_gpu",
        ("MTL::Device", "newIOCommandQueue", "IOCommandQueue* newIOCommandQueue(const MTL::IOCommandQueueDescriptor* descriptor, NS::Error** error);"): "metal::Device::new_io_command_queue",
        ("MTL::Device", "newIOFileHandle", "IOFileHandle* newIOFileHandle(const NS::URL* url, NS::Error** error);"): "metal::Device::new_io_file_handle",
        ("MTL::Device", "newIOFileHandle", "IOFileHandle* newIOFileHandle(const NS::URL* url, MTL::IOCompressionMethod compressionMethod, NS::Error** error);"): "metal::Device::new_io_file_handle",
        ("MTL::Device", "newIOHandle", "IOFileHandle* newIOHandle(const NS::URL* url, NS::Error** error);"): "metal::Device::new_io_file_handle",
        ("MTL::Device", "newIOHandle", "IOFileHandle* newIOHandle(const NS::URL* url, MTL::IOCompressionMethod compressionMethod, NS::Error** error);"): "metal::Device::new_io_file_handle",
        ("MTL::CommandBuffer", "accelerationStructureCommandEncoder", "AccelerationStructureCommandEncoder* accelerationStructureCommandEncoder();"): "metal::CommandBuffer::acceleration_structure_encoder",
        ("MTL::CommandBuffer", "accelerationStructureCommandEncoder", "AccelerationStructureCommandEncoder* accelerationStructureCommandEncoder(const MTL::AccelerationStructurePassDescriptor* descriptor);"): "metal::CommandBuffer::acceleration_structure_encoder_with_descriptor",
        ("MTL::AccelerationStructureCommandEncoder", "refitAccelerationStructure", "void refitAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructureDescriptor* descriptor, const MTL::AccelerationStructure* destinationAccelerationStructure, const MTL::Buffer* scratchBuffer, NS::UInteger scratchBufferOffset);"): "metal::AccelerationStructureEncoder::refit",
        ("MTL::AccelerationStructureCommandEncoder", "refitAccelerationStructure", "void refitAccelerationStructure(const MTL::AccelerationStructure* sourceAccelerationStructure, const MTL::AccelerationStructureDescriptor* descriptor, const MTL::AccelerationStructure* destinationAccelerationStructure, const MTL::Buffer* scratchBuffer, NS::UInteger scratchBufferOffset, MTL::AccelerationStructureRefitOptions options);"): "metal::AccelerationStructureEncoder::refit",
        ("MTL::AccelerationStructureCommandEncoder", "writeCompactedAccelerationStructureSize", "void writeCompactedAccelerationStructureSize(const MTL::AccelerationStructure* accelerationStructure, const MTL::Buffer* buffer, NS::UInteger offset);"): "metal::AccelerationStructureEncoder::write_compacted_size_u32",
        ("MTL::AccelerationStructureCommandEncoder", "writeCompactedAccelerationStructureSize", "void writeCompactedAccelerationStructureSize(const MTL::AccelerationStructure* accelerationStructure, const MTL::Buffer* buffer, NS::UInteger offset, MTL::DataType sizeDataType);"): "metal::AccelerationStructureEncoder::write_compacted_size_u64",
        ("MTL::Device", "heapTextureSizeAndAlign", "SizeAndAlign heapTextureSizeAndAlign(const MTL::TextureDescriptor* desc);"): "metal::Device::heap_texture_size_and_align",
        ("MTL::Device", "heapAccelerationStructureSizeAndAlign", "SizeAndAlign heapAccelerationStructureSizeAndAlign(const MTL::AccelerationStructureDescriptor* descriptor);"): "metal::Device::heap_acceleration_structure_descriptor_size_and_align",
        ("MTL::Device", "newCommandQueue", "CommandQueue* newCommandQueue(const MTL::CommandQueueDescriptor* descriptor);"): "metal::Device::new_command_queue_from_descriptor",
        ("MTL::Device", "newArgumentEncoder", "ArgumentEncoder* newArgumentEncoder(const NS::Array* arguments);"): "metal::Device::new_argument_encoder",
        ("MTL::Device", "newArgumentEncoder", "ArgumentEncoder* newArgumentEncoder(const MTL::BufferBinding* bufferBinding);"): "metal::Device::new_argument_encoder_from_buffer_binding",
        ("MTL::Device", "newBuffer", "Buffer* newBuffer(const void* pointer, NS::UInteger length, MTL::ResourceOptions options);"): "metal::Device::new_buffer_with_bytes",
        ("MTL::Device", "newBuffer", "Buffer* newBuffer(NS::UInteger length, MTL::ResourceOptions options, MTL::SparsePageSize placementSparsePageSize);"): "metal::Device::new_placement_sparse_buffer",
        ("MTL::Device", "newSharedTexture", "Texture* newSharedTexture(const MTL::TextureDescriptor* descriptor);"): "metal::Device::new_shared_texture",
        ("MTL::Device", "newSharedTexture", "Texture* newSharedTexture(const MTL::SharedTextureHandle* sharedHandle);"): "metal::Device::new_shared_texture_from_handle",
        ("MTL::Device", "newDefaultLibrary", "Library* newDefaultLibrary();"): "metal::Device::new_default_library",
        ("MTL::Device", "newSharedEvent", "SharedEvent* newSharedEvent();"): "metal::Device::new_shared_event",
        ("MTL::Device", "newSharedEvent", "SharedEvent* newSharedEvent(const MTL::SharedEventHandle* sharedEventHandle);"): "metal::Device::new_shared_event_from_handle",
        ("MTL::Device", "newDynamicLibrary", "DynamicLibrary* newDynamicLibrary(const MTL::Library* library, NS::Error** error);"): "metal::Device::new_dynamic_library",
        ("MTL::Device", "functionHandle", "FunctionHandle* functionHandle(const MTL::Function* function);"): "metal::Device::function_handle",
        ("MTL::Device", "newAccelerationStructure", "AccelerationStructure* newAccelerationStructure(NS::UInteger size);"): "metal::Device::new_acceleration_structure",
        ("MTL::Device", "newAccelerationStructure", "AccelerationStructure* newAccelerationStructure(const MTL::AccelerationStructureDescriptor* descriptor);"): "metal::Device::new_acceleration_structure_from_descriptor",
        ("MTL::FunctionStitchingInputNode", "init", "FunctionStitchingInputNode* init();"): "metal::FunctionStitchingInputNode::new",
        ("MTL::FunctionStitchingInputNode", "init", "FunctionStitchingInputNode* init(NS::UInteger argument);"): "metal::FunctionStitchingInputNode::with_argument_index",
        ("MTL::FunctionStitchingFunctionNode", "init", "FunctionStitchingFunctionNode* init();"): "metal::FunctionStitchingFunctionNode::new",
        ("MTL::FunctionStitchingFunctionNode", "init", "FunctionStitchingFunctionNode* init(const NS::String* name, const NS::Array* arguments, const NS::Array* controlDependencies);"): "metal::FunctionStitchingFunctionNode::with_details",
        ("MTL::FunctionStitchingGraph", "init", "FunctionStitchingGraph* init();"): "metal::FunctionStitchingGraph::new",
        ("MTL::FunctionStitchingGraph", "init", "FunctionStitchingGraph* init(const NS::String* functionName, const NS::Array* nodes, const MTL::FunctionStitchingFunctionNode* outputNode, const NS::Array* attributes);"): "metal::FunctionStitchingGraph::with_details",
        ("MTL::IntersectionFunctionTable", "setOpaqueTriangleIntersectionFunction", "void setOpaqueTriangleIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::UInteger index);"): "metal::IntersectionFunctionTable::set_opaque_triangle_function",
        ("MTL::IntersectionFunctionTable", "setOpaqueTriangleIntersectionFunction", "void setOpaqueTriangleIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::Range range);"): "metal::IntersectionFunctionTable::set_opaque_triangle_function_range",
        ("MTL::IntersectionFunctionTable", "setOpaqueCurveIntersectionFunction", "void setOpaqueCurveIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::UInteger index);"): "metal::IntersectionFunctionTable::set_opaque_curve_function",
        ("MTL::IntersectionFunctionTable", "setOpaqueCurveIntersectionFunction", "void setOpaqueCurveIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::Range range);"): "metal::IntersectionFunctionTable::set_opaque_curve_function_range",
        ("MTL::TensorExtents", "init", "TensorExtents* init();"): "metal::CheckedTensorExtents::new",
        ("MTL::TensorExtents", "init", "TensorExtents* init(NS::UInteger rank, const NS::Integer* values);"): "metal::CheckedTensorExtents::new",
        ("MTL::Buffer", "newTensor", "Tensor* newTensor(const MTL::TensorDescriptor* descriptor, NS::UInteger offset, NS::Error** error);"): "metal::Buffer::new_tensor",
        ("MTL::CommandBuffer", "parallelRenderCommandEncoder", "ParallelRenderCommandEncoder* parallelRenderCommandEncoder(const MTL::RenderPassDescriptor* renderPassDescriptor);"): "metal::CommandBuffer::parallel_render_encoder",
        ("MTL::CommandBuffer", "resourceStateCommandEncoder", "ResourceStateCommandEncoder* resourceStateCommandEncoder();"): "metal::CommandBuffer::resource_state_encoder",
        ("MTL::CommandBuffer", "resourceStateCommandEncoder", "ResourceStateCommandEncoder* resourceStateCommandEncoder(const MTL::ResourceStatePassDescriptor* resourceStatePassDescriptor);"): "metal::CommandBuffer::resource_state_encoder_with_descriptor",
        ("MTL::ResourceStateCommandEncoder", "updateTextureMapping", "void updateTextureMapping(const MTL::Texture* texture, const MTL::SparseTextureMappingMode mode, const MTL::Region region, const NS::UInteger mipLevel, const NS::UInteger slice);"): "metal::ResourceStateCommandEncoder::update_texture_mapping",
        ("MTL::ResourceStateCommandEncoder", "updateTextureMapping", "void updateTextureMapping(const MTL::Texture* texture, const MTL::SparseTextureMappingMode mode, const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset);"): "metal::ResourceStateCommandEncoder::update_texture_mapping_indirect",
    }
)

SUBSTITUTE_METHODS = {
    ("MTL::Buffer", "contents"),
    ("MTL::Buffer", "didModifyRange"),
    ("MTL::Texture", "getBytes"),
    ("MTL::CommandQueue", "commandBufferWithUnretainedReferences"),
    ("MTL::IOCommandQueue", "commandBufferWithUnretainedReferences"),
    ("MTL::IOCommandBuffer", "loadBytes"),
    ("MTL::Device", "newIOHandle"),
}

SLICE_SUBSTITUTE_METHODS = {
    ("MTL::LinkedFunctions", "setPrivateFunctions"),
    ("MTL4::StaticLinkingDescriptor", "setPrivateFunctionDescriptors"),
    ("MTL::FunctionDescriptor", "setBinaryArchives"),
    ("MTL4::StitchedFunctionDescriptor", "setFunctionDescriptors"),
    ("MTL4::RenderPassDescriptor", "setSamplePositions"),
    ("MTL::CompileOptions", "setLibraries"),
    ("MTL::CompileOptions", "setPreprocessorMacros"),
    ("MTL4::MachineLearningPipelineDescriptor", "setInputDimensions"),
    ("MTL::ComputeCommandEncoder", "setBuffers"),
    ("MTL::ComputeCommandEncoder", "setTextures"),
    ("MTL::CommandBuffer", "useResidencySets"),
    ("MTL::CommandQueue", "addResidencySets"),
    ("MTL::CommandQueue", "removeResidencySets"),
    ("MTL::ResidencySet", "addAllocations"),
    ("MTL::ResidencySet", "removeAllocations"),
    ("MTL::ComputeCommandEncoder", "setSamplerStates"),
    ("MTL::ComputeCommandEncoder", "setVisibleFunctionTables"),
    ("MTL::ComputeCommandEncoder", "setIntersectionFunctionTables"),
    ("MTL::ComputeCommandEncoder", "useHeaps"),
    ("MTL::ComputeCommandEncoder", "useResources"),
    ("MTL::ComputeCommandEncoder", "memoryBarrier"),
    ("MTL::ArgumentEncoder", "setBuffers"),
    ("MTL::ArgumentEncoder", "setTextures"),
    ("MTL::ArgumentEncoder", "setComputePipelineStates"),
    ("MTL::ArgumentEncoder", "setDepthStencilStates"),
    ("MTL::ArgumentEncoder", "setIndirectCommandBuffers"),
    ("MTL::ArgumentEncoder", "setIntersectionFunctionTables"),
    ("MTL::ArgumentEncoder", "setRenderPipelineStates"),
    ("MTL::ArgumentEncoder", "setSamplerStates"),
    ("MTL::ArgumentEncoder", "setVisibleFunctionTables"),
    ("MTL::PrimitiveAccelerationStructureDescriptor", "setGeometryDescriptors"),
    ("MTL::AccelerationStructureMotionTriangleGeometryDescriptor", "setVertexBuffers"),
    ("MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor", "setBoundingBoxBuffers"),
    ("MTL::AccelerationStructureMotionCurveGeometryDescriptor", "setControlPointBuffers"),
    ("MTL::AccelerationStructureMotionCurveGeometryDescriptor", "setRadiusBuffers"),
    ("MTL::InstanceAccelerationStructureDescriptor", "setInstancedAccelerationStructures"),
    ("MTL::AccelerationStructureCommandEncoder", "useHeaps"),
    ("MTL::AccelerationStructureCommandEncoder", "useResources"),
    ("MTL::Device", "convertSparsePixelRegions"),
    ("MTL::Device", "convertSparseTileRegions"),
    ("MTL::FunctionStitchingFunctionNode", "setArguments"),
    ("MTL::FunctionStitchingFunctionNode", "setControlDependencies"),
    ("MTL::FunctionStitchingGraph", "setAttributes"),
    ("MTL::FunctionStitchingGraph", "setNodes"),
    ("MTL::StitchedLibraryDescriptor", "setBinaryArchives"),
    ("MTL::StitchedLibraryDescriptor", "setFunctionGraphs"),
    ("MTL::StitchedLibraryDescriptor", "setFunctions"),
    ("MTL::VisibleFunctionTable", "setFunctions"),
    ("MTL::IntersectionFunctionTable", "setBuffers"),
    ("MTL::IntersectionFunctionTable", "setFunctions"),
    ("MTL::IntersectionFunctionTable", "setVisibleFunctionTables"),
    ("MTL::ResourceStateCommandEncoder", "updateTextureMappings"),
    ("MTL::RenderCommandEncoder", "setVertexBuffers"),
    ("MTL::RenderCommandEncoder", "setFragmentBuffers"),
    ("MTL::RenderCommandEncoder", "setTileBuffers"),
    ("MTL::RenderCommandEncoder", "setObjectBuffers"),
    ("MTL::RenderCommandEncoder", "setMeshBuffers"),
    ("MTL::RenderCommandEncoder", "setVertexTextures"),
    ("MTL::RenderCommandEncoder", "setFragmentTextures"),
    ("MTL::RenderCommandEncoder", "setTileTextures"),
    ("MTL::RenderCommandEncoder", "setObjectTextures"),
    ("MTL::RenderCommandEncoder", "setMeshTextures"),
    ("MTL::RenderCommandEncoder", "setVertexSamplerStates"),
    ("MTL::RenderCommandEncoder", "setFragmentSamplerStates"),
    ("MTL::RenderCommandEncoder", "setTileSamplerStates"),
    ("MTL::RenderCommandEncoder", "setObjectSamplerStates"),
    ("MTL::RenderCommandEncoder", "setMeshSamplerStates"),
    ("MTL::RenderCommandEncoder", "setVertexVisibleFunctionTables"),
    ("MTL::RenderCommandEncoder", "setFragmentVisibleFunctionTables"),
    ("MTL::RenderCommandEncoder", "setTileVisibleFunctionTables"),
    ("MTL::RenderCommandEncoder", "setVertexIntersectionFunctionTables"),
    ("MTL::RenderCommandEncoder", "setFragmentIntersectionFunctionTables"),
    ("MTL::RenderCommandEncoder", "setTileIntersectionFunctionTables"),
    ("MTL::RenderCommandEncoder", "setScissorRects"),
    ("MTL::RenderCommandEncoder", "setViewports"),
    ("MTL::RenderCommandEncoder", "setVertexAmplificationCount"),
    ("MTL::RenderCommandEncoder", "useHeaps"),
    ("MTL::RenderCommandEncoder", "useResources"),
    ("MTL4::PrimitiveAccelerationStructureDescriptor", "setGeometryDescriptors"),
    ("MTL4::CommandQueue", "commit"),
    ("MTL4::CommandQueue", "addResidencySets"),
    ("MTL4::CommandQueue", "removeResidencySets"),
    ("MTL4::CommandBuffer", "useResidencySets"),
    ("MTL4::CompilerTaskOptions", "setLookupArchives"),
    ("MTL4::StaticLinkingDescriptor", "setFunctionDescriptors"),
    ("MTL4::StaticLinkingDescriptor", "setPrivateFunctionDescriptors"),
    ("MTL4::StaticLinkingDescriptor", "setGroups"),
    ("MTL4::PipelineStageDynamicLinkingDescriptor", "setBinaryLinkedFunctions"),
    ("MTL4::PipelineStageDynamicLinkingDescriptor", "setPreloadedLibraries"),
    ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "setFragmentAdditionalBinaryFunctions"),
    ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "setMeshAdditionalBinaryFunctions"),
    ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "setObjectAdditionalBinaryFunctions"),
    ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "setTileAdditionalBinaryFunctions"),
    ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "setVertexAdditionalBinaryFunctions"),
}

for _parent, _methods in PIPELINE_DESCRIPTOR_METHODS.items():
    for _cpp_name, _rust_name in _methods.items():
        if _rust_name.startswith("set_") and (
            _rust_name.endswith("_slice")
            or _rust_name.endswith("_map")
        ):
            SLICE_SUBSTITUTE_METHODS.add((_parent, _cpp_name))

SLICE_SUBSTITUTE_SIGNATURES = {
    (
        "MTL::RasterizationRateMapDescriptor",
        "rasterizationRateMapDescriptor",
        "static RasterizationRateMapDescriptor* rasterizationRateMapDescriptor(MTL::Size screenSize, NS::UInteger layerCount, const MTL::RasterizationRateLayerDescriptor* const* layers);",
    ),
    (
        "MTL::Device",
        "newArgumentEncoder",
        "ArgumentEncoder* newArgumentEncoder(const NS::Array* arguments);",
    ),
    (
        "MTL::FunctionStitchingFunctionNode",
        "init",
        "FunctionStitchingFunctionNode* init(const NS::String* name, const NS::Array* arguments, const NS::Array* controlDependencies);",
    ),
    (
        "MTL::FunctionStitchingGraph",
        "init",
        "FunctionStitchingGraph* init(const NS::String* functionName, const NS::Array* nodes, const MTL::FunctionStitchingFunctionNode* outputNode, const NS::Array* attributes);",
    ),
    (
        "MTL::IntersectionFunctionTable",
        "setOpaqueTriangleIntersectionFunction",
        "void setOpaqueTriangleIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::Range range);",
    ),
    (
        "MTL::IntersectionFunctionTable",
        "setOpaqueCurveIntersectionFunction",
        "void setOpaqueCurveIntersectionFunction(MTL::IntersectionFunctionSignature signature, NS::Range range);",
    ),
    (
        "MTL::ResourceStateCommandEncoder",
        "updateTextureMapping",
        "void updateTextureMapping(const MTL::Texture* texture, const MTL::SparseTextureMappingMode mode, const MTL::Buffer* indirectBuffer, NS::UInteger indirectBufferOffset);",
    ),
    (
        "MTL::RenderCommandEncoder",
        "memoryBarrier",
        "void memoryBarrier(const MTL::Resource* const resources[], NS::UInteger count, MTL::RenderStages after, MTL::RenderStages before);",
    ),
    (
        "MTL::RenderCommandEncoder",
        "deprecated",
        "[[deprecated( )]] void useResources(const MTL::Resource* const resources[], NS::UInteger count, MTL::ResourceUsage usage);",
    ),
}

OWNED_COLLECTION_SUBSTITUTE_METHODS = {
    ("MTL::LinkedFunctions", "privateFunctions"),
    ("MTL4::StaticLinkingDescriptor", "privateFunctionDescriptors"),
    ("MTL::FunctionDescriptor", "binaryArchives"),
    ("MTL::CounterSet", "counters"),
    ("MTL::FunctionReflection", "bindings"),
    ("MTL::Tensor", "auxiliaryPlanes"),
    ("MTL4::StitchedFunctionDescriptor", "functionDescriptors"),
    ("MTL4::RenderPassDescriptor", "getSamplePositions"),
    ("MTL4::PipelineDataSetSerializer", "serializeAsPipelinesScript"),
    ("MTL::CommandBufferEncoderInfo", "debugSignposts"),
    ("MTL::CompileOptions", "libraries"),
    ("MTL::CompileOptions", "preprocessorMacros"),
    ("MTL4::MachineLearningPipelineReflection", "bindings"),
    ("MTL::Library", "functionNames"),
    ("MTL::Function", "functionConstantsDictionary"),
    ("MTL::Function", "stageInputAttributes"),
    ("MTL::Function", "vertexAttributes"),
    ("MTL::RasterizationRateLayerDescriptor", "horizontalSampleStorage"),
    ("MTL::RasterizationRateLayerDescriptor", "verticalSampleStorage"),
    ("MTL::RasterizationRateMapDescriptor", "layers"),
    ("MTL::ResidencySet", "allAllocations"),
    ("MTL::PrimitiveAccelerationStructureDescriptor", "geometryDescriptors"),
    ("MTL::AccelerationStructureMotionTriangleGeometryDescriptor", "vertexBuffers"),
    ("MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor", "boundingBoxBuffers"),
    ("MTL::AccelerationStructureMotionCurveGeometryDescriptor", "controlPointBuffers"),
    ("MTL::AccelerationStructureMotionCurveGeometryDescriptor", "radiusBuffers"),
    ("MTL::InstanceAccelerationStructureDescriptor", "instancedAccelerationStructures"),
    ("MTL::Device", "counterSets"),
    ("MTL::Device", "getDefaultSamplePositions"),
    ("MTL::FunctionStitchingFunctionNode", "arguments"),
    ("MTL::FunctionStitchingFunctionNode", "controlDependencies"),
    ("MTL::FunctionStitchingGraph", "attributes"),
    ("MTL::FunctionStitchingGraph", "nodes"),
    ("MTL::StitchedLibraryDescriptor", "binaryArchives"),
    ("MTL::StitchedLibraryDescriptor", "functionGraphs"),
    ("MTL::StitchedLibraryDescriptor", "functions"),
    ("MTL4::PrimitiveAccelerationStructureDescriptor", "geometryDescriptors"),
    ("MTL4::CompilerTaskOptions", "lookupArchives"),
    ("MTL4::StaticLinkingDescriptor", "functionDescriptors"),
    ("MTL4::StaticLinkingDescriptor", "privateFunctionDescriptors"),
    ("MTL4::StaticLinkingDescriptor", "groups"),
    ("MTL4::PipelineStageDynamicLinkingDescriptor", "binaryLinkedFunctions"),
    ("MTL4::PipelineStageDynamicLinkingDescriptor", "preloadedLibraries"),
    ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "fragmentAdditionalBinaryFunctions"),
    ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "meshAdditionalBinaryFunctions"),
    ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "objectAdditionalBinaryFunctions"),
    ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "tileAdditionalBinaryFunctions"),
    ("MTL4::RenderPipelineBinaryFunctionsDescriptor", "vertexAdditionalBinaryFunctions"),
    ("MTL::StructType", "members"),
    ("MTL::TensorReferenceType", "auxiliaryPlanes"),
    ("MTL::TensorBinding", "auxiliaryPlanes"),
}

for _parent, _methods in PIPELINE_DESCRIPTOR_METHODS.items():
    for _cpp_name, _rust_name in _methods.items():
        if (
            _rust_name.endswith("_vec")
            or _rust_name.endswith("_map")
        ):
            OWNED_COLLECTION_SUBSTITUTE_METHODS.add((_parent, _cpp_name))

CHECKED_INDEX_SUBSTITUTE_METHODS = {
    ("MTL::PipelineBufferDescriptorArray", "object"),
    ("MTL::PipelineBufferDescriptorArray", "setObject"),
    ("MTL::BlitPassSampleBufferAttachmentDescriptorArray", "object"),
    ("MTL::BlitPassSampleBufferAttachmentDescriptorArray", "setObject"),
    ("MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray", "object"),
    ("MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray", "setObject"),
    ("MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray", "object"),
    ("MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray", "setObject"),
    ("MTL::RenderPipelineColorAttachmentDescriptorArray", "object"),
    ("MTL::RenderPipelineColorAttachmentDescriptorArray", "setObject"),
    ("MTL::TileRenderPipelineColorAttachmentDescriptorArray", "object"),
    ("MTL::TileRenderPipelineColorAttachmentDescriptorArray", "setObject"),
}

RAII_SUBSTITUTE_METHODS = {
    ("MTL::CaptureScope", "beginScope"),
    ("MTL::CaptureScope", "endScope"),
    ("MTL::IOCommandBuffer", "addCompletedHandler"),
    ("MTL4::CommandBuffer", "beginCommandBuffer"),
    ("MTL4::CommandBuffer", "endCommandBuffer"),
    ("MTL4::CommandEncoder", "endEncoding"),
    ("MTL4::CommandQueue", "commit"),
}

POINTER_SUBSTITUTE_METHODS = {
    ("MTL::SharedEventListener", "dispatchQueue"),
    ("MTL::CaptureDescriptor", "captureObject"),
    ("MTL::CaptureDescriptor", "setCaptureObject"),
    ("MTL::RasterizationRateSampleArray", "object"),
    ("MTL::RasterizationRateSampleArray", "setObject"),
    ("MTL::RasterizationRateLayerArray", "object"),
    ("MTL::RasterizationRateLayerArray", "setObject"),
    ("MTL::Texture", "replaceRegion"),
    ("MTL::IOCommandBuffer", "loadBytes"),
    ("MTL::IOCommandQueue", "commandBufferWithUnretainedReferences"),
    ("MTL::Device", "newIOHandle"),
    ("MTL::BinaryArchiveDescriptor", "setUrl"),
    ("MTL::BinaryArchiveDescriptor", "url"),
    ("MTL::BinaryArchive", "serializeToURL"),
    ("MTL::RenderCommandEncoder", "setVertexBytes"),
    ("MTL::RenderCommandEncoder", "setFragmentBytes"),
    ("MTL::RenderCommandEncoder", "setTileBytes"),
    ("MTL::RenderCommandEncoder", "setObjectBytes"),
    ("MTL::RenderCommandEncoder", "setMeshBytes"),
}

for _parent, _cpp_name, _rust_name in METAL4_ACCELERATION_BUFFER_PROPERTIES:
    POINTER_SUBSTITUTE_METHODS.add(
        (_parent, f"set{_cpp_name[0].upper()}{_cpp_name[1:]}")
    )

POINTER_SUBSTITUTE_SIGNATURES = {
    (
        "MTL::Device",
        "newLibrary",
        "Library* newLibrary(const dispatch_data_t data, NS::Error** error);",
    ),
    (
        "MTL4::ArgumentTable",
        "setAddress",
        "void setAddress(MTL::GPUAddress gpuAddress, NS::UInteger bindingIndex);",
    ),
    (
        "MTL4::ArgumentTable",
        "setAddress",
        "void setAddress(MTL::GPUAddress gpuAddress, NS::UInteger stride, NS::UInteger bindingIndex);",
    ),
    (
        "MTL4::ArgumentTable",
        "setResource",
        "void setResource(MTL::ResourceID resourceID, NS::UInteger bindingIndex);",
    ),
    (
        "MTL4::ArgumentTable",
        "setSamplerState",
        "void setSamplerState(MTL::ResourceID resourceID, NS::UInteger bindingIndex);",
    ),
    (
        "MTL4::ArgumentTable",
        "setTexture",
        "void setTexture(MTL::ResourceID resourceID, NS::UInteger bindingIndex);",
    ),
    (
        "MTL::RasterizationRateLayerDescriptor",
        "init",
        "RasterizationRateLayerDescriptor* init(MTL::Size sampleCount, const float* horizontal, const float* vertical);",
    ),
    (
        "MTL::Device",
        "newBuffer",
        "Buffer* newBuffer(const void* pointer, NS::UInteger length, MTL::ResourceOptions options);",
    ),
    (
        "MTL::Device",
        "newBuffer",
        "Buffer* newBuffer(const void* pointer, NS::UInteger length, MTL::ResourceOptions options, void (^deallocator)(void*, NS::UInteger));",
    ),
    (
        "MTL::TensorExtents",
        "init",
        "TensorExtents* init(NS::UInteger rank, const NS::Integer* values);",
    ),
    (
        "MTL::SharedEventListener",
        "init",
        "SharedEventListener* init(const dispatch_queue_t dispatchQueue);",
    ),
}

TENSOR_DESCRIPTOR_SUBSTITUTE_METHODS = {
    ("MTL::TensorDescriptor", "dimensions"),
    ("MTL::TensorDescriptor", "setDimensions"),
    ("MTL::TensorDescriptor", "strides"),
    ("MTL::TensorDescriptor", "setStrides"),
    ("MTL::TensorDescriptor", "dataType"),
    ("MTL::TensorDescriptor", "setDataType"),
    ("MTL::TensorDescriptor", "usage"),
    ("MTL::TensorDescriptor", "setUsage"),
    ("MTL::TensorDescriptor", "resourceOptions"),
    ("MTL::TensorDescriptor", "setResourceOptions"),
}

SAFE_RETENTION_CONTRACT_METHODS = {
    ("MTL::CommandBufferDescriptor", "retainedReferences"),
    ("MTL::CommandBufferDescriptor", "setRetainedReferences"),
}

SCOPED_INDIRECT_COMMAND_SUBSTITUTE_METHODS = {
    ("MTL::IndirectCommandBuffer", "indirectComputeCommand"),
    ("MTL::IndirectCommandBuffer", "indirectRenderCommand"),
    ("MTL::IndirectCommandBuffer", "reset"),
}

SCOPED_ARGUMENT_SUBSTITUTE_METHODS = {
    ("MTL::ArgumentEncoder", "constantData"),
    ("MTL::IndirectRenderCommand", "drawIndexedPatches"),
    ("MTL::IndirectRenderCommand", "drawPatches"),
}

METAL4_COMMAND_SUBSTITUTE_METHODS = {
    ("MTL4::CommandQueue", "updateBufferMappings"),
    ("MTL4::CommandQueue", "copyBufferMappingsFromBuffer"),
    ("MTL4::CommandQueue", "updateTextureMappings"),
    ("MTL4::CommandQueue", "copyTextureMappingsFromTexture"),
    ("MTL4::RenderCommandEncoder", "drawIndexedPrimitives"),
    ("MTL4::RenderCommandEncoder", "drawPrimitives"),
    ("MTL4::RenderCommandEncoder", "drawMeshThreadgroups"),
    ("MTL4::RenderCommandEncoder", "executeCommandsInBuffer"),
    ("MTL4::RenderCommandEncoder", "setScissorRects"),
    ("MTL4::RenderCommandEncoder", "setVertexAmplificationCount"),
    ("MTL4::RenderCommandEncoder", "setViewports"),
    ("MTL4::ComputeCommandEncoder", "dispatchThreadgroups"),
    ("MTL4::ComputeCommandEncoder", "dispatchThreads"),
    ("MTL4::ComputeCommandEncoder", "executeCommandsInBuffer"),
}

METAL4_COMPLETION_SUBSTITUTE_METHODS = {
    ("MTL4::CommandBuffer", "resolveCounterHeap"),
    ("MTL4::CommandEncoder", "commandBuffer"),
    ("MTL4::CommandQueueDescriptor", "feedbackQueue"),
    ("MTL4::CommandQueueDescriptor", "setFeedbackQueue"),
    ("MTL4::CommitFeedback", "error"),
}

SAFE_RETENTION_CONTRACT_SIGNATURES = {
    (
        "MTL::CommandQueue",
        "commandBuffer",
        "CommandBuffer* commandBuffer(const MTL::CommandBufferDescriptor* descriptor);",
    ),
}

CALLBACK_SUBSTITUTE_SIGNATURES = {
    key
    for key in ACTUAL_METHOD_SIGNATURES
    if (key[0] == "MTL4::Compiler" and "CompilerTask*" in key[2])
    or (key[0] == "MTL::Device" and "CompletionHandler" in key[2])
    or (key[0] == "MTL::Library" and "completionHandler" in key[2])
    or key[0] == "MTL::LogState"
    or key[1] in {"addPresentedHandler", "notifyListener"}
}

PATH_SUBSTITUTE_SIGNATURES = {
    key
    for key in ACTUAL_METHOD_SIGNATURES
    if key[0] in {"MTL4::Compiler", "MTL::Device"} and "NS::URL*" in key[2]
}

PATH_SUBSTITUTE_METHODS = {
    ("MTL4::PipelineDataSetSerializer", "serializeAsArchiveAndFlushToURL"),
    ("MTL::DynamicLibrary", "serializeToURL"),
}

SAFE_COUNTER_HEAP_SUBSTITUTE_SIGNATURES = {
    (
        "MTL::Device",
        "newCounterHeap",
        "MTL4::CounterHeap* newCounterHeap(const MTL4::CounterHeapDescriptor* descriptor, NS::Error** error);",
    ),
}

IOSURFACE_SUBSTITUTE_SIGNATURES = {
    (
        "MTL::Device",
        "newTexture",
        "Texture* newTexture(const MTL::TextureDescriptor* descriptor, const IOSurfaceRef iosurface, NS::UInteger plane);",
    ),
}

TEXTURE_VIEW_POOL_SUBSTITUTE_SIGNATURES = {
    key
    for key in ACTUAL_METHOD_SIGNATURES
    if key[0] == "MTL::TextureViewPool"
    and ("TextureViewDescriptor" in key[2] or key[1] == "setTextureViewFromBuffer")
}

BLIT_SAFE_SUBSTITUTE_SIGNATURES = {
    key
    for key in ACTUAL_METHOD_SIGNATURES
    if key[0] == "MTL::BlitCommandEncoder"
    and key[1]
    in {
        "getTextureAccessCounters",
        "resolveCounters",
        "synchronizeResource",
    }
    or (
        key[0] == "MTL::BlitCommandEncoder"
        and "MTL::BlitOption options" in key[2]
    )
    or (
        key[0] == "MTL::BlitCommandEncoder"
        and key[1] == "copyFromTensor"
        and "TensorPlaneType" in key[2]
    )
}

METAL4_BLIT_SUBSTITUTE_SIGNATURES = {
    key
    for key, rust in ACTUAL_METHOD_SIGNATURES.items()
    if key[0] == "MTL4::ComputeCommandEncoder"
    and rust
    in {
        "metal4::RecordingComputeEncoder::copy_buffer_to_texture",
        "metal4::RecordingComputeEncoder::copy_texture_to_buffer",
        "metal4::RecordingComputeEncoder::copy_texture_region",
        "metal4::RecordingComputeEncoder::copy_tensor",
    }
}

METAL4_ACCELERATION_SUBSTITUTE_SIGNATURES = {
    key
    for key in ACTUAL_METHOD_SIGNATURES
    if key[0] == "MTL4::ComputeCommandEncoder"
    and "AccelerationStructure" in key[1]
}

CHECKED_TENSOR_ATTACHMENT_SUBSTITUTE_METHODS = {
    ("MTL::TensorBufferAttachments", "buffer"),
    ("MTL::TensorBufferAttachments", "offset"),
    ("MTL::TensorBufferAttachments", "setBuffer"),
}

RESOURCE_TAIL_SUBSTITUTE_METHODS = {
    ("MTL::Resource", "setOwner"),
    ("MTL::ResourceViewPool", "copyResourceViewsFromPool"),
}

CAPTURE_SINGLETON_SUBSTITUTE_METHODS = {
    ("MTL::CaptureManager", "alloc"),
    ("MTL::CaptureManager", "init"),
}

TENSOR_READ_WRITE_SUBSTITUTE_METHODS = {
    ("MTL::Tensor", "getBytes"),
    ("MTL::Tensor", "replaceSliceOrigin"),
}

ENCODER_FACTORY_SUBSTITUTE_METHODS = {
    ("MTL::CommandBuffer", "computeCommandEncoder"),
    ("MTL::CommandBuffer", "renderCommandEncoder"),
}

DEVICE_CHECKED_TENSOR_SIGNATURES = {
    key
    for key in ACTUAL_METHOD_SIGNATURES
    if key[0] == "MTL::Device" and key[1] in {"newTensor", "tensorSizeAndAlign"}
}

FUNCTION_CONSTANT_SUBSTITUTE_SIGNATURES = {
    key
    for key in ACTUAL_METHOD_SIGNATURES
    if key[0] == "MTL::FunctionConstantValues"
}

PIPELINE_STATE_SUBSTITUTE_METHODS = {
    ("MTL::ComputePipelineState", "functionHandle"),
    ("MTL::ComputePipelineState", "newComputePipelineStateWithBinaryFunctions"),
    ("MTL::RenderPipelineState", "functionHandle"),
    ("MTL::RenderPipelineState", "newRenderPipelineState"),
}

SHADER_TAIL_SUBSTITUTE_METHODS = {
    ("MTL::CounterSampleBuffer", "resolveCounterRange"),
    ("MTL::FunctionLogDebugLocation", "URL"),
}

FUNCTION_REFLECTION_SUBSTITUTE_SIGNATURES = {
    (
        "MTL::Function",
        "newArgumentEncoder",
        "ArgumentEncoder* newArgumentEncoder(NS::UInteger bufferIndex, const MTL::AutoreleasedArgument* reflection);",
    ),
}

SAFE_RENAME_SUBSTITUTE_SIGNATURES = {
    key
    for key in ACTUAL_METHOD_SIGNATURES
    if key[0]
    in {
        "MTL::Argument",
        "MTL::Binding",
        "MTL::TextureBinding",
        "MTL::RenderPipelineColorAttachmentDescriptor",
        "MTL::MeshRenderPipelineDescriptor",
        "MTL::VertexAttribute",
        "MTL::Attribute",
        "MTL::DepthStencilDescriptor",
        "MTL4::MeshRenderPipelineDescriptor",
        "MTL4::RenderPipelineDescriptor",
    }
    and key[1] == "deprecated"
}

RUNTIME_AVAILABILITY_PARENTS = {
    "MTL::TensorAuxiliaryPlaneDescriptorMap",
    "MTL::Tensor",
    "MTL::BlitPassDescriptor",
    "MTL::ResourceStatePassDescriptor",
    "MTL::PrimitiveAccelerationStructureDescriptor",
    "MTL::AccelerationStructureTriangleGeometryDescriptor",
    "MTL::AccelerationStructureBoundingBoxGeometryDescriptor",
    "MTL::MotionKeyframeData",
    "MTL::AccelerationStructureMotionTriangleGeometryDescriptor",
    "MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor",
    "MTL::AccelerationStructureCurveGeometryDescriptor",
    "MTL::AccelerationStructureMotionCurveGeometryDescriptor",
    "MTL::InstanceAccelerationStructureDescriptor",
    "MTL::IndirectInstanceAccelerationStructureDescriptor",
    "MTL::AccelerationStructurePassDescriptor",
    "MTL::VertexBufferLayoutDescriptorArray",
    "MTL::VertexAttributeDescriptorArray",
    "MTL::VertexDescriptor",
    "MTL::BufferLayoutDescriptorArray",
    "MTL::AttributeDescriptorArray",
    "MTL::StageInputOutputDescriptor",
    "MTL::CaptureDescriptor",
    "MTL::CaptureManager",
    "MTL::CaptureScope",
    "MTL::ComputePassDescriptor",
    "MTL::RasterizationRateLayerArray",
    "MTL::RasterizationRateLayerDescriptor",
    "MTL::RasterizationRateMap",
    "MTL::RasterizationRateMapDescriptor",
    "MTL::RasterizationRateSampleArray",
    "MTL::ResidencySet",
    "MTL::IOCommandBuffer",
    "MTL::IOCommandQueue",
    "MTL::IOFileHandle",
    "MTL::AccelerationStructure",
    "MTL::AccelerationStructureCommandEncoder",
    "MTL::BinaryArchive",
    "MTL::BinaryArchiveDescriptor",
    "MTL::FunctionStitchingFunctionNode",
    "MTL::FunctionStitchingGraph",
    "MTL::FunctionStitchingInputNode",
    "MTL::IntersectionFunctionTable",
    "MTL::IntersectionFunctionTableDescriptor",
    "MTL::StitchedLibraryDescriptor",
    "MTL::VisibleFunctionTable",
    "MTL::VisibleFunctionTableDescriptor",
    "MTL::ParallelRenderCommandEncoder",
    "MTL::ResourceStateCommandEncoder",
    "MTL::Drawable",
    "MTL::SharedEvent",
    "MTL::SharedEventListener",
    "MTL::StructMember",
    "MTL::StructType",
    "MTL::ArrayType",
    "MTL::PointerType",
    "MTL::TensorReferenceType",
    "MTL::TensorBinding",
    "MTL::TextureViewDescriptor",
}
RUNTIME_AVAILABILITY_PARENTS.update(PIPELINE_DESCRIPTOR_METHODS)

RUNTIME_AVAILABILITY_RUST_METHODS = {
    "metal::ArgumentDescriptor::new",
    "metal::FunctionDescriptor::new",
    "metal::SamplerDescriptor::r_address_mode",
    "metal::SamplerDescriptor::set_r_address_mode",
    "metal::SamplerState::gpu_resource_id",
    "metal::DepthStencilState::gpu_resource_id",
    "metal::FunctionHandle::gpu_resource_id",
    "metal::LinkedFunctions::new",
    "metal::IoScratchBufferAllocator::new_scratch_buffer",
    "metal::TextureViewPool::set_texture_view",
    "metal::RasterizationRateMap::physical_size",
    "metal::Device::new_default_library_from_bundle",
    "metal::CommandEncoder::barrier_after_queue_stages",
    "metal::Device::function_handle_from_binary",
    "metal::Device::new_mtl4_command_allocator",
    "metal::Device::new_mtl4_command_allocator_from_descriptor",
    "metal::Device::new_mtl4_compiler",
    "metal::Device::new_mtl4_command_queue_from_descriptor",
    "metal::Device::new_pipeline_data_set_serializer",
    "metal::Device::new_residency_set",
    "metal::Device::new_texture_view_pool",
    "metal::Device::size_of_counter_heap_entry",
    "metal::Resource::is_aliasable",
    "metal::Resource::make_aliasable",
    "metal::Resource::set_purgeable_state",
    "metal::ResourceViewPool::base_resource_id",
    "metal::Device::new_mtl4_argument_table",
    # Newer render-encoder selectors are weakly checked by the safe FFI layer.
    "metal::RenderCommandEncoder::dispatch_threads_per_tile",
    "metal::RenderCommandEncoder::draw_indexed_patches",
    "metal::RenderCommandEncoder::draw_indexed_patches_indirect",
    "metal::RenderCommandEncoder::draw_mesh_threadgroups",
    "metal::RenderCommandEncoder::draw_mesh_threadgroups_indirect",
    "metal::RenderCommandEncoder::draw_mesh_threads",
    "metal::RenderCommandEncoder::draw_patches",
    "metal::RenderCommandEncoder::draw_patches_indirect",
    "metal::RenderCommandEncoder::execute_commands",
    "metal::RenderCommandEncoder::execute_commands_indirect",
    "metal::RenderCommandEncoder::memory_barrier",
    "metal::RenderCommandEncoder::memory_barriers",
    "metal::RenderCommandEncoder::sample_counters",
    "metal::RenderCommandEncoder::set_color_attachment_map",
    "metal::RenderCommandEncoder::set_depth_clip_mode",
    "metal::RenderCommandEncoder::set_depth_test_bounds",
    "metal::RenderCommandEncoder::set_fragment_acceleration_structure",
    "metal::RenderCommandEncoder::set_mesh_buffer",
    "metal::RenderCommandEncoder::set_mesh_buffer_offset",
    "metal::RenderCommandEncoder::set_mesh_buffers",
    "metal::RenderCommandEncoder::set_mesh_bytes",
    "metal::RenderCommandEncoder::set_mesh_sampler",
    "metal::RenderCommandEncoder::set_mesh_samplers",
    "metal::RenderCommandEncoder::set_mesh_samplers_with_lod_clamps",
    "metal::RenderCommandEncoder::set_mesh_texture",
    "metal::RenderCommandEncoder::set_mesh_textures",
    "metal::RenderCommandEncoder::set_object_buffer",
    "metal::RenderCommandEncoder::set_object_buffer_offset",
    "metal::RenderCommandEncoder::set_object_buffers",
    "metal::RenderCommandEncoder::set_object_bytes",
    "metal::RenderCommandEncoder::set_object_sampler",
    "metal::RenderCommandEncoder::set_object_samplers",
    "metal::RenderCommandEncoder::set_object_samplers_with_lod_clamps",
    "metal::RenderCommandEncoder::set_object_texture",
    "metal::RenderCommandEncoder::set_object_textures",
    "metal::RenderCommandEncoder::set_object_threadgroup_memory_length",
    "metal::RenderCommandEncoder::set_threadgroup_memory_length",
    "metal::RenderCommandEncoder::set_tile_acceleration_structure",
    "metal::RenderCommandEncoder::set_tile_buffer",
    "metal::RenderCommandEncoder::set_tile_buffer_offset",
    "metal::RenderCommandEncoder::set_tile_buffers",
    "metal::RenderCommandEncoder::set_tile_bytes",
    "metal::RenderCommandEncoder::set_tile_intersection_function_table",
    "metal::RenderCommandEncoder::set_tile_intersection_function_tables",
    "metal::RenderCommandEncoder::set_tile_sampler",
    "metal::RenderCommandEncoder::set_tile_samplers",
    "metal::RenderCommandEncoder::set_tile_samplers_with_lod_clamps",
    "metal::RenderCommandEncoder::set_tile_texture",
    "metal::RenderCommandEncoder::set_tile_textures",
    "metal::RenderCommandEncoder::set_tile_visible_function_table",
    "metal::RenderCommandEncoder::set_tile_visible_function_tables",
    "metal::RenderCommandEncoder::set_vertex_acceleration_structure",
    "metal::RenderCommandEncoder::set_vertex_amplification",
    "metal::RenderCommandEncoder::texture_barrier",
    "metal::RenderCommandEncoder::tile_size",
    "metal::RenderCommandEncoder::update_fence",
    "metal::RenderCommandEncoder::use_heap",
    "metal::RenderCommandEncoder::use_heaps",
    "metal::RenderCommandEncoder::use_resource",
    "metal::RenderCommandEncoder::use_resources",
    "metal::RenderCommandEncoder::wait_for_fence",
}

FOUNDATION_CONSTANTS = {
    "BundleDidLoadNotification": "foundation::BUNDLE_DID_LOAD_NOTIFICATION",
    "BundleResourceRequestLowDiskSpaceNotification": "foundation::BUNDLE_RESOURCE_REQUEST_LOW_DISK_SPACE_NOTIFICATION",
    "ProcessInfoThermalStateDidChangeNotification": "foundation::PROCESS_INFO_THERMAL_STATE_DID_CHANGE_NOTIFICATION",
    "ProcessInfoPowerStateDidChangeNotification": "foundation::PROCESS_INFO_POWER_STATE_DID_CHANGE_NOTIFICATION",
    "ProcessInfoPerformanceProfileDidChangeNotification": "foundation::PROCESS_INFO_PERFORMANCE_PROFILE_DID_CHANGE_NOTIFICATION",
    "CocoaErrorDomain": "foundation::COCOA_ERROR_DOMAIN",
    "POSIXErrorDomain": "foundation::POSIX_ERROR_DOMAIN",
    "OSStatusErrorDomain": "foundation::OS_STATUS_ERROR_DOMAIN",
    "MachErrorDomain": "foundation::MACH_ERROR_DOMAIN",
    "UnderlyingErrorKey": "foundation::UNDERLYING_ERROR_KEY",
    "LocalizedDescriptionKey": "foundation::LOCALIZED_DESCRIPTION_KEY",
    "LocalizedFailureReasonErrorKey": "foundation::LOCALIZED_FAILURE_REASON_ERROR_KEY",
    "LocalizedRecoverySuggestionErrorKey": "foundation::LOCALIZED_RECOVERY_SUGGESTION_ERROR_KEY",
    "LocalizedRecoveryOptionsErrorKey": "foundation::LOCALIZED_RECOVERY_OPTIONS_ERROR_KEY",
    "RecoveryAttempterErrorKey": "foundation::RECOVERY_ATTEMPTER_ERROR_KEY",
    "HelpAnchorErrorKey": "foundation::HELP_ANCHOR_ERROR_KEY",
    "DebugDescriptionErrorKey": "foundation::DEBUG_DESCRIPTION_ERROR_KEY",
    "LocalizedFailureErrorKey": "foundation::LOCALIZED_FAILURE_ERROR_KEY",
    "StringEncodingErrorKey": "foundation::STRING_ENCODING_ERROR_KEY",
    "URLErrorKey": "foundation::URL_ERROR_KEY",
    "FilePathErrorKey": "foundation::FILE_PATH_ERROR_KEY",
    "NotFound": "foundation::NOT_FOUND",
    "IntegerMax": "foundation::INTEGER_MAX",
    "IntegerMin": "foundation::INTEGER_MIN",
    "UIntegerMax": "foundation::UINTEGER_MAX",
    "DeviceCertificationiPhonePerformanceGaming": "foundation::DeviceCertification::iphone_performance_gaming",
    "ProcessPerformanceProfileDefault": "foundation::ProcessPerformanceProfile::default_profile",
    "ProcessPerformanceProfileSustained": "foundation::ProcessPerformanceProfile::sustained",
}

FOUNDATION_AVAILABILITY_CONSTANTS = {
    "DeviceCertificationiPhonePerformanceGaming",
    "ProcessPerformanceProfileDefault",
    "ProcessPerformanceProfileSustained",
}

METAL_CONSTANTS = {
    "BinaryArchiveDomain": "metal::binary_archive_error_domain",
    "CounterErrorDomain": "metal::counter_error_domain",
    "CommonCounterTimestamp": "metal::CommonCounter::timestamp",
    "CommonCounterTessellationInputPatches": "metal::CommonCounter::tessellation_input_patches",
    "CommonCounterVertexInvocations": "metal::CommonCounter::vertex_invocations",
    "CommonCounterPostTessellationVertexInvocations": "metal::CommonCounter::post_tessellation_vertex_invocations",
    "CommonCounterClipperInvocations": "metal::CommonCounter::clipper_invocations",
    "CommonCounterClipperPrimitivesOut": "metal::CommonCounter::clipper_primitives_out",
    "CommonCounterFragmentInvocations": "metal::CommonCounter::fragment_invocations",
    "CommonCounterFragmentsPassed": "metal::CommonCounter::fragments_passed",
    "CommonCounterComputeKernelInvocations": "metal::CommonCounter::compute_kernel_invocations",
    "CommonCounterTotalCycles": "metal::CommonCounter::total_cycles",
    "CommonCounterVertexCycles": "metal::CommonCounter::vertex_cycles",
    "CommonCounterTessellationCycles": "metal::CommonCounter::tessellation_cycles",
    "CommonCounterPostTessellationVertexCycles": "metal::CommonCounter::post_tessellation_vertex_cycles",
    "CommonCounterFragmentCycles": "metal::CommonCounter::fragment_cycles",
    "CommonCounterRenderTargetWriteCycles": "metal::CommonCounter::render_target_write_cycles",
    "CommonCounterSetTimestamp": "metal::CommonCounterSet::timestamp",
    "CommonCounterSetStageUtilization": "metal::CommonCounterSet::stage_utilization",
    "CommonCounterSetStatistic": "metal::CommonCounterSet::statistic",
    "DeviceWasAddedNotification": "metal::DeviceNotificationName::device_was_added",
    "DeviceRemovalRequestedNotification": "metal::DeviceNotificationName::device_removal_requested",
    "DeviceWasRemovedNotification": "metal::DeviceNotificationName::device_was_removed",
    "CommandBufferEncoderInfoErrorKey": "metal::command_buffer_encoder_info_error_key",
    "IOErrorDomain": "metal::io_error_domain",
    "LogStateErrorDomain": "metal::log_state_error_domain",
    "TensorDomain": "metal::tensor_error_domain",
}

METAL_FUNCTIONS = {
    "IOCompressionContextDefaultChunkSize": "metal::IoCompressionContext::default_chunk_size",
    "IOCreateCompressionContext": "metal::IoCompressionContext::new",
    "IOCompressionContextAppendData": "metal::IoCompressionContext::append",
    "IOFlushAndDestroyCompressionContext": "metal::IoCompressionContext::finish",
}

METAL_GLOBAL_FUNCTIONS = {
    "CopyAllDevices": "metal::Device::all",
    "CopyAllDevicesWithObserver": "metal::Device::all_with_observer",
    "RemoveDeviceObserver": "metal::DeviceObserverRegistration",
}

METAL_VERSION_MACROS = {
    "METALCPP_VERSION_MAJOR": "metal::METAL_CPP_VERSION_MAJOR",
    "METALCPP_VERSION_MINOR": "metal::METAL_CPP_VERSION_MINOR",
    "METALCPP_VERSION_PATCH": "metal::METAL_CPP_VERSION_PATCH",
    "METALCPP_SUPPORTS_VERSION": "metal::metal_cpp_supports_version",
}

CALLBACK_ALIAS_MAPPINGS = {
    "MTL4::CommitFeedbackHandler": "metal4::SubmittedCommandBuffers::wait",
    "MTL4::CommitFeedbackHandlerFunction": "metal4::SubmittedCommandBuffers::wait",
    "MTL::FunctionCompletionHandlerFunction": "metal::Library::function_with_descriptor_async",
    "MTL::LogHandlerFunction": "metal::LogState::add_log_handler",
    "MTL::NewDynamicLibraryCompletionHandler": "metal4::Compiler::new_dynamic_library_async",
    "MTL::NewDynamicLibraryCompletionHandlerFunction": "metal4::Compiler::new_dynamic_library_async",
    "MTL4::NewComputePipelineStateCompletionHandler": "metal4::Compiler::new_compute_pipeline_async",
    "MTL4::NewComputePipelineStateCompletionHandlerFunction": "metal4::Compiler::new_compute_pipeline_async",
    "MTL4::NewRenderPipelineStateCompletionHandler": "metal4::Compiler::new_render_pipeline_async",
    "MTL4::NewRenderPipelineStateCompletionHandlerFunction": "metal4::Compiler::new_render_pipeline_async",
    "MTL4::NewBinaryFunctionCompletionHandler": "metal4::Compiler::new_binary_function_async",
    "MTL4::NewBinaryFunctionCompletionHandlerFunction": "metal4::Compiler::new_binary_function_async",
    "MTL4::NewMachineLearningPipelineStateCompletionHandler": "metal4::Compiler::new_machine_learning_pipeline_async",
    "MTL4::NewMachineLearningPipelineStateCompletionHandlerFunction": "metal4::Compiler::new_machine_learning_pipeline_async",
    "MTL::CommandBufferHandler": "metal::CommandBuffer::on_complete",
    "MTL::HandlerFunction": "metal::CommandBuffer::on_complete",
    "MTL::DeviceNotificationHandlerBlock": "metal::Device::all_with_observer",
    "MTL::DeviceNotificationHandlerFunction": "metal::Device::all_with_observer",
    "MTL::NewLibraryCompletionHandler": "metal::Device::new_library_from_source_async",
    "MTL::NewLibraryCompletionHandlerFunction": "metal::Device::new_library_from_source_async",
    "MTL::NewRenderPipelineStateCompletionHandler": "metal::Device::new_render_pipeline_async",
    "MTL::NewRenderPipelineStateCompletionHandlerFunction": "metal::Device::new_render_pipeline_async",
    "MTL::NewRenderPipelineStateWithReflectionCompletionHandler": "metal::Device::new_render_pipeline_with_reflection_async",
    "MTL::NewRenderPipelineStateWithReflectionCompletionHandlerFunction": "metal::Device::new_render_pipeline_with_reflection_async",
    "MTL::NewComputePipelineStateCompletionHandler": "metal::Device::new_compute_pipeline_async",
    "MTL::NewComputePipelineStateCompletionHandlerFunction": "metal::Device::new_compute_pipeline_async",
    "MTL::NewComputePipelineStateWithReflectionCompletionHandler": "metal::Device::new_compute_pipeline_with_reflection_async",
    "MTL::NewComputePipelineStateWithReflectionCompletionHandlerFunction": "metal::Device::new_compute_pipeline_with_reflection_async",
    "MTL::IOCommandBufferHandler": "metal::IoCommandBuffer::on_complete",
    "MTL::IOCommandBufferHandlerFunction": "metal::IoCommandBuffer::on_complete",
    "MTL::DrawablePresentedHandler": "metal::Drawable::on_presented",
    "MTL::DrawablePresentedHandlerFunction": "metal::Drawable::on_presented",
    "MTL::SharedEventNotificationBlock": "metal::SharedEvent::notify_at",
    "MTL::SharedEventNotificationFunction": "metal::SharedEvent::notify_at",
}

OWNED_ALIAS_SUBSTITUTES = {
    "MTL::AutoreleasedArgument": "metal::Argument",
    "MTL::AutoreleasedComputePipelineReflection": "metal::ComputePipelineReflection",
    "MTL::AutoreleasedRenderPipelineReflection": "metal::RenderPipelineReflection",
}

COMMIT_FEEDBACK_ALIASES = {
    "MTL4::CommitFeedbackHandler",
    "MTL4::CommitFeedbackHandlerFunction",
}

COMMIT_FEEDBACK_SUBSTITUTE_SIGNATURES = {
    key
    for key in ACTUAL_METHOD_SIGNATURES
    if key[0] == "MTL4::CommitOptions" and key[1] == "addFeedbackHandler"
}


def actual_mapping(declaration: dict[str, Any]) -> str | None:
    qualified_name = declaration["qualified_name"]
    if declaration["kind"] == "class":
        return ACTUAL_CLASSES.get(qualified_name) or FOUNDATION_SUBSTITUTE_CLASSES.get(qualified_name)
    if declaration["kind"] == "method":
        signature_mapping = ACTUAL_METHOD_SIGNATURES.get(
            (
                declaration.get("parent", ""),
                declaration["name"],
                declaration["signature"],
            )
        )
        return signature_mapping or ACTUAL_METHODS.get(
            (declaration.get("parent", ""), declaration["name"])
        ) or FOUNDATION_SUBSTITUTE_METHODS.get((declaration.get("parent", ""), declaration["name"]))
    if declaration["kind"] in {"alias", "enum", "options", "struct"}:
        if qualified_name in {"NS::ObserverBlock", "NS::ObserverFunction"}:
            return "foundation::NotificationCenter::add_observer"
        if qualified_name == "MTL::IOCompressionContext":
            return "metal::IoCompressionContext"
        if qualified_name in CALLBACK_ALIAS_MAPPINGS:
            return CALLBACK_ALIAS_MAPPINGS[qualified_name]
        if qualified_name in OWNED_ALIAS_SUBSTITUTES:
            return OWNED_ALIAS_SUBSTITUTES[qualified_name]
        value_mapping = ACTUAL_VALUES.get(qualified_name)
        if value_mapping:
            return value_mapping
    if declaration["kind"] == "field":
        if declaration.get("parent") == "NS::FastEnumerationState":
            return "foundation::Enumerator"
        parent_mapping = ACTUAL_VALUES.get(declaration.get("parent", ""))
        if parent_mapping:
            return f"{parent_mapping}::{snake_case(declaration['name'])}"
    if declaration["kind"] == "function" and declaration["name"] == "CreateSystemDefaultDevice":
        return "metal::Device::system_default"
    if declaration["kind"] == "function" and declaration["framework"] == "Metal":
        return METAL_GLOBAL_FUNCTIONS.get(declaration["name"]) or METAL_FUNCTIONS.get(
            declaration["name"]
        )
    if declaration["kind"] == "constant" and declaration["name"] == "MAX_TIMESTAMP_COUNTERS":
        return "metal::MAX_TIMESTAMP_COUNTERS"
    if declaration["kind"] == "constant" and declaration["framework"] == "Metal":
        return METAL_CONSTANTS.get(declaration["name"])
    if declaration["kind"] == "constant" and declaration["framework"] == "Foundation":
        return FOUNDATION_CONSTANTS.get(declaration["name"])
    if declaration["kind"] == "struct" and qualified_name == "NS::FastEnumerationState":
        return "foundation::Enumerator"
    if declaration["kind"] == "macro" and declaration["name"] == "MTLSTR":
        return "foundation::String::from"
    if declaration["kind"] == "macro":
        return METAL_VERSION_MACROS.get(declaration["name"])
    return None


def generated_value_mapping(declaration: dict[str, Any]) -> str | None:
    qualified_name = declaration["qualified_name"]
    if declaration["kind"] == "enum_member":
        manual = MANUAL_ENUM_MEMBERS.get((declaration.get("parent", ""), declaration["name"]))
        if manual:
            return manual
    if declaration["framework"] not in {"Foundation", "Metal"}:
        return None
    if declaration["kind"] in {"enum", "options"}:
        if qualified_name in MANUAL_TYPES:
            return None
        name = qualified_name.rsplit("::", 1)[-1]
        return f"{module_for(qualified_name)}::{name}"
    if declaration["kind"] == "enum_member":
        parent = declaration.get("parent", "")
        if parent in EXTENSIBLE_MANUAL_TYPES:
            name = parent.rsplit("::", 1)[-1]
            return f"metal::{name}::{declaration['name']}"
        if parent in MANUAL_TYPES:
            return None
        name = parent.rsplit("::", 1)[-1]
        return f"{module_for(parent)}::{name}::{declaration['name']}"
    return None


def generated_struct_mapping(declaration: dict[str, Any]) -> str | None:
    if declaration["framework"] not in {"Foundation", "Metal"}:
        return None
    if declaration["kind"] == "struct":
        qualified_name = declaration["qualified_name"]
        if qualified_name in MANUAL_STRUCTS:
            return None
        name = qualified_name.rsplit("::", 1)[-1]
        return f"{module_for(qualified_name)}::{name}"
    if declaration["kind"] == "field":
        parent = declaration.get("parent", "")
        if parent in MANUAL_STRUCTS:
            return None
        name = parent.rsplit("::", 1)[-1]
        return f"{module_for(parent)}::{name}::{snake_case(declaration['name'])}"
    return None


def generated_object_mapping(declaration: dict[str, Any]) -> str | None:
    if declaration["kind"] != "class" or "::" not in declaration["qualified_name"]:
        return None
    qualified_name = declaration["qualified_name"]
    if qualified_name not in generated_object_mapping.available:
        return None
    return f"{module_for(qualified_name)}::{qualified_name.rsplit('::', 1)[-1]}"


generated_object_mapping.available = set()  # type: ignore[attr-defined]


def mapping_for(
    declaration: dict[str, Any], generated_methods: dict[str, str], generated_aliases: dict[str, str]
) -> dict[str, str]:
    direct = actual_mapping(declaration)
    if direct:
        if (
            declaration.get("qualified_name") in FOUNDATION_SUBSTITUTE_CLASSES
            or (declaration.get("parent", ""), declaration["name"])
            in FOUNDATION_SUBSTITUTE_METHODS
            or declaration.get("qualified_name") == "NS::FastEnumerationState"
            or declaration.get("parent") == "NS::FastEnumerationState"
            or (declaration["kind"] == "macro" and declaration["name"] == "MTLSTR")
            or declaration.get("qualified_name") in {"NS::ObserverBlock", "NS::ObserverFunction"}
        ):
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The Foundation ownership, collection, pointer, or enumeration helper is replaced by an owned Rust value, trait, iterator, or RAII operation.",
                "evidence": "public Rust-native Foundation substitute with no Objective-C pointer exposure",
            }
        if declaration.get("qualified_name") in TYPESTATE_SUBSTITUTE_CLASSES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The cloneable protocol shell is replaced by a non-cloneable command-buffer or encoder typestate that enforces recording and submission order.",
                "evidence": "public typestate facade with exclusive encoder ownership",
            }
        if declaration.get("name") in METAL_GLOBAL_FUNCTIONS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The Objective-C device array and observer token are replaced by an owned Vec<Device>, a repeatable Rust closure, and an RAII registration.",
                "evidence": "owned device discovery plus panic-isolated RAII observer state",
            }
        if declaration.get("name") in METAL_VERSION_MACROS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The preprocessor-only reference version helper is represented by typed Rust constants and a const capability predicate.",
                "evidence": "canonical public Rust constants and const function",
            }
        if (
            declaration.get("qualified_name") == "MTL::IOCompressionContext"
            or declaration.get("name") in METAL_FUNCTIONS
        ):
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The raw compression context and free-function lifetime are replaced by an owned IoCompressionContext with new/append/finish and Drop cleanup.",
                "evidence": "safe RAII facade with checked byte slices and explicit terminal status",
            }
        if declaration.get("qualified_name") in COMMIT_FEEDBACK_ALIASES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The native commit-feedback callback is replaced by consuming submission typestate and an explicit wait that returns owned completion state.",
                "evidence": "SubmittedCommandBuffers::wait consumes the submission and preserves completion ordering",
            }
        if declaration.get("qualified_name") in CALLBACK_ALIAS_MAPPINGS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The native callback ABI alias is replaced by a panic-isolated Rust closure accepted by the safe facade.",
                "evidence": "safe closure adapter with owned callback state",
            }
        if declaration.get("qualified_name") in OWNED_ALIAS_SUBSTITUTES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The non-owning autoreleased C++ alias is replaced by the owned facade value returned from the safe factory.",
                "evidence": "owned RAII facade with no autorelease lifetime exposure",
            }
        method_key = (declaration.get("parent", ""), declaration["name"])
        method_signature_key = (
            declaration.get("parent", ""),
            declaration["name"],
            declaration["signature"],
        )
        if method_signature_key in CALLBACK_SUBSTITUTE_SIGNATURES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The Objective-C block or C++ function callback is replaced by a panic-isolated FnOnce + Send + 'static closure and an owned result or task.",
                "evidence": "safe one-shot callback state machine with owned result/error conversion",
            }
        if method_signature_key in COMMIT_FEEDBACK_SUBSTITUTE_SIGNATURES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The feedback block is installed internally by submit; consuming wait returns the owned completion Result without exposing feedback ABI or callback state.",
                "evidence": "submission typestate, panic-isolated feedback adapter, and consuming completion wait",
            }
        if (
            method_signature_key in PATH_SUBSTITUTE_SIGNATURES
            or method_key in PATH_SUBSTITUTE_METHODS
        ):
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The NSURL parameter is replaced by a borrowed Rust Path and converted inside the audited FFI boundary.",
                "evidence": "safe Rust path facade and selector-gated FFI conversion",
            }
        if method_signature_key in SAFE_RENAME_SUBSTITUTE_SIGNATURES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The deprecated helper spelling is represented by the canonical checked Rust predicate.",
                "evidence": "selector-gated safe facade with explicit Boolean semantics",
            }
        if method_key in VALUE_HELPER_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The C++ convenience constructor or unchecked subscript is represented by a Default-capable Rust value with public typed fields or an owned fixed-size array.",
                "evidence": "generated safe Rust value representation with no raw storage access",
            }
        if method_signature_key in SAFE_COUNTER_HEAP_SUBSTITUTE_SIGNATURES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The general descriptor factory is narrowed to a validated timestamp-counter count with an owned heap and a fixed upper bound.",
                "evidence": "checked timestamp counter factory with no descriptor or raw counter storage exposure",
            }
        if method_signature_key in IOSURFACE_SUBSTITUTE_SIGNATURES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The raw IOSurfaceRef is replaced by an owned IoSurface identity with checked plane selection and nil/error conversion.",
                "evidence": "owned IOSurface RAII wrapper and selector-gated texture factory",
            }
        if method_signature_key in TEXTURE_VIEW_POOL_SUBSTITUTE_SIGNATURES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The pool overload is replaced by a checked same-device descriptor/view construction with alignment, range, and index validation.",
                "evidence": "owned intermediate texture view and selector-gated pool update",
            }
        if method_signature_key in BLIT_SAFE_SUBSTITUTE_SIGNATURES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The raw output-buffer, generic Resource, tensor-plane, or format-dependent blit overload is narrowed to checked typed resources and submission-bound owned staging results.",
                "evidence": "typed blit facade with range/layout validation and submission identity",
            }
        if method_signature_key in METAL4_BLIT_SUBSTITUTE_SIGNATURES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "Parallel offsets, strides, slices, levels, and option overloads are replaced by validated image-layout and texture-selection value objects.",
                "evidence": "recording typestate blit with overflow, range, and subresource validation",
            }
        if method_signature_key in METAL4_ACCELERATION_SUBSTITUTE_SIGNATURES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "Opaque MTL4 BufferRange GPU addresses are derived internally from typed Buffer ranges with device, alignment, span, and overlap checks.",
                "evidence": "recording typestate acceleration commands with no public GPU address",
            }
        if method_key in CHECKED_TENSOR_ATTACHMENT_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The plane-indexed attachment API is replaced by a checked plane, retained Buffer, validated offset, and complete TensorLayout proof.",
                "evidence": "owned checked tensor attachment map with no raw plane storage exposure",
            }
        if method_key in RESOURCE_TAIL_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The raw owner token or unchecked pool copy is replaced by an opaque owned identity and checked same-device Rust ranges.",
                "evidence": "typed resource ownership and range-checked pool facade",
            }
        if method_key in CAPTURE_SINGLETON_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "Standalone Objective-C manager allocation is replaced by the process capture singleton and scoped RAII capture operations.",
                "evidence": "owned capture session facade with no public allocation helper",
            }
        if method_key in TENSOR_READ_WRITE_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "Raw caller-owned tensor memory is replaced by checked origin/dimension/layout slices and owned Vec<u8> reads or borrowed &[u8] writes.",
                "evidence": "tensor span, plane, stride, storage-mode, and byte-length validation",
            }
        if method_key in ENCODER_FACTORY_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The native encoder shell is replaced by an exclusive borrow of the recording CommandBuffer and a Drop-balanced encoding lifetime.",
                "evidence": "non-cloneable encoder typestate prevents commit while recording",
            }
        if method_signature_key in DEVICE_CHECKED_TENSOR_SIGNATURES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The independently mutable tensor descriptor and attachment pointers are replaced by checked layout and attachment proofs with same-device validation.",
                "evidence": "checked tensor factory with owned NSError conversion and no Objective-C collection exposure",
            }
        if method_signature_key in FUNCTION_CONSTANT_SUBSTITUTE_SIGNATURES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The untyped constant pointer is replaced by an aligned checked byte slice with exact DataType width and range validation.",
                "evidence": "safe byte-slice constant facade with no raw pointer exposure",
            }
        if method_key in PIPELINE_STATE_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "Function identity and Objective-C binary-function arrays are replaced by checked name lookup or borrowed Rust slices with owned Error conversion.",
                "evidence": "safe pipeline derivation and function-handle facade",
            }
        if method_key in SHADER_TAIL_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The NSRange/NSData or NSURL result is replaced by a checked Rust range and owned optional Vec<u8> or String.",
                "evidence": "owned Rust result with selector and range validation",
            }
        if method_signature_key in FUNCTION_REFLECTION_SUBSTITUTE_SIGNATURES:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The autoreleased reflection out-value is returned as an owned optional Argument beside the safe encoder.",
                "evidence": "owned tuple result with checked argument-buffer index",
            }
        if method_key in RAII_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The independently callable begin/end pair is replaced by a scoped RAII operation that always balances teardown, including during unwinding.",
                "evidence": "safe closure facade and audited Drop guard",
            }
        if method_key in TENSOR_DESCRIPTOR_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "Independently mutable tensor dimensions, strides, data type, usage, and resource options are replaced by one validated CheckedTensorDescriptor construction.",
                "evidence": "checked tensor layout proof with exact byte-span validation",
            }
        if (
            method_key in SAFE_RETENTION_CONTRACT_METHODS
            or method_signature_key in SAFE_RETENTION_CONTRACT_SIGNATURES
        ):
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The facade accepts the descriptor only under its resource-retention invariant and rejects retainedReferences=false before creating a command buffer.",
                "evidence": "safe descriptor facade plus command-queue invariant check",
            }
        if method_key in SCOPED_INDIRECT_COMMAND_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The unchecked command lookup or NSRange reset is replaced by checked indexing/ranges and an HRTB-scoped recording closure so the command shell cannot escape.",
                "evidence": "bounds-checked scoped facade with non-escaping command lifetime",
            }
        if method_key in SCOPED_ARGUMENT_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "Raw constant storage or indirect patch command shells are replaced by HRTB-scoped slices/recording closures with complete offset and footprint checks.",
                "evidence": "non-escaping command lifetime and checked CPU-visible byte storage",
            }
        if method_key in METAL4_COMMAND_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "Raw GPU addresses, pointer arrays, and explicit operation counts are replaced by typed Buffer ranges and checked Rust slices on a recording typestate encoder.",
                "evidence": "non-cloneable recording facade with range, device, and operation-slice validation",
            }
        if method_key in METAL4_COMPLETION_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "Raw buffer ranges, encoder back-references, dispatch queues, and feedback NSError are absorbed by recording/submission typestate and a consuming completion Result.",
                "evidence": "submission-bound staging, exclusive recording borrow, and owned completion error",
            }
        if method_key == ("MTL4::CounterHeap", "resolveCounterRange"):
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "CPU-side direct resolve is replaced by RecordingCommandBuffer staging and CompletedCommandBuffers resolution bound to the same submission identity.",
                "evidence": "submission-bound staging readback rejects identity mismatch and returns owned Vec<u64>",
            }
        if method_key in CHECKED_INDEX_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The unchecked Objective-C indexed collection access is replaced by a bounds-checked Rust operation.",
                "evidence": "safe checked-index facade and selector-gated FFI wrapper",
            }
        if method_key in OWNED_COLLECTION_SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The Objective-C collection or borrowed storage is copied into an owned Rust Vec or other checked collection.",
                "evidence": "owned Rust collection facade with no Objective-C collection exposure",
            }
        if (
            method_key in POINTER_SUBSTITUTE_METHODS
            or method_signature_key in POINTER_SUBSTITUTE_SIGNATURES
        ):
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The raw object/pointer representation is replaced by a typed target, checked slice, or owned Rust value.",
                "evidence": "safe typed facade with range and lifetime validation",
            }
        if (
            method_key in SLICE_SUBSTITUTE_METHODS
            or method_signature_key in SLICE_SUBSTITUTE_SIGNATURES
        ):
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "Parallel C pointer arrays and explicit counts/ranges are replaced by a checked Rust slice.",
                "evidence": "safe slice facade, checked element/range validation, and audited FFI wrapper",
            }
        if (
            declaration["framework"] == "MetalFX"
            or declaration["qualified_name"].startswith("MTL4::")
            or declaration.get("parent", "") in RUNTIME_AVAILABILITY_PARENTS
            or direct in RUNTIME_AVAILABILITY_RUST_METHODS
            or declaration["name"] in FOUNDATION_AVAILABILITY_CONSTANTS
            or (declaration["kind"] == "constant" and declaration["name"] in METAL_CONSTANTS)
            or direct in {"metal::Device::capability", "metal::Device::numeric_property"}
            or direct.endswith("::shader_validation")
            or direct in {
                "metal::RenderPipelineDescriptor::options",
                "metal::RenderPipelineDescriptor::set_options",
                "metal::RenderPassDescriptor::options",
                "metal::RenderPassDescriptor::set_options",
                "metal::RenderPassDescriptor::sample_positions",
                "metal::RenderPassDescriptor::set_sample_positions",
                "metal::Device::supports_family",
                "metal::Device::supports_feature_set",
                "metal::Device::supports_counter_sampling",
                "metal::Device::supports_rasterization_rate_map",
                "metal::Device::supports_vertex_amplification_count",
                "metal::Device::should_maximize_concurrent_compilation",
                "metal::Device::set_should_maximize_concurrent_compilation",
                "metal::Device::default_sample_positions",
                "metal::Device::heap_acceleration_structure_size_and_align",
                "metal::Device::sparse_tile_size",
                "metal::RenderCommandEncoder::set_depth_clip_mode",
                "metal::RenderCommandEncoder::set_depth_test_bounds",
                "metal::RenderCommandEncoder::tile_size",
                "metal::RenderCommandEncoder::texture_barrier",
                "metal::BlitCommandEncoder::optimize_texture_for_cpu",
                "metal::BlitCommandEncoder::optimize_texture_for_gpu",
                "metal::ComputeCommandEncoder::set_buffer_with_stride",
                "metal::ComputeCommandEncoder::set_buffer_offset_with_stride",
                "metal::ComputeCommandEncoder::set_bytes_with_stride",
                "metal::ComputeCommandEncoder::set_stage_in_region_indirect",
                "metal::Buffer::new_tensor",
                "metal::Device::new_mtl4_command_buffer",
                "metal::Device::new_mtl4_command_queue",
            }
        ):
            return {
                "status": "availability",
                "rust": direct,
                "availability": "The safe facade checks runtime framework or selector support before use.",
                "evidence": "safe facade, audited FFI wrapper, and runtime capability check",
            }
        if (declaration.get("parent", ""), declaration["name"]) in SUBSTITUTE_METHODS:
            return {
                "status": "substitute",
                "rust": direct,
                "notes": "The raw mapped-memory or caller-owned output pointer is replaced by checked CPU writes or submission-bound staging readback.",
                "evidence": "safe facade, audited FFI wrapper, and submission identity validation",
            }
        return {
            "status": "implemented",
            "rust": direct,
            "evidence": "safe facade and audited FFI wrapper",
        }

    generated_value = generated_value_mapping(declaration)
    if generated_value:
        return {
            "status": "implemented",
            "rust": generated_value,
            "evidence": "generated safe scalar wrapper with checked integer representation",
        }

    generated_struct = generated_struct_mapping(declaration)
    if generated_struct:
        return {
            "status": "implemented",
            "rust": generated_struct,
            "evidence": "generated safe Rust value representation for a plain Metal struct",
        }

    generated_alias = generated_aliases.get(declaration["id"])
    if generated_alias:
        return {
            "status": "substitute",
            "rust": generated_alias,
            "notes": "The C++ alias is represented by its owned object wrapper or safe Rust scalar/value type.",
            "evidence": "safe Rust type substitution with no raw pointer or callback ABI exposure",
        }

    generated_object = generated_object_mapping(declaration)
    if generated_object:
        return {
            "status": "implemented",
            "rust": generated_object,
            "evidence": "generated opaque owned RAII wrapper; methods are covered separately",
        }

    generated_method = generated_methods.get(declaration["id"])
    if generated_method:
        return {
            "status": "availability",
            "rust": generated_method,
            "availability": "Returns ErrorKind::Unsupported when the runtime object does not expose the selector; nullable values remain a separate Option.",
            "evidence": "canonical facade wrapper over a selector-gated safe FFI method",
        }

    return {
        "status": "unimplemented",
        "reason": "No audited safe facade mapping has been implemented yet.",
        "evidence": "metal-cpp declaration inventory",
    }


def render_markdown(inventory: dict[str, Any], mappings: dict[str, dict[str, str]]) -> str:
    counts = Counter(mapping["status"] for mapping in mappings.values())
    by_framework: dict[str, Counter[str]] = {}
    by_header: dict[tuple[str, str], Counter[str]] = {}
    by_kind: dict[tuple[str, str], Counter[str]] = {}
    for declaration in inventory["declarations"]:
        status = mappings[declaration["id"]]["status"]
        framework = declaration["framework"]
        by_framework.setdefault(framework, Counter())[status] += 1
        by_header.setdefault((framework, declaration["header"]), Counter())[status] += 1
        by_kind.setdefault((framework, declaration["kind"]), Counter())[status] += 1

    lines = [
        "# API coverage",
        "",
        "This file is generated from `api/metal-cpp-inventory.json` and",
        "`api/coverage.json`. The ledger has one explicit entry for every public",
        "declaration in the local Apple metal-cpp snapshot.",
        "",
        f"Reference digest: `{inventory['reference']['content_sha256']}`.",
        "",
        "Statuses:",
        "",
        "- `implemented`: a pinned/generated or handwritten audited FFI mapping exists; the public facade may group several C++ overloads into one checked Rust operation.",
        "- `availability`: an implemented API is represented, but object creation is gated by the Apple framework/runtime capability query.",
        "- `substitute`: C++ ownership, helper, scalar, or pointer shape is",
        "  grouped into a safe Rust value or RAII abstraction.",
        "- `unimplemented`: no audited safe facade mapping exists yet.",
        "",
        "Generated Metal bindings are implementation sources behind",
        "`metal-rust-ffi`; they are not re-exported as raw Objective-C APIs.",
        "The `rust` target in the ledger preserves selector-level traceability,",
        "while the evidence and notes identify the safe facade grouping or",
        "substitution that callers actually use.",
        "",
        f"Total declarations: **{len(mappings)}**.",
        f"Implemented: **{counts['implemented']}**; availability-gated: **{counts['availability']}**; substituted: **{counts['substitute']}**; unimplemented: **{counts['unimplemented']}**.",
        "",
        "| Framework | Implemented | Availability | Substitute | Unimplemented | Total |",
        "| --- | ---: | ---: | ---: | ---: | ---: |",
    ]
    for framework in sorted(by_framework):
        counter = by_framework[framework]
        total = sum(counter.values())
        lines.append(
            f"| {framework} | {counter['implemented']} | {counter['availability']} | {counter['substitute']} | {counter['unimplemented']} | {total} |"
        )
    lines += [
        "",
        "## Header summary",
        "",
        "Each reference header is retained in the ledger so a new or removed",
        "header cannot disappear behind a framework-level percentage.",
        "",
        "| Framework | Header | Implemented | Availability | Substitute | Unimplemented | Total |",
        "| --- | --- | ---: | ---: | ---: | ---: | ---: |",
    ]
    for (framework, header), counter in sorted(by_header.items()):
        total = sum(counter.values())
        lines.append(
            f"| {framework} | `{header}` | {counter['implemented']} | {counter['availability']} | {counter['substitute']} | {counter['unimplemented']} | {total} |"
        )
    lines += [
        "",
        "## Declaration-kind summary",
        "",
        "The machine-readable inventory preserves the original qualified name",
        "and signature for every class, method, enum, option, field, constant,",
        "alias, function, and macro.",
        "",
        "| Framework | Kind | Implemented | Availability | Substitute | Unimplemented | Total |",
        "| --- | --- | ---: | ---: | ---: | ---: | ---: |",
    ]
    for (framework, kind), counter in sorted(by_kind.items()):
        total = sum(counter.values())
        lines.append(
            f"| {framework} | `{kind}` | {counter['implemented']} | {counter['availability']} | {counter['substitute']} | {counter['unimplemented']} | {total} |"
        )
    lines += [
        "",
        "The machine-readable ledger is checked with:",
        "",
        "```sh",
        "python3 scripts/generate_api_inventory.py --reference ../D3D_Documentation/metal-cpp --check",
        "python3 scripts/check-api-coverage.py",
        "```",
        "",
        "A changed reference digest requires regenerating the inventory and reviewing every new or removed ID.",
        "",
    ]
    return "\n".join(lines)


def main() -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument("--inventory", type=Path, default=Path("api/metal-cpp-inventory.json"))
    parser.add_argument("--coverage", type=Path, default=Path("api/coverage.json"))
    parser.add_argument("--markdown", type=Path, default=Path("docs/API_COVERAGE.md"))
    parser.add_argument("--check", action="store_true")
    args = parser.parse_args()

    inventory = json.loads(args.inventory.read_text(encoding="utf-8"))
    declarations = inventory["declarations"]
    generated_methods = generated_facade_method_paths(declarations)
    generated_aliases = generated_facade_alias_paths(declarations)
    generated_object_mapping.available = available_object_names(declarations)  # type: ignore[attr-defined]
    mappings = {
        declaration["id"]: mapping_for(declaration, generated_methods, generated_aliases)
        for declaration in declarations
    }
    coverage = {
        "schema": 2,
        "description": "One explicit safe-Rust mapping for every declaration in the local metal-cpp inventory.",
        "reference_sha256": inventory["reference"]["content_sha256"],
        "generated_by": "scripts/generate_api_coverage.py",
        "mappings": dict(sorted(mappings.items())),
    }
    coverage_text = json.dumps(coverage, indent=2, sort_keys=True) + "\n"
    markdown_text = render_markdown(inventory, mappings)
    if args.check:
        stale = []
        if not args.coverage.is_file() or args.coverage.read_text(encoding="utf-8") != coverage_text:
            stale.append(args.coverage)
        if not args.markdown.is_file() or args.markdown.read_text(encoding="utf-8") != markdown_text:
            stale.append(args.markdown)
        if stale:
            for path in stale:
                print(f"generated coverage artifact is stale: {path}", file=sys.stderr)
            return 1
        print(f"coverage artifacts are current for {len(mappings)} mappings")
        return 0

    args.coverage.write_text(coverage_text, encoding="utf-8")
    args.markdown.write_text(markdown_text, encoding="utf-8")
    print(f"generated {len(mappings)} mappings")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())