A render pass's end worked out two things about the tiles its draws reach at every pass,
whatever read them:
- the count of the 32-pixel tiles its draws' scissors cover against their bounding rectangle
(`DrawnArea::covered_tiles`), computed at every pass's first instance before `count_colors`
looked for a shadowed color attachment, where it feeds only
`shadow_attachment_tiles_covered` and `_bounded`, counted for a shadowed color the pass loads
within its draws' scissors; and
- the grid of the tiles the draws reach (`DrawnArea::tiles`), made at every pass whose draws
reach the tiles their primitives touch, where only a `DontCare` load given a clear reads it
(`ReachClears::plan`); elsewhere only whether it is empty mattered.
Now `count_colors` counts the tiles at the first shadowed color loaded within, once a pass;
the pass end asks whether the rectangles reach any tile with a scan of them
(`DrawnArea::reaches_no_tile`, no grid made) and makes the grid only for a `DontCare` load it
answered. The count itself goes by bands of rows between the rectangles' edges, setting a row's
tiles a word at a time, where it went row by row and tile by tile. The counters keep their
meaning and their values; the commands recorded are the same.
A compositor-shaped command buffer (35 draws in 6 passes, one 3840x2400 framebuffer pass) on
the M3 Max over MoltenVK, release, flat out, cache surfaces (no shadowed attachment), two
interleaved runs of 5000 buffers each:
end_encoding p50/p95/mean us: before 6.71/33.67/11.36 and 7.75/43.50/13.18,
after 5.75/7.79/5.94 and 5.96/7.83/6.05
The count was 49% of `end_encoding`'s CPU samples before. The work counts per buffer are the
same, with surfaces over host pages too (`shadow_attachment_tiles_bounded` 2597, `_covered`
2308 per buffer, as before).
Verified: `clear_reach` unit tests, the count checked against tiles counted one at a time over
200 sets of rectangles, and the scan against the grid; a device test
(`tests/pass_end_tiles.rs`, `--cfg m2v_gpu`, MoltenVK) counts the tile work done on the
encoding thread: none for a pass with no shadowed attachment, loaded or cleared, one grid for a
`DontCare` load, one count for a shadowed attachment it loads. With the eager work put back the
test fails (covered 1, grids 1 for the loaded pass).
(cherry picked from commit 8f62289f04f367e88e369e6351485d3b69819f71)