Unity UI Mask component confusion
Update:
After further investigation, it appears the UI Canvas batches UI/Default and TextMeshPro/Distance Field draw calls under Canvas.RenderSubBatch (in Frame Debugger call stack). Entirely within the scope of this batch, the Unity Mask component writes to the stencil buffer, then before exiting zeros it back out (see below). Does anyone know a way to get a Shapes shader to be batched within Canvas.RenderSubBatch? Without that it appears the Unity UI Mask component is useless for Shapes. The workaround is to create a custom mask using Shapes directly that writes to the stencil buffer as needed outside of Canvas.RenderSubBatch.
Original Issue:
I cannot get Unity's standard Mask component to mask Shapes/Line components. I've tried many different Line stencil buffer configurations, all of them either entirely remove the Line or not, with no regard to the Mask. Moreover, I can even put a TMP component on literally the same gameObject as the Line and exactly replicate the TMP's stencil buffer configuration, and the TMP text get masked out perfectly while the Shapes Line does not.
For reference, these are UI canvas components in World Space Render Mode. Here's an example configuration I would think should work but doesn't: