flowchart TD
V["vertex, domain or geometry shader
writes SV_CullDistance"] --> Q{"pixel shader?"}
Q -->|yes| A["application pixel shader
DXIL to SPIR-V (dxil-spirv)"]
Q -->|"no (before: ignored, fixme)"| E["empty fragment module
32 hand-written SPIR-V words"]
A --> M["SPIR-V to MSL (SPIRV-Cross)
patch 0008: recover each distance at the 3 vertices,
discard if one is negative at all of them
patch 0045: keep declared but unread inputs"]
E --> M
M --> R["Metal pipeline
no app pixel shader: colour writes masked"]