%% how one 2x2 quad of pixel-shader threads emulates coarse pixels on an M1 (Metal has no shading rate).
flowchart TD
A["Quad of 4 pixel threads
(Metal runs every pixel)"] --> B["Rate: base, SV_ShadingRate,
16x16 image tile,
combiners and clamps"]
B --> C{"Rate
1x1?"}
C -- yes --> K["Shade normally"]
C -- no --> D["Pick a 2x2 block
of coarse pixels whose
owners are covered"]
D --> E{"Block
found?"}
E -- no --> K
E -- yes --> F["Each thread shades one
coarse pixel at its centre
(interpolate_at_offset)"]
F --> G["Coarse-sized
ddx / ddy"]
G --> H["quad_shuffle outputs
and discard from the owner"]
H --> I["Non-owners become
helpers: no UAV stores"]