Files
metal2vulkan/docs
Anees Iqbal 504d01b759 Present the Mac class the consumer declares, by default its GPU's, as the fresh-texture key
The fresh-texture key (DeviceProperties::lossless_compression) was
has_unified_memory. That is wrong for every integrated GPU that is not
Apple's. The consumer's oracle shows an Intel UHD 630 Mac reports unified
memory and reads zero or a released texture's texels from a new Private
texture, as the AMD 5300M does, and never Apple's pattern. The owner's
choice (option B): the consumer declares the Mac class the device presents,
and the default follows the GPU family.

What:
- MacClass { AppleSilicon, IntelOrAmd } (public, capabilities.rs), with
  MacClass::of_vendor: an Apple GPU (vendorID 0x106b, MoltenVK on Apple
  silicon) is AppleSilicon, every other GPU IntelOrAmd.
- DeviceOptions::mac_class and RawDevice::mac_class (Option, None by default:
  the GPU's class) feed presents_lossless_compression, still the one place
  the key is decided. lossless_compression is class == AppleSilicon. The
  options' equality and Debug list the field.
- A new Private texture under IntelOrAmd on a GPU that is not Apple's holds
  what its memory held, as before (private_textures_unfilled). On an Apple
  GPU, whose own image of such a texture is compressed and reads Apple's
  pattern, it is filled with zeros as it is made, which is what such a Mac
  reads where its memory held nothing. Counted by the new
  WorkCounts::private_textures_zero_filled. The pattern path now runs only
  where the device presents compression.
- AppleSilicon keeps the runtime's pattern and zeros on any GPU. The device's
  own contents are not Metal's pattern on the M3: in the negative control
  (m3-max-88) leaving Private textures unfilled failed 16 of the 28 lanes.
  No PrecisionNote: the fill is capability (the declared Mac's contract),
  not arithmetic. An Apple-class pattern that no clear or copy writes
  exactly still announces fresh-pattern-zeroed.
- Defaults change only where unified memory and GPU family disagree: Intel
  and AMD integrated GPUs and lavapipe now present no compression (their new
  Private textures are unfilled). The M3 (Apple) and the discrete GPUs
  answer as before.
- Docs: docs/API.md (the accepted difference and the fresh-pattern-zeroed
  entry), the runtime README, the degradation declaration, the work-count
  docs. api_signatures blessed. REFUSALS.md regenerated with no change. No
  FAST-PATHS row: no speed-for-accuracy choice.

Tests:
- tests::capabilities::lossless_compression_is_the_presented_mac_class
  (no device): every vendor kind (Apple, Intel, AMD integrated and
  discrete, NVIDIA, Mesa CPU) under no declaration and both declarations.
- tests::mac_class (device, both settings):
  the_default_class_is_the_gpu_s and
  a_declared_class_other_than_the_gpu_s_is_presented. Each reads a new
  Private RGBA8Unorm target and checks the counters: AppleSilicon reads
  Metal's magenta pattern; IntelOrAmd on an Apple GPU reads zero
  (zero_filled +1); IntelOrAmd elsewhere is unfilled (+1).

Verified: cargo fmt --all. Build, clippy and tests run as potluck jobs
after this commit (results in the next commit or report).

(cherry picked from commit f3d6f24ca447fbcadc8df56e63e598cbc92e09b7)
2026-11-05 02:08:30 -08:00
..