%% one draw with the depth bounds test on an M1 (no native test before Apple10).
flowchart TD
DRAW["Draw with DepthBoundsTestEnable"] --> VALID{"snapshot of the depth
attachment still valid?"}
VALID -->|"no: a depth write, another
command, or new attachments"| COPY["end the render pass;
compute copy of the depth range
into a 2DArray (or MS array)"]
VALID -->|yes| PASS
COPY --> PASS["render pass: bind the copy at texture 0,
float4(min, max, enabled, 0) at buffer 30"]
PASS --> EARLY{"early fragment tests
and an occlusion query?"}
EARLY -->|no| FRAG
EARLY -->|yes| COUNT["count-only draw: same VS,
generated bounds function, no writes"]
COUNT --> REAL["the real draw,
visibility off"]
REAL --> FRAG
FRAG["fragment entry (SPIRV-Cross patch 0034):
read the stored depth per sample;
outside [min, max] → discard,
or clear the sample's bit in sample_mask"]