Files
Anees Iqbal 977c9da12f RUNTIME 2246: setTriangleFillMode: 2 (MTLTriangleFillModePoints, Apple-private) draws a triangle's vertices as points
Apple's GL renderer sends setTriangleFillMode:2 for glPolygonMode(GL_POINT) under its Intel and
Apple-silicon caps tables. The value is not in the public headers. Our TriangleFillMode had only
Fill and Lines, so the consumer's raw-value conversion failed and its host died. Measured on
Metal: an M3 Max and an Intel UHD 630 draw only a triangle's 3 vertex pixels (a Radeon Pro 5300M
fills it); our own probe on the M3 (m3-max-26811) draws 1-px points whether point_size is 4, 1 or
unwritten, culls them with CullMode Front, and draws them with Back.

Now TriangleFillMode::Points (2) exists. The generator (scripts/regen-metal-enums) takes a
PRIVATE line for it, with its evidence, and a PRIVATE_DOCS doc comment (metal_enum! accepts
variant attributes); generated.rs stays generated and `--check` passes. The runtime draws it as
VK_POLYGON_MODE_POINT. It needs fillModeNonSolid (refused otherwise:
Feature::TriangleFillPoints) and, on a portability-subset device, pointPolygons
(VkFeature::PointPolygons; MoltenVK withholds it, so it refuses Points). New degradation
TrianglePointSize ("triangle-point-size"): Vulkan sizes the points by the PointSize the vertex
function writes, where Metal draws 1 px. An ICB command still refuses set_triangle_fill_mode, as
before. New lane module runtime_lane::triangle_points.

Verified (fillpoints, 6b9927c402 on 25be73dddf):
- lavapipe lane 30/30: points light {(3,3),(3,12),(12,3)} (Metal's 3 vertex pixels); culled
  front none, back the same 3; fill 45 px (the M3 lit 45); lines 27; fill/lines unchanged.
- msi: clippy plain, m2v_gpu and m2v_cpu_icd 0; rustdoc 0; touched tests 102/102.
- Owed: the XTX leg (m3-max-26943).

ARTIFACT_FORMAT_VERSION 519 -> 520 (VkFeature appended to the codec), RUNTIME_VERSION 2245 -> 2246.
2026-11-13 15:26:44 -08:00
..

regen-metal-enums

Generates crates/metal2vulkan/src/metal/generated.rs, the Metal enums and option sets of the translator's metal module, and crates/metal2vulkan-air/src/metal/generated.rs, the ones the AIR front end reads (AIR_ENUMS: MTLDataType, which metal re-exports), from the macOS SDK's Metal.framework headers.

Only enumerator names and numeric values are extracted: they are the Metal API's wire contract (guest command streams and Metal-shaped descriptors carry them as raw ordinals). No header text is copied. Each listed NS_ENUM becomes a metal_enum! invocation (a closed Rust enum whose TryFrom<u32> rejects unknown ordinals) and each listed NS_OPTIONS a metal_flags! invocation (a bit set whose TryFrom<u32> rejects unknown bits); the macros live in crates/metal2vulkan/src/metal/mod.rs and, for the front end's enums, crates/metal2vulkan-air/src/metal/mod.rs. Deprecated spellings with the same value are recorded as aliases. Value expressions other than integer literals, shifts, ors, and references to earlier enumerators fail generation.

Values the headers do not declare but Metal takes are the script's PRIVATE input, one line per value after the type's header enumerators, each with a comment giving the evidence that Metal takes it (the device, the macOS release, what Metal did with it); generation fails once the headers declare one. PRIVATE_DOCS gives such a value a doc comment on its variant, where a consumer needs to know what Metal does with it.

It also generates scripts/conformance-coverage/metal_enumerators.tsv from the TABLE_ONLY list: the SDK's enumerators and ordinals for the Metal enums and option sets the tree declares by hand rather than from these headers, because the compile-and-plan layer never reads them. No Rust is generated for those, and none should be; the table is the conformance suite's option-space denominator for them, so that a hand-written variant list is measured against the SDK rather than against itself. One row per name, with role saying whether it is the value or a deprecated spelling of one.

MTLResourceOptions is in no list: the SDK writes its values in terms of MTLCPUCacheMode's and MTLStorageMode's enumerators shifted by #defined amounts, which evaluate fails on rather than guessing.

The output records the SDK version it came from, so --check passes only against that SDK. To add a type, append its Metal name to ENUMS, AIR_ENUMS, OPTIONS or TABLE_ONLY and regenerate. Never hand-edit the output.

# regenerate from the active Xcode SDK (xcrun), or pass --headers DIR --sdk-version V
python3 scripts/regen-metal-enums/regen_metal_enums.py
# idempotence: fail if a committed file differs from a fresh generation
python3 scripts/regen-metal-enums/regen_metal_enums.py --check
# generator unit tests (no SDK needed)
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s scripts/regen-metal-enums

Requires macOS with Xcode (or the Command Line Tools SDK) and Python 3.