Files
metal2vulkan/docs
Anees Iqbal 1df750bbd4 Resolve multisampled color by the device's average by default, Metal's rule on ResolvePolicy::Exact
A pass that resolves a color attachment whose format has Metal's resolve rule at its sample count
drew the runtime's exact resolve after the pass on every device whose AVERAGE is not measured to
be Metal's (everything but MoltenVK): one more render pass instance per resolved attachment,
between full barriers, reading the stored samples as an input attachment. That form is exact
and costly in GPU time. By the owner's rule (fast by default, exact on request, both kept), the
device's resolve becomes the default, announced, and the exact resolve a switch.

- DevicePolicy gains resolve: ResolvePolicy { Device (default), Exact }, a runtime choice alone
  (no emitted code changes, no profile carries it). exact_answers() selects Exact.
- Under Device the attachment resolves in its pass by Vulkan's AVERAGE, announced as
  device-rounded-resolve (precision), whose reason names ResolvePolicy::Exact: no extra pass, and
  a render target needs no input attachment usage for the resolve. Under Exact everything is as
  before.
- Unchanged under both: a driver with DriverFact::ColorResolveAverageIsMetals (MoltenVK on
  Apple's GPUs) resolves in the pass with no notice, and an attachment a fetching pass's sample
  planes hold as it ends resolves from them by Metal's rule.
- device-rounded-resolve's docs and cost state the measured bound: one code for a unorm, snorm or
  packed 16-bit unorm channel, two for an sRGB channel; a float channel's last bits are counted,
  not bounded.
- Docs: a new docs/FAST-PATHS.md row for the switch; docs/API.md's policy bullet and the
  device-rounded-resolve and shader-resolve catalogue entries; color_resolve.rs, policy.rs and
  driver_facts.rs state both values. The api_surface table lists ResolvePolicy.

Why: the exact form's extra pass costs GPU time on every device but MoltenVK (a resolved pass's
command buffer 73-77 us against 51 us on the Iris Xe, 63-75 us against 45-48 us on the 780M), and
no driver measured matches Metal's rule, so none gains ColorResolveAverageIsMetals.

Measured, as the commit states (release builds, 1920x1080 frames of 97 command buffers, every
fourth pass resolving an RGBA8Unorm x4 attachment, the exact form against the device's,
alternated): GPU busy a frame on the Iris Xe (ANV) 2.52 and 2.41 ms -> 1.92 ms (the guest's
shape 3.04, 2.77 -> 2.44, 2.43 ms); on the Radeon 780M (RADV) 2.33 to 2.78 -> 2.00 to 2.13 ms; on
the RX 7900 XTX 1.38 -> 1.36 ms.

The device's average against Metal's rule: on RADV (780M and RX 7900 XTX), ANV (Iris Xe),
lavapipe and NVIDIA (RTX 5080 Laptop), unorm and snorm channels land one code below Metal's at a
tie (16-bit channels exact on NVIDIA), sRGB within one code both ways (up to two at 4 samples on
NVIDIA), packed formats within one, float channels differ in value.

Verified, as the commit states:
- The new lane runtime_lane::resolve_rounding::the_device_resolve_rounds_as_announced (default
  policy) passes on lavapipe, the RTX 5080, the 780M, the RX 7900 XTX and the Iris Xe: every
  closed format at 2 and 4 samples resolved by the device, device-rounded-resolve exactly where
  the fact is absent, and every difference against Metal's rule within the notice's bound.
- The exact form keeps its lanes: the validated options take exact_answers(), so
  resolve_rounding's other tests, degrade_notices, nan_resolves and framebuffer_fetch run under
  ResolvePolicy::Exact as before.
- tests::fast_paths (the switch, and that the choice keys no profile), the driver_facts tests,
  api_surface, the runtime's degradation and driver_defects tests; fmt, clippy in the three
  configurations, rustdoc.
2026-10-19 00:16:00 +03:00
..