Under TextureWriteRoundingMode::NearestEven (Apple's textureWriteRoundingMode 2) every fragment
storage write now runs; the refusal NotImplemented(PrivateRenderState(TextureWriteRounding)) and
the facts RuntimeFact::StorageTextureWriteRounding and HeapWriteRounding are deleted.
Measured first, by the probe committed here as
crates/metal2vulkan-conformance/probes/texture_write_rounding_storage.m (an Apple M3 Max under
macOS 27.0.1, jobs m3-max-82793 and m3-max-82824): a fragment function writes 65,536 texels of
float and of half texels into RGBA16Float, RG11B10Float and RGB9E5Float storage textures, once in
a pipeline of mode 0 and once of mode 2. Mode 0 rounds every channel toward zero. Mode 2 rounds
a half-float channel to nearest even, a value past the midpoint above 65504 to the infinity
(262,112 of 262,112 non-NaN channels); an RG11B10Float channel to nearest even, held at the largest
finite value (196,583 of 196,583, float and half texels alike); and an RGB9E5Float texel's
mantissas half up under the largest clamped channel's exponent, moved up where that mantissa
rounds to 512, which is Vulkan's own rule for the format (65,536 of 65,536 texels, float and half
alike). Every mode-2 code lies within one unit of mode 0's.
- RGB9E5Float: the word is the module's own arithmetic (texture::rgb9e5_word), so under mode 2 it
is now Metal's mode-2 word exactly: the product times 2^(25 - e) converted toward zero keeps the
half's bit, one added and a shift right round half up, and a largest mantissa of 512 moves the
exponent up before every mantissa is rounded again. Write::half_up carries it to a
SharedExponentBits slot's write (emit::to_image) and WordsPlan::half_up to the texture-buffer
words' write routine. A kernel, tile or other function, a word attachment and the default mode
keep the truncation.
- RG11B10Float, float and half texels: the device's conversion as at the default mode, recorded
as PrecisionNote::DeviceColorConversion (unconditionally for a declared format, under
small_float_storage's clauses for a formatless slot or a heap). A half-float channel's note for a
float texel stays half_storage_facts's. The note's storage clause and its catalogue line in
docs/API.md state the measured counts.
Red tests:
- lower/arith/tests/color_write.rs rgb9e5_words_are_metals_at_either_mode: the emitted word, run
in the SPIR-V interpreter over the probe's 65,536 texels (probe_texels rebuilds them from the
probe's SplitMix64; its input and half hashes are checked against the probe's), hashes (FNV-1a)
to the texture Metal wrote, bit for bit, for float and half texels at either mode. It is red with
the half-up arm disabled.
- tests/engine_link.rs mode_two_fragment_texture_writes_round_as_metal_or_the_device replaces
mode_two_refuses_fragment_texture_writes_it_would_round. It draws over an RGBA32Float attachment,
whose output records no note (the previous test's RGBA8Unorm attachment recorded
DeviceColorConversion itself, which made the earlier commit's note check vacuous). Every case
compiles and links valid at either mode. A declared R16G16B16A16 slot records
DeviceColorConversion at both modes, a B10G11R11 slot under mode 2 alone, and an RGB9E5 word
slot at neither. It is red with the product files at the base, which refuse.
Public surface: PrivateRenderField::TextureWriteRounding and the two RuntimeFact variants are
removed (api_signatures.tsv rows). The consumer's checkout at a20576e1fd has 0 hits for
PrivateRenderField, StorageTextureWriteRounding or HeapWriteRounding (git grep). The mechanism
test's variant indices move StencilBitDraws and RobustStorageBuffers into the two freed places.
docs/REFUSALS.md is regenerated.
Not in scope, a follow-up: a texture buffer of half-float or RG11B10Float held as words
(texel_buffer_form) converts by the module's own toward-zero routine, recorded under the same note.
SEMANTICS_VERSION (refusal removed, notes and words under mode 2) and ARTIFACT_FORMAT_VERSION (two
RuntimeFact variants removed from the codec) each move to the next number.
runtime-sources.sha256 re-pinned (4361761c): the edited translator sources are runtime inputs.
Landed with SEMANTICS_VERSION 2337 (renumbered above development's) and runtime-sources.sha256 4361761c, recomputed on development.