Files
metal2vulkan/docs
Anees Iqbal 75228b052b Record no device-nan-encoding for a color output that only ever returns NaN-free constants
A fragment function's color output to a half-float attachment recorded
PrecisionNote::DeviceNanEncoding wherever the device's conversion stores
a NaN otherwise than Metal, even when every value the function returns
there is a constant with no NaN lane, which stores no NaN. Texture
writes already skip the note for such a constant texel
(texture::holds_no_nan); color outputs now apply the same structural
rule. stage_io::returns_no_nan follows each `ret` of the function to the
output's member (through insertvalue chains and aggregate constants),
and color_write::plan, called from the output-variable path and from
the storage-form path, leaves the note out when every return holds such
a constant. Any computed, undef, argument or partly unknown member
keeps the note.

Per-site audit of the device-nan-encoding notes on MoltenVK on the M3
(the reims strict Mac tests), with the translator CLI over each site's
stages:
- (a) undefined tests x3 (xr_constant_fragment and the other
  constant-colour fragments): their outputs are NaN-free constants, so
  the note was wrong there. Fixed here.
- (c) encode_render x2 (sweep_fragment, sweep_half_fragment): computed
  outputs that sweep through NaN values. The device stores its own NaN
  encoding, so the note stays.
- (c) rgbx x3 (rgbx_write_half, store_half, read_write_half, and the
  NaN clears and half NaN writes): deliberate NaN texel writes. The
  note stays.
- (c) slice_write_repro x1 (slice_write, slice_write_l0): computed
  texel writes. The note stays.

New public fixture ncw_constant_colors (our own MSL, compiled by
scripts/regen-air-fixtures). It covers a half and a float constant
colour, a constant NaN colour, a computed colour, and a two-member
struct whose member 0 is a constant and member 1 computed. The new test
engine_link::constant_colors_without_a_nan_record_no_nan_encoding
checks, on the lavapipe and moltenvk-m3 profiles, that the note is
recorded exactly for the NaN constant, the computed colour and the
pair's computed member, and that each stage links and validates.

docs/API.md's device-nan-encoding entry states the rule. SEMANTICS_VERSION
goes to 1963 because the recorded notes change. The golden tables
need the new fixture's rows, re-blessed on development.

Verification: the new test and the touched suites run in the branch's
next CPU job.

(cherry picked from commit 2d436ebc2963f1aac1854b850ff1808e654c61f3)
2026-11-05 02:08:28 -08:00
..