Files
metal2vulkan/docs
Anees Iqbal 67a1651f35 Filter mipmaps by the device's arithmetic, not Metal's tables
The mipmap compute filter takes the device's arithmetic (pack.rs's sRGB transfer and half
conversions), and the validation guard lists the translator files it now reaches.

One work packet, landed as 5 commits on archive/development-linear-2026-10-29, in order:

* Filter mipmaps by the device's arithmetic, not Metal's tables (c9dd35e8a4)

Rule 1: the mipmap compute filter (extended-range formats, 8-bit sRGB
textures held as their UNORM twins, formats without blits or linear
filtering) reproduced Metal's bits inside a capability path. Its arithmetic
is now the device's: an 8-bit sRGB code decodes as c/255 through the MSL
transfer by the device's division and Pow and encodes by the transfer then
RoundEven(t*255) (pack's srgb_decode/srgb_encode, as the twin's shader reads
do since c70ec588c4); an extended-range sRGB code takes the same transfer on
its magnitude; a half takes UnpackHalf2x16/PackHalf2x16; a float's NaN is the
device's; the products and sums lose NoContraction. The twelve-bit and
8192-step tables, the k/4095 step, srgb::search and the integer half rounding
are gone (RG11B10Float's encode and RGB9E5's conversion stay: no device
instruction gives them).

cpu.rs is the bounded model: MipmapFilterChain::expected_levels is the chain
in IEEE f32, and the new MipmapFilterChain::outside_bound lists a device
level's texels outside 2^-17 of the terms' magnitudes (+2^-140) of the filter
of the level above as the device wrote it: a code at a rounding boundary, an
sRGB transfer within 2^-17 + 2^-20, one RGB9E5 mantissa step, any NaN. The
interpreter models GLSL Pow as the f64 power rounded once. Announced as
before by DeviceFilteredMipmaps; its docs, API.md's entry and FAST-PATHS say
the filter is the device's arithmetic. No version moves: the owned kernel is
built in-process and the driver cache keys on its words.

Verified: 475 touched and contract tests; the bind::mipmap_filter
interpreter tests FAIL with the old table decode restored and pass with the
change; clippy plain and --cfg m2v_gpu; rustdoc. Apple M3 Max: mipmap_chains
4/5 (5 formats within the bound, 8 texels off the IEEE model; the 3D blit
chain is the MoltenVK failure that predates this), runtime mipmap tests 13/13,
conformance blit-generated-mipmaps announced and justified. lavapipe:
mipmap_chains 5/5, 9 formats through the filter including both sRGB twins,
RG11B10Float and RGB9E5Float.

* Re-pin the runtime sources at the landing tip (187fa18b3d)

* List air.pack's lowering among the runtime sources the validation guard hashes (4020aeecc9)

The mipmap filter's owned kernel (bind/mipmap_filter/kernel.rs) takes its sRGB transfer and half
conversions from lower/arith/pack.rs since c9dd35e8a4, so the runtime's inputs reach pack.rs, and
the guard (candidate::engine::artifact::tests::the_runtime_sources_are_the_committed_ones) failed
on development's gate at 4052e2209c: "the runtime inputs reach files that are neither inputs nor
listed: lower/arith/pack.rs <- bind/mipmap_filter/kernel.rs". build.rs now lists pack.rs, and its
comment says srgb.rs's steps feed the ASTC and PVRTC decoders (the mipmap filter no longer reads
them). The hash moves with the new input; no runtime behaviour changes, so RUNTIME_VERSION stays
(the landing re-pins).

* Re-pin the runtime sources at the landing tip (821450aa43)

* Announce the copied host pages' cost as the catalogue states it; list what pack.rs reaches (e9ba27478b) (its crates/metal2vulkan-validation/src/candidate/engine/artifact/tests.rs part)

The final gate on 3e20b58763 failed two tests.

- degradation_catalogue: the signal-behind-merge fix (8fc9c56dcb) closed the
  shared-event gap and rewrote the API.md entry for copied-host-pages, but the
  runtime still announced "(behind a shared event's value among them)". The
  announced cost now drops it, so the catalogue's entry starts with it word
  for word again.
- the_runtime_sources_are_the_committed_ones: pack.rs became a runtime input
  (the mipmap kernel's sRGB transfers), and it also reaches
  metal2vulkan-air's intrinsics, lower/arith/math.rs and lower/arith/narrow.rs
  through its pack and unpack intrinsics, which only the compile emits. They
  are listed as not runtime with that reason. The stale comment about
  srgb.rs's encode, tables and steps (deleted by the mipmap and n7 packets)
  now says only what is true.

Verified: the two tests on the landed tip (see the landing).
2026-10-29 15:43:52 +02:00
..