Files
metal2vulkan/docs
Anees Iqbal 057b794f5b SEMANTICS 2115 / RUNTIME 2315: rate-mapped region copies record a box of regions per multi-draw
What: a draw through its region-copy variant recorded its regions 16 at a time (the device's
viewports). Each recording set 16 scissors, pushed its first region and stored DrawIndex as
ViewportIndex. On a guest frame the host step made about 4.7k such recordings a frame (Iris and
RTX 3090), while the GPU sat idle waiting for the step.

The variant's four clip distances already keep each copy to its region's pixels, as a fanned-out
copy's are kept; the per-region scissor only culled. Now:
- The vertex function draws region first + (DrawIndex / c)*nx + DrawIndex mod c from a pushed
  box (PushField::RegionBox, renamed from RegionFirst, now [first, columns]).
- It stores 0 as ViewportIndex, the recording's one viewport, so it writes every output the base
  variant wrote.
- The recording sets one viewport and its box's union scissor.
- A direct draw records a box as many regions at a time as one vkCmdDrawMultiEXT takes
  (maxMultiDrawCount - 1), its rows in order. A run records one recording per box its bounds
  reach; any other draw records the whole table in one or a few.
- Indirect draws keep one region a recording, under that region's scissor.
- The variant still needs shaderOutputViewportIndex and shaderDrawParameters; it no longer
  needs multiViewport.

Exactness: a border between two regions of a recording holds no pixel centre and no sample at
Vulkan's standard sample locations (at least 1/16 px inside a pixel, up to 8 samples), while each
copy's clip distance there is zero up to rounding. A box is recorded one column (row) at a time:
- in a pass whose custom sample positions put a sample on a pixel's left (top) edge;
- on a device without standardSampleLocations;
- in a 16-sample pass.
See render/fan_out.rs, folds.

A box's recording and the recordings of each of its regions alone run one pipeline that writes
the same outputs. They differ only in their dynamic viewport and scissor values and the integer
region each draw selects (Vulkan's Invariance appendix, Rules 2 and 4). The agreement between the
encoder's region-copy vertex function and the host step's fan-out geometry stage stays the
existing FAST-PATHS known gap, checked by running: no new near-equivalent, no new accepted
difference.

SEMANTICS_VERSION 2115 (the variant's module and push layout); ARTIFACT_FORMAT_VERSION 523 (the
PushField tag); RUNTIME_VERSION 2315 (what a region-copy draw records). Docs: rate_mapped_pass.rs,
render/fan_out.rs, bind/fan_out.rs, the translator's region-copy plan and store, docs/API.md, and
the FAST-PATHS fan-out row and known gap. docs/REFUSALS.md regenerated unchanged; api_signatures
blessed. No new Degradation kind, no WorkCounts field.

Tests:
- render/fan_out/tests.rs: run boxes, box recordings, box scissors, the fold rule.
- tests::rate_mapped_region_boxes (device test): the same two passes drawn directly (boxes) and
  indirectly (one region a recording, its own scissor), additively blended into RGBA16Float with
  a ground plane, border-crossing slivers and off-screen and w-straddling triangles, then an
  Equal pass, compared bit for bit, with the recordings counted.

Verified (lane ratemap2):
- msi m3-max-30288 at 9240cc0ea6: clippy -D warnings, all targets and features, plain, cpu_icd
  and m2v_gpu, exit 0; rustdoc -D warnings exit 0; translator touched tests 226/226; runtime
  33/33; lavapipe 13/13.
  - rate_mapped_depth_equal: 0 failing pixels in every pairing under Exact and FanOut. Without
    the ViewportIndex store, FanOut's mixed-route pairings had 2853 of 89483 (m3-max-30235).
  - rate_mapped_region_boxes: direct 3 draws in 3 recordings against indirect 3 in 624, 0 texels
    differ, Equal-pass mismatches [0, 0].
- Negative control (each clip distance widened by one pixel): rate_mapped_region_boxes fails,
  25464 texels differ, Equal-pass mismatches [11019, 0].
- The Iris GPU-time A/B (ms01, m3-max-30315, exclusive) is running; the consumer's renderer run
  at the next pin is the workload proof (rate_map_piece_gpu_nanos a frame on Iris).

Landing note: docs/API.md merged by hand with RUNTIME 2314's probe-parts sentence (both rewrote one
paragraph), and rate_mapped_pass.rs's Fan-out now says the probe runs in parts (RUNTIME 2314).
2026-11-14 14:32:33 -08:00
..