MTLSamplerMinMagFilter's raw value 2 (SamplerMinMagFilter::Cubic) is declared by no SDK header, Apple page or Metal Shading Language text, and nothing a program asks tells it about the value, so it is undocumented Metal and is not emulated. Metal makes the state on every Mac measured. An Apple M3 Max filters it over a footprint wider than one texel, and a Radeon Pro 5300M and an Intel UHD Graphics 630 read the nearest texel (the conformance case's own inputs: jobs m3-max-85003 and m3-max-85004). The runtime now makes such a state and filters it as nearest on every device: no shader arm, no second pipeline, no query, no note. - rt Device::new_sampler_state no longer refuses a Cubic min or mag filter. Nothing raises Gap::CubicSampler now; the variant stays, documented so, because the consumer names it. - translator: SamplerWord::of sets no bit for a Cubic filter, so its word is the nearest filter's. SamplerWord::CUBIC (bit 30) is deleted (its one reader, the anisotropic word path, is gone on development). SamplerWord::FIELDS is now (1 << 30) - 1. unnormalized_reads compares the two filters as the device's (a Cubic filter's is NEAREST) rather than refusing Cubic. vk_sampler already made NEAREST of Cubic. - SamplerMinMagFilter::Cubic stays, because the consumer converts a guest's raw 2 to it. It is documented through regen_metal_enums.py's PRIVATE_DOCS as Metal's undeclared raw value 2, which the M3 Max filters and the x86 Macs read as nearest, and whose device sampler and word here are the nearest filter's. generated.rs is regenerated against the macOS 27.2 SDK. - docs: the runtime README's sampler line, RESOURCE-ID.md (the word's bit 30 is now 0, and the consumer makes a Cubic state as nearest), resource_words.tsv's three Cubic lines (bit 30 cleared: 0x40000000 -> 0x00000000 twice, 0x58f6ab53 -> 0x18f6ab53), and the comments in select.rs and extended.rs that said the runtime makes no cubic sampler. - reach.tsv's SamplerBicubicFilter row no longer names a runtime cubic sampler as its reach. REFUSALS.md and error/basis.rs regenerated (refusal_surface.py: Gap::CubicSampler has no raise site); api_signatures.tsv blessed (SamplerWord::CUBIC removed, FIELDS changed). - RUNTIME_VERSION: a Cubic state is made where it was refused, so it takes a bump, set at staging (left at development's 2568 here). SEMANTICS_VERSION stays, since no module's words change. runtime-sources.sha256 re-pinned. Consumer search (reims-vgpu development 1913fcbc15 and the steelbrain/* refs from the last day): Gap::CubicSampler, 2 hits (development crates/reims-vgpu-vulkan/src/rt_platform/diag.rs:3071 and :3109, a test that counts the gap's name), kept. SamplerWord::CUBIC, SamplerWord::FIELDS and SamplerMinMagFilter::Cubic by name: 0 hits. The consumer's rt_platform::state::tests::states_on_vulkan, which expects None for min_filter 2, now gets a sampler.
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.