RenderPassDescriptor gains visibility_result_type (MTLVisibilityResultType: Reset, the default and today's behaviour, and Accumulate). Under Accumulate no query result is copied over its offset's word: every query of an offset, the first one too, is copied into the upload region the continuations already use, and the crate-owned combine takes them into the word as the buffer holds it. The combine already loaded the destination word as its accumulator, so Accumulate is the first query becoming one more source. A `Boolean` word ORs the device's results in; a `Counting` word is summed in through a new table mode of the combine, into the word's low 32 bits alone, wrapping there, its high 32 bits kept (ContinuedResult::low_half / in_low_half). That last part is what the M3 Max answered when recorded: 0xffff_fff8 plus 16 samples writes 8, and 0xffff_ffff_ffff_fff8 plus 16 writes 0xffff_ffff_0000_0008. A plain 64-bit sum was divergent there. An offset set with no draw after it keeps its word, because a query with no draw adds 0. Where a no-copy buffer's bytes start off a multiple of 8, so the results land in an upload region, the words are now copied into that region before the combine (Landing::inward). Reset records exactly what it did before. Conformance: RenderPass gains visibility_type (typed()), and words() appends it only where it is not Reset, so existing fingerprints read as before. Both sides set it. There are four new visibility cases, recorded on the M3 Max (macOS 27.0.1): visibility-counting-accumulate (two command buffers; words 100/5/7/0xffff_fff8/u64::MAX-7), visibility-counting-accumulate-one-command-buffer (two passes in one command buffer, read once), visibility-counting-accumulate-revisit, and visibility-boolean-accumulate (words 0/2/3 under covering and non-covering draws, an offset set with no draw, then a second command buffer). The family's acts key states the type, and a joined shape adds a command-buffer input. Cost and timing records for the new cases are not written here. Lane tests (runtime_lane): accumulated_counts_add_to_the_words, accumulated_booleans_or_into_the_words, and host_bytes::accumulated_visibility_results_land_where_their_bytes_lie. Unit tests: the combine's accumulated_counts_are_summed_into_the_low_half, its plan's table mode, and the type's raw values. Coverage: coverage.tsv marks MTLRenderPassDescriptor.visibilityResultType implemented (its unused "visibility" group is removed), and METAL-COVERAGE.md is regenerated. MTLVisibilityResultType joins the enum table, so metal_enumerators.tsv and CONFORMANCE-COVERAGE.md are regenerated. The API signatures are re-blessed. REFUSALS.md is regenerated: VisibilityResultType::from_raw is one more UndefinedValue site. The regeneration also picks up two bind/graphics.rs sites the committed file was missing. The degrade docs (landed results, Boolean) state Accumulate. Verified on the M3 Max under MoltenVK 1.4.2: - The 52 visibility-touching lane tests pass: visibility, host_bytes, depth_never, amplified_draws, degrade_notices and the framebuffer_fetch split pass. - The visibility family's replay is all announced (no divergence), after the low-half change. - Negative control with Accumulate forced to Reset: all three Accumulate lane tests fail, and all four new cases replay divergent. - Negative control with no inward copy: the landing test fails at 4 bytes past a page (2 read 0, 100 read 16). - Before the low-half change, visibility-counting-accumulate replayed divergent at words 3 and 4. - The combine's low-half test fails on the interpreter without the high-half select ([8, 1] for [8, 0]). clippy (plain and --cfg m2v_gpu), rustdoc and scripts/api-docs are clean. SEMANTICS_VERSION: no translated shader changes, but the owned combine module's words do (main's call). RUNTIME_VERSION and the runtime-sources pin are not touched here. (cherry picked from commit 1c172968ad6492cebcae2a568fc99e90565d4d11) (cherry picked from commit 9f47ebcf006920f7561a16a77f77e422de7201c1)
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.
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.