Summary
NfRectMaskContent now has fast-path implementations for Metal and OpenGL. Vulkan should get the same efficient rounded-rect mask behavior instead of relying on the regular clip/mask fallback.
Current behavior
For compatibility, Vulkan should treat NfRectMaskContent as a regular clip for now:
beginRectMask(maskRect, radii) should behave like beginMask(maskRect, radii) followed by endMask().
popRectMask() should behave like popMask().
That preserves rendering correctness while the fast path is unimplemented.
Desired implementation
Add a Vulkan fast path comparable to the Metal/OpenGL implementations:
- avoid flushing/drawing a mask queue for leaf GUI items that only need rounded-rect clipping behavior;
- carry rect-mask params/radii/transform data through the Vulkan vertex path only for batches that actually contain rect masks;
- keep normal non-clip batches on the existing path so regular scenes do not pay per-vertex or shader cost;
- support mixed batches: unmasked sibling, rect-masked sibling, then unmasked sibling again;
- fall back to regular clipping for nested rect masks or unsupported cases.
Suggested tests/benchmarks
- Reuse the mixed-batch regression render test in
tests/trender_layers_clip.nim with Vulkan enabled.
- Compare
examples/windy_clip_mask_benchmark.nim for clip + sub-clip vs clip + rect-mask on Vulkan.
- Run
examples/windy_non_clip_benchmark.nim to confirm normal non-clip scenes are not taxed.
Notes
Metal and OpenGL currently have fast paths. Vulkan should remain correct via regular clipping until this issue is implemented.
Summary
NfRectMaskContentnow has fast-path implementations for Metal and OpenGL. Vulkan should get the same efficient rounded-rect mask behavior instead of relying on the regular clip/mask fallback.Current behavior
For compatibility, Vulkan should treat
NfRectMaskContentas a regular clip for now:beginRectMask(maskRect, radii)should behave likebeginMask(maskRect, radii)followed byendMask().popRectMask()should behave likepopMask().That preserves rendering correctness while the fast path is unimplemented.
Desired implementation
Add a Vulkan fast path comparable to the Metal/OpenGL implementations:
Suggested tests/benchmarks
tests/trender_layers_clip.nimwith Vulkan enabled.examples/windy_clip_mask_benchmark.nimforclip + sub-clipvsclip + rect-maskon Vulkan.examples/windy_non_clip_benchmark.nimto confirm normal non-clip scenes are not taxed.Notes
Metal and OpenGL currently have fast paths. Vulkan should remain correct via regular clipping until this issue is implemented.