Instead of working on a single mask layer, compound masks let you combine multiple mask layers non-destructively using Boolean operations (add, subtract, etc.), and then edit each 'component' mask layer independently of each other.
While Affinity Photo 2 offers vector-based joins and non-destructive compounds, it also supports compound masks—a powerful masking system that uses the same Boolean operations (i.e., add, subtract, intersect or xor) but are instead applied to multiple mask layers non-destructively, i.e. without altering the individual mask layers.
Use compound masks for compositing and editing of complex textures, where you can combine more complex and diverse multiple masks. This gives a lot of flexibility as you can introduce different masking approaches and bring them together, e.g. a gradient mask layer combined with a painted mask layer.
Like other layers, any mask layer in the compound can be switched on/off, moved to another position on the layer stack or have its layer properties (e.g., opacity) altered.
If there is a pixel layer previously selected, the compound mask will be clipped to that layer; with no layer selected, it will be added to the top of your layer stack. You can drag the compound mask layer to a new position if needed.