Files
metal2vulkan/crates
Anees Iqbal d8d76438cd Hold the extended-range lanes to DevicePackConversion's bound, against Metal's answers
The eleven extended-range and padded lane tests compared the device's
texels, reads and samples digest for digest with Metal's. A shader's
conversion of such a texel is the device's own (no Vulkan format holds
them), which PrecisionNote::DevicePackConversion records and the
runtime announces. Its documented bound allows a code within one of
Metal's (two for R10Unorm_X6_sRGB's and RGB10A2Unorm_sRGB's colour below
0.0031308), a linear read within one f32 ulp, an sRGB twin's decoded
value within half a 2^-13 step of Metal's table (1.64 steps for those
two formats) beyond the Pow's bound, a half within one half ulp, and a
NaN's code the device's. So the digests did not match on the M3 Max
(MoltenVK) or the RTX 5080, and these tests stayed red on both.

Each test now checks every value within that bound of Metal's own
answer, and each bit Metal does not read equal to Metal's. It asserts
that the note was announced wherever a value moved, and it still pins
Metal's answer by its digest:
- xr_codes (new): the shared helpers. It splits a texel into codes and
  the bits Metal does not read, holds codes, reads, sRGB steps and halves
  to the bound, gives Metal's half rounding (ties away from zero), and
  loads Metal's M3 Max macOS 27.0.1 answer from a conformance recording.
  as_metal_reads replaces the device's lanes that are within the bound
  by Metal's values, so a digest of the rest can still be compared.
- extended_range_targets: draws compared code by code, two-plane reads
  through the nearest code of Metal's read; clears' reads through the
  cleared codes. A CPU test holds the models to Metal's digests.
- extended_range_planes: joined and split texels within a code.
- extended_range_blends: one-zero blends against a model of Metal's
  blend, which clamps the source to its range, alpha to [0, 1] and a NaN
  to the low end. A CPU test holds the model to Metal's digests.
- padded_loads: every drawn word within a code of a model of Metal's
  store (a float output rounded to half toward zero, then the write
  code), held to Metal's digests by a CPU test.
- rgb10a2_srgb: reads, writes, nearest samples and stores compared with
  the rgb10a2-srgb-* recordings, whose digests are asserted equal to the
  test's constants. Linear samples run and are counted, their blend
  being the unbounded BicubicFilterArithmetic, which is asserted to be
  announced.
- two_plane_samples: nearest cases against the xr-two-plane-samples-*
  recordings, a half case against the float recording.
- extended_range_two_planes: plane reads and in-view buffer words
  within the bound, through as_metal_reads.
No note set changes. Test code only; no version bump.

Verified on the Apple M3 Max (MoltenVK 1.4.2, macOS 27.0.1): every test
in the seven files passes (34 of 34), including the eleven that were
red. In the run before the bound was corrected, both rgb10a2_srgb tests
failed at exactly three words each, the shape the bound now states.
Clippy (all targets, all features, --cfg m2v_gpu) is clean.

(cherry picked from commit f097486e7a84a116c2c119114db4b665eb045600)
(cherry picked from commit 4c972dab0c58ef908b7ac6c826afb8a5e07f1732)
2026-11-03 04:10:31 -08:00
..